Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
ecbb4cf4
Commit
ecbb4cf4
authored
Sep 30, 2024
by
Rafael Monnerat
👻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Limit ticket creations per project
Under refactoring...
parent
e5884aff
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
28 deletions
+19
-28
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkComputeNodeState.py
...kins/slapos_crm_monitoring/Alarm_checkComputeNodeState.py
+0
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkInstanceTreeState.py
...ins/slapos_crm_monitoring/Alarm_checkInstanceTreeState.py
+0
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkSoftwareInstallationState.py
...os_crm_monitoring/Alarm_checkSoftwareInstallationState.py
+0
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkSoftwareInstallationState.py
..._monitoring/ComputeNode_checkSoftwareInstallationState.py
+5
-2
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
...tal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
+5
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/InstanceTree_checkSoftwareInstanceState.py
...crm_monitoring/InstanceTree_checkSoftwareInstanceState.py
+2
-3
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_isSupportRequestCreationClosed.py
..._crm_monitoring/Project_isSupportRequestCreationClosed.py
+5
-5
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_isSupportRequestCreationClosed.xml
...crm_monitoring/Project_isSupportRequestCreationClosed.xml
+2
-2
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkComputeNodeState.py
View file @
ecbb4cf4
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop process alarm if there are too many tickets
return
monitor_enabled_category
=
portal
.
restrictedTraverse
(
"portal_categories/monitor_scope/enabled"
,
None
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkInstanceTreeState.py
View file @
ecbb4cf4
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop verification if there are too much tickets
return
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Instance Tree'
,
validation_state
=
'validated'
,
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkSoftwareInstallationState.py
View file @
ecbb4cf4
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop process alarm if there are too many tickets
return
monitor_enabled_category
=
portal
.
restrictedTraverse
(
"portal_categories/monitor_scope/enabled"
,
None
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkSoftwareInstallationState.py
View file @
ecbb4cf4
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
if
(
context
.
getMonitorScope
()
==
"disabled"
)
or
\
portal
.
ERP5Site_isSupportRequestCreationClosed
():
if
(
context
.
getMonitorScope
()
==
"disabled"
):
return
project
=
context
.
getFollowUpValue
()
if
project
.
Project_isSupportRequestCreationClosed
():
return
software_installation_list
=
portal
.
portal_catalog
(
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
View file @
ecbb4cf4
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
if
(
context
.
getMonitorScope
()
==
"disabled"
)
or
\
portal
.
ERP5Site_isSupportRequestCreationClosed
():
if
(
context
.
getMonitorScope
()
==
"disabled"
):
return
project
=
context
.
getFollowUpValue
()
if
project
.
Project_isSupportRequestCreationClosed
():
return
reference
=
context
.
getReference
()
...
...
@@ -76,8 +79,6 @@ if not should_notify:
context
.
getTitle
(),
context
.
getReference
(),
last_contact
)
if
should_notify
:
project
=
context
.
getFollowUpValue
()
support_request
=
project
.
Project_createSupportRequestWithCausality
(
ticket_title
,
description
,
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/InstanceTree_checkSoftwareInstanceState.py
View file @
ecbb4cf4
...
...
@@ -4,8 +4,8 @@ from erp5.component.module.DateUtils import addToDate
instance_tree
=
context
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop ticket creation
project
=
context
.
getFollowUpValue
()
if
project
.
Project_isSupportRequestCreationClosed
():
return
date_check_limit
=
addToDate
(
DateTime
(),
to_add
=
{
'hour'
:
-
1
})
...
...
@@ -49,7 +49,6 @@ for instance in software_instance_list:
else
:
error_message
=
"No message!"
project
=
context
.
getFollowUpValue
()
support_request
=
project
.
Project_createSupportRequestWithCausality
(
ticket_title
,
description
,
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/
ERP5Site
_isSupportRequestCreationClosed.py
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/
Project
_isSupportRequestCreationClosed.py
View file @
ecbb4cf4
from
Products.ERP5Type.Cache
import
CachingMethod
portal
=
context
.
getPortalObject
()
def
isSupportRequestCreationClosed
(
destination_decision
=
None
):
assert
context
.
getPortalType
()
==
'Project'
,
"Wrong context, please update"
def
isSupportRequestCreationClosed
(
project_uid
):
limit
=
int
(
portal
.
portal_preferences
.
getPreferredSupportRequestCreationLimit
(
5
))
kw
=
{
'limit'
:
limit
,
'portal_type'
:
'Support Request'
,
'simulation_state'
:
[
"validated"
,
"submitted"
],
'follow_up__uid'
:
project_uid
,
'resource__uid'
:
portal
.
service_module
.
slapos_crm_monitoring
.
getUid
()
}
if
destination_decision
:
kw
[
'destination_decision__uid'
]
=
context
.
restrictedTraverse
(
destination_decision
).
getUid
()
support_request_amount_list
=
context
.
portal_catalog
(
**
kw
)
return
limit
<=
len
(
support_request_amount_list
)
...
...
@@ -20,4 +20,4 @@ def isSupportRequestCreationClosed(destination_decision=None):
return
CachingMethod
(
isSupportRequestCreationClosed
,
"isSupportRequestCreationClosed"
,
cache_factory
=
"erp5_content_short"
)(
destination_decision
=
destination_decision
)
cache_factory
=
"erp5_content_short"
)(
project_uid
=
project_uid
)
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/
ERP5Site
_isSupportRequestCreationClosed.xml
→
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/
Project
_isSupportRequestCreationClosed.xml
View file @
ecbb4cf4
...
...
@@ -50,11 +50,11 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
destination_decision=None,
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site
_isSupportRequestCreationClosed
</string>
</value>
<value>
<string>
Project
_isSupportRequestCreationClosed
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment