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
18
Merge Requests
18
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
nexedi
slapos.core
Commits
cdbdd701
Commit
cdbdd701
authored
Sep 09, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Display Regularisation requests on attention point
parent
56c433b3
Pipeline
#11392
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
10 deletions
+36
-10
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Base_getAttentionPointList.py
...skins/slapos_hal_json_style/Base_getAttentionPointList.py
+36
-10
No files found.
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Base_getAttentionPointList.py
View file @
cdbdd701
from
json
import
dumps
attention_point_list
=
[]
portal
=
context
.
getPortalObject
()
# For now keep the logic here hardcoded.
if
context
.
getPortalType
()
==
"Hosting Subscription"
:
def
addAttentionForTicket
(
ticket
):
msg
=
None
if
ticket
.
getPortalType
()
==
"Support Request"
:
msg
=
context
.
Base_translateString
(
"Ticket waiting your response"
)
elif
ticket
.
getPortalType
()
==
"Upgrade Decision"
:
msg
=
context
.
Base_translateString
(
"Please Upgrade this service"
)
elif
ticket
.
getPortalType
()
==
"Regularisation Request"
:
msg
=
context
.
Base_translateString
(
"Regularisation waiting your response"
)
if
msg
:
return
{
"text"
:
msg
,
"link"
:
ticket
.
getRelativeUrl
()}
# Display unresponded tickets on services or servers
if
context
.
getPortalType
()
in
[
"Hosting Subscription"
,
"Computer"
]:
simulation_state
=
[
"suspended"
,
"confirmed"
]
for
ticket
in
context
.
Base_getOpenRelatedTicketList
(
limit
=
3
,
simulation_state
=
simulation_state
):
if
ticket
.
getPortalType
()
==
"Support Request"
:
attention_point_list
.
append
(
{
"text"
:
"Ticket waiting your response"
,
"link"
:
ticket
.
getRelativeUrl
()})
elif
ticket
.
getPortalType
()
==
"Upgrade Decision"
:
attention_point_list
.
append
(
{
"text"
:
"Please Upgrade this service"
,
"link"
:
ticket
.
getRelativeUrl
()})
entry
=
addAttentionForTicket
(
ticket
)
if
entry
is
not
None
:
attention_point_list
.
append
(
entry
)
# This is a limitation of the API that will consider that all tickets
# Are from this module
if
context
.
getPortalType
()
in
[
"Support Request Module"
]:
simulation_state
=
[
"suspended"
,
"confirmed"
]
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
for
ticket
in
portal
.
portal_catalog
(
portal_type
=
(
"Support Request"
,
"Upgrade Decision"
,
"Regularisation Request"
),
destination_decision_uid
=
person
.
getUid
(),
limit
=
3
,
simulation_state
=
simulation_state
):
entry
=
addAttentionForTicket
(
ticket
)
if
entry
is
not
None
:
attention_point_list
.
append
(
entry
)
return
dumps
(
attention_point_list
)
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