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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.core
Commits
76618994
Commit
76618994
authored
Jan 06, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio&cloud: Use Person.requestSupport() API
parent
c4f14884
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1116 additions
and
75 deletions
+1116
-75
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSupportRequest.py
...interface_workflow/script_Person_requestSupportRequest.py
+4
-1
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_add_ticket_js.js
...eb_page_module/rjs_gadget_erp5_page_slap_add_ticket_js.js
+30
-72
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_add_ticket_js.xml
...b_page_module/rjs_gadget_erp5_page_slap_add_ticket_js.xml
+2
-2
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_requestSupport.py
...rtal_skins/slapos_hal_json_style/Person_requestSupport.py
+21
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_requestSupport.xml
...tal_skins/slapos_hal_json_style/Person_requestSupport.xml
+62
-0
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.xml
..._tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.xml
+58
-0
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.zpt
..._tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.zpt
+381
-0
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.xml
...tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.xml
+58
-0
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.zpt
...tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.zpt
+500
-0
No files found.
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSupportRequest.py
View file @
76618994
...
...
@@ -9,8 +9,10 @@ try:
support_request_title
=
kwargs
[
'support_request_title'
]
resource
=
kwargs
[
'support_request_resource'
]
description
=
kwargs
[
'support_request_description'
]
# Aggregate can be None, so it isn't included on the kwargs
aggregate
=
kwargs
.
get
(
"support_request_aggregate"
,
None
)
except
KeyError
:
raise
TypeError
,
"Person_requestSupportRequest takes exactly
1 argument
"
raise
TypeError
,
"Person_requestSupportRequest takes exactly
4 arguments
"
tag
=
"%s_%s_SupportRequestInProgress"
%
(
person
.
getUid
(),
support_request_title
)
...
...
@@ -28,6 +30,7 @@ support_request = module.newContent(
description
=
description
,
resource
=
resource
,
destination_decision_value
=
person
,
aggregate
=
aggregate
,
specialise
=
"sale_trade_condition_module/slapos_ticket_trade_condition"
,
activate_kw
=
{
'tag'
:
tag
}
)
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_add_ticket_js.js
View file @
76618994
...
...
@@ -11,9 +11,10 @@
.
declareAcquiredMethod
(
"
updatePanel
"
,
"
updatePanel
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSettingList
"
,
"
getSettingList
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_p
ost
"
,
"
jio_pos
t
"
)
.
declareAcquiredMethod
(
"
jio_p
utAttachment
"
,
"
jio_putAttachmen
t
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
...
...
@@ -26,6 +27,7 @@
return
this
.
triggerSubmit
();
})
.
onEvent
(
'
submit
'
,
function
()
{
var
gadget
=
this
;
return
gadget
.
notifySubmitting
()
...
...
@@ -33,28 +35,31 @@
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
getContent
();
return
RSVP
.
all
([
form_gadget
.
getContent
(),
gadget
.
getSettingList
([
'
me
'
,
'
hateoas_url
'
])]);
})
.
push
(
function
(
content
)
{
var
property
,
doc
=
{};
for
(
property
in
content
)
{
if
((
content
.
hasOwnProperty
(
property
))
&&
// Remove undefined keys added by Gadget fields
(
property
!==
"
undefined
"
)
&&
// Remove default_*:int keys added by ListField
!
(
property
.
endsWith
(
"
:int
"
)
&&
property
.
startsWith
(
"
default_
"
)))
{
doc
[
property
]
=
content
[
property
];
}
}
return
gadget
.
jio_post
(
doc
);
.
push
(
function
(
result
)
{
var
doc
=
result
[
0
],
me
=
result
[
1
][
0
],
url
=
result
[
1
][
1
];
return
gadget
.
jio_putAttachment
(
me
,
url
+
me
+
"
/Person_requestSupport
"
,
{
title
:
doc
.
title
,
description
:
doc
.
description
,
resource
:
doc
.
resource
});
})
.
push
(
function
(
attachment
)
{
return
jIO
.
util
.
readBlobAsText
(
attachment
.
target
.
response
);
})
.
push
(
function
(
key
)
{
.
push
(
function
(
response
)
{
return
JSON
.
parse
(
response
.
target
.
result
);
})
.
push
(
function
(
result
)
{
return
gadget
.
notifySubmitted
({
message
:
gadget
.
message_translation
,
status
:
'
success
'
})
.
push
(
function
()
{
// Workaround, find a way to open document without break gadget.
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
"
options
"
:
{
"
jio_key
"
:
key
,
"
page
"
:
"
slap_controller
"
}});
"
options
"
:
{
"
jio_key
"
:
result
.
relative_url
,
"
page
"
:
"
slap_controller
"
}});
});
});
})
...
...
@@ -88,20 +93,19 @@
gadget
.
getDeclaredGadget
(
'
form_view
'
),
gadget
.
jio_getAttachment
(
"
ticket_resource_list
"
,
hateoas_url
+
"
Ticket_getResourceItemListAsJSON
"
),
window
.
getSettingMe
(
gadget
),
gadget
.
getTranslationList
(
translation_list
)
]);
})
.
push
(
function
(
result
)
{
gadget
.
message_translation
=
result
[
3
][
0
];
page_title_translation
=
result
[
3
][
10
];
gadget
.
message_translation
=
result
[
2
][
0
];
page_title_translation
=
result
[
2
][
10
];
return
result
[
0
].
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
my_title
"
:
{
"
description
"
:
result
[
3
][
1
],
"
title
"
:
result
[
3
][
2
],
"
description
"
:
result
[
2
][
1
],
"
title
"
:
result
[
2
][
2
],
"
default
"
:
""
,
"
css_class
"
:
""
,
"
required
"
:
1
,
...
...
@@ -112,7 +116,7 @@
},
"
my_description
"
:
{
"
description
"
:
""
,
"
title
"
:
result
[
3
][
3
],
"
title
"
:
result
[
2
][
3
],
"
default
"
:
""
,
"
css_class
"
:
""
,
"
required
"
:
1
,
...
...
@@ -122,8 +126,8 @@
"
type
"
:
"
TextAreaField
"
},
"
my_resource
"
:
{
"
description
"
:
result
[
3
][
0
],
"
title
"
:
result
[
3
][
4
],
"
description
"
:
result
[
2
][
0
],
"
title
"
:
result
[
2
][
4
],
"
default
"
:
""
,
"
items
"
:
result
[
1
],
"
css_class
"
:
""
,
...
...
@@ -132,52 +136,6 @@
"
key
"
:
"
resource
"
,
"
hidden
"
:
0
,
"
type
"
:
"
ListField
"
},
"
my_destination_decision
"
:
{
"
description
"
:
result
[
3
][
0
],
"
title
"
:
result
[
3
][
5
],
"
default
"
:
result
[
2
],
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
destination_decision
"
,
"
hidden
"
:
1
,
"
type
"
:
"
StringField
"
},
"
my_specialise
"
:
{
"
description
"
:
""
,
"
title
"
:
result
[
3
][
6
],
// Auto Set a hardcoded trade Condition
// Please replace it by a getSetting.
"
default
"
:
"
sale_trade_condition_module/slapos_ticket_trade_condition
"
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
specialise
"
,
"
hidden
"
:
1
,
"
type
"
:
"
StringField
"
},
"
my_portal_type
"
:
{
"
description
"
:
result
[
3
][
0
],
"
title
"
:
result
[
3
][
7
],
"
default
"
:
"
Support Request
"
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
portal_type
"
,
"
hidden
"
:
1
,
"
type
"
:
"
StringField
"
},
"
my_parent_relative_url
"
:
{
"
description
"
:
""
,
"
title
"
:
result
[
3
][
9
],
"
default
"
:
"
support_request_module
"
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
parent_relative_url
"
,
"
hidden
"
:
1
,
"
type
"
:
"
StringField
"
}
}},
"
_links
"
:
{
...
...
@@ -193,7 +151,7 @@
[[
"
my_resource
"
]]
],
[
"
center
"
,
[[
"
my_title
"
],
[
"
my_description
"
]
,
[
"
my_specialise
"
],
[
"
my_destination_decision
"
],
[
"
my_portal_type
"
],
[
"
my_parent_relative_url
"
]
]
[[
"
my_title
"
],
[
"
my_description
"
]]
]]
}
});
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_add_ticket_js.xml
View file @
76618994
...
...
@@ -279,7 +279,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
87.11835.35244.22135
</string>
</value>
<value>
<string>
9
97.18055.28455.10120
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -297,7 +297,7 @@
</tuple>
<state>
<tuple>
<float>
16
02260862.83
</float>
<float>
16
41264462.37
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_requestSupport.py
0 → 100644
View file @
76618994
import
json
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
request
=
context
.
REQUEST
response
=
request
.
RESPONSE
if
person
is
None
:
response
.
setStatus
(
403
)
else
:
request_kw
=
{
"support_request_title"
:
title
,
"support_request_description"
:
description
,
"support_request_resource"
:
resource
,
"support_request_aggregate"
:
aggregate
}
person
.
requestSupport
(
**
request_kw
)
support_relative_url
=
request
.
get
(
'support_request_relative_url'
)
response
.
setHeader
(
'Content-Type'
,
"application/json"
)
return
json
.
dumps
({
"relative_url"
:
support_relative_url
})
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_requestSupport.xml
0 → 100644
View file @
76618994
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title, description, resource, aggregate=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_requestSupport
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.xml
0 → 100644
View file @
76618994
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testSlapOSJSServerTicketRelated
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServerTicketRelated.zpt
0 → 100644
View file @
76618994
This diff is collapsed.
Click to expand it.
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.xml
0 → 100644
View file @
76618994
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testSlapOSJSServiceTicketRelated
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio_ui_test/PathTemplateItem/portal_tests/slaposjs_zuite/testSlapOSJSServiceTicketRelated.zpt
0 → 100644
View file @
76618994
This diff is collapsed.
Click to expand it.
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