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
d9330d2e
Commit
d9330d2e
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
48291d62
Changes
8
Show 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 @
d9330d2e
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop process alarm if there are too many tickets
return
monitor_enabled_category
=
portal
.
restrictedTraverse
(
monitor_enabled_category
=
portal
.
restrictedTraverse
(
"portal_categories/monitor_scope/enabled"
,
None
)
"portal_categories/monitor_scope/enabled"
,
None
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkInstanceTreeState.py
View file @
d9330d2e
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop verification if there are too much tickets
return
portal
.
portal_catalog
.
searchAndActivate
(
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Instance Tree'
,
portal_type
=
'Instance Tree'
,
validation_state
=
'validated'
,
validation_state
=
'validated'
,
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkSoftwareInstallationState.py
View file @
d9330d2e
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop process alarm if there are too many tickets
return
monitor_enabled_category
=
portal
.
restrictedTraverse
(
monitor_enabled_category
=
portal
.
restrictedTraverse
(
"portal_categories/monitor_scope/enabled"
,
None
)
"portal_categories/monitor_scope/enabled"
,
None
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkSoftwareInstallationState.py
View file @
d9330d2e
from
DateTime
import
DateTime
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
(
context
.
getMonitorScope
()
==
"disabled"
)
or
\
if
(
context
.
getMonitorScope
()
==
"disabled"
):
portal
.
ERP5Site_isSupportRequestCreationClosed
():
return
project
=
context
.
getFollowUpValue
()
if
project
.
Project_isSupportRequestCreationClosed
():
return
return
software_installation_list
=
portal
.
portal_catalog
(
software_installation_list
=
portal
.
portal_catalog
(
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
View file @
d9330d2e
from
DateTime
import
DateTime
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
(
context
.
getMonitorScope
()
==
"disabled"
)
or
\
if
(
context
.
getMonitorScope
()
==
"disabled"
):
portal
.
ERP5Site_isSupportRequestCreationClosed
():
return
project
=
context
.
getFollowUpValue
()
if
project
.
Project_isSupportRequestCreationClosed
():
return
return
reference
=
context
.
getReference
()
reference
=
context
.
getReference
()
...
@@ -76,8 +79,6 @@ if not should_notify:
...
@@ -76,8 +79,6 @@ if not should_notify:
context
.
getTitle
(),
context
.
getReference
(),
last_contact
)
context
.
getTitle
(),
context
.
getReference
(),
last_contact
)
if
should_notify
:
if
should_notify
:
project
=
context
.
getFollowUpValue
()
support_request
=
project
.
Project_createSupportRequestWithCausality
(
support_request
=
project
.
Project_createSupportRequestWithCausality
(
ticket_title
,
ticket_title
,
description
,
description
,
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/InstanceTree_checkSoftwareInstanceState.py
View file @
d9330d2e
...
@@ -4,8 +4,8 @@ from erp5.component.module.DateUtils import addToDate
...
@@ -4,8 +4,8 @@ from erp5.component.module.DateUtils import addToDate
instance_tree
=
context
instance_tree
=
context
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
project
=
context
.
getFollowUpValue
()
# Stop ticket creation
if
project
.
Project_isSupportRequestCreationClosed
():
return
return
date_check_limit
=
addToDate
(
DateTime
(),
to_add
=
{
'hour'
:
-
1
})
date_check_limit
=
addToDate
(
DateTime
(),
to_add
=
{
'hour'
:
-
1
})
...
@@ -49,7 +49,6 @@ for instance in software_instance_list:
...
@@ -49,7 +49,6 @@ for instance in software_instance_list:
else
:
else
:
error_message
=
"No message!"
error_message
=
"No message!"
project
=
context
.
getFollowUpValue
()
support_request
=
project
.
Project_createSupportRequestWithCausality
(
support_request
=
project
.
Project_createSupportRequestWithCausality
(
ticket_title
,
ticket_title
,
description
,
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 @
d9330d2e
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
portal
=
context
.
getPortalObject
()
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
))
limit
=
int
(
portal
.
portal_preferences
.
getPreferredSupportRequestCreationLimit
(
5
))
kw
=
{
kw
=
{
'limit'
:
limit
,
'limit'
:
limit
,
'portal_type'
:
'Support Request'
,
'portal_type'
:
'Support Request'
,
'simulation_state'
:
[
"validated"
,
"submitted"
],
'simulation_state'
:
[
"validated"
,
"submitted"
],
'follow_up__uid'
:
project_uid
,
'resource__uid'
:
portal
.
service_module
.
slapos_crm_monitoring
.
getUid
()
'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
)
support_request_amount_list
=
context
.
portal_catalog
(
**
kw
)
return
limit
<=
len
(
support_request_amount_list
)
return
limit
<=
len
(
support_request_amount_list
)
...
@@ -20,4 +20,4 @@ def isSupportRequestCreationClosed(destination_decision=None):
...
@@ -20,4 +20,4 @@ def isSupportRequestCreationClosed(destination_decision=None):
return
CachingMethod
(
isSupportRequestCreationClosed
,
return
CachingMethod
(
isSupportRequestCreationClosed
,
"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 @
d9330d2e
...
@@ -50,11 +50,11 @@
...
@@ -50,11 +50,11 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
destination_decision=None,
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site
_isSupportRequestCreationClosed
</string>
</value>
<value>
<string>
Project
_isSupportRequestCreationClosed
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</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