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
Ophélie Gagnard
slapos.core
Commits
0ce94a7b
Commit
0ce94a7b
authored
Feb 07, 2018
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Draft implementation to replace "intent" API with a gadget.
parent
3ecbfd4d
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
913 additions
and
0 deletions
+913
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_html.html
...eb_page_module/rjs_gadget_erp5_page_slap_intent_html.html
+30
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_html.xml
...web_page_module/rjs_gadget_erp5_page_slap_intent_html.xml
+324
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_js.js
...em/web_page_module/rjs_gadget_erp5_page_slap_intent_js.js
+119
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_js.xml
...m/web_page_module/rjs_gadget_erp5_page_slap_intent_js.xml
+363
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareProduct_getSoftwareReleaseAsHateoas.py
...json_style/SoftwareProduct_getSoftwareReleaseAsHateoas.py
+11
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareProduct_getSoftwareReleaseAsHateoas.xml
...son_style/SoftwareProduct_getSoftwareReleaseAsHateoas.xml
+62
-0
master/bt5/slapos_jio/bt/template_keep_last_workflow_history_only_path_list
...jio/bt/template_keep_last_workflow_history_only_path_list
+2
-0
master/bt5/slapos_jio/bt/template_path_list
master/bt5/slapos_jio/bt/template_path_list
+2
-0
No files found.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_html.html
0 → 100644
View file @
0ce94a7b
<!DOCTYPE html>
<html>
<!--
data-i18n=Slapos
-->
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
Site List
</title>
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"gadget_erp5_page_slap_intent.js"
type=
"text/javascript"
></script>
</head>
<body>
<form
class=
"save_form ui-body-c"
novalidate
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"
></button>
<div
data-gadget-url=
"gadget_erp5_form.html"
data-gadget-scope=
"form_view"
data-gadget-sandbox=
"public"
>
</div>
</form>
</body>
</html>
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_html.xml
0 → 100644
View file @
0ce94a7b
This diff is collapsed.
Click to expand it.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_js.js
0 → 100644
View file @
0ce94a7b
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
'
notifySubmit
'
,
function
()
{
return
this
.
triggerSubmit
();
})
.
onEvent
(
'
submit
'
,
function
()
{
var
gadget
=
this
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
getContent
();
})
.
push
(
function
(
doc
)
{
return
gadget
.
getSetting
(
"
hateoas_url
"
)
.
push
(
function
(
url
)
{
return
gadget
.
jio_putAttachment
(
doc
.
relative_url
,
url
+
doc
.
relative_url
+
"
/SoftwareRelease_requestHostingSubscription
"
,
doc
);
});
})
.
push
(
function
(
key
)
{
return
gadget
.
notifySubmitted
({
message
:
'
New service created.
'
,
status
:
'
success
'
})
.
push
(
function
()
{
// Workaround, find a way to open document without break gadget.
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
"
options
"
:
{
"
jio_key
"
:
"
/
"
,
"
page
"
:
"
slap_service_list
"
}});
});
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
return
this
.
element
.
querySelector
(
'
button[type="submit"]
'
).
click
();
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
if
(
options
.
intent
!==
"
request
"
)
{
throw
new
Error
(
"
Intent not supported
"
);
}
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
updateHeader
({
page_title
:
"
Requesting a service...
"
});
})
.
push
(
function
()
{
return
gadget
.
getSetting
(
"
hateoas_url
"
)
.
push
(
function
(
url
)
{
return
gadget
.
jio_getAttachment
(
"
/
"
,
url
+
"
/SoftwareProduct_getSoftwareReleaseAsHateoas?software_release=
"
+
options
.
software_release
);
});
})
.
push
(
function
(
jio_key
)
{
if
(
options
.
auto
===
undefined
)
{
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
"
options
"
:
{
"
jio_key
"
:
jio_key
,
"
page
"
:
"
slap_add_hosting_subscription
"
,
"
title
"
:
options
.
title
}});
}
// The auto is set, so we move foward to auto request the SR
options
.
jio_key
=
jio_key
;
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_view
'
),
gadget
.
jio_get
(
jio_key
),
gadget
.
getSetting
(
"
hateoas_url
"
)
]);
})
.
push
(
function
(
result
)
{
var
software_release
=
result
[
1
],
url
=
result
[
2
],
title
=
options
.
software_title
?
options
.
software_title
:
"
Instance
"
,
doc
=
{};
doc
.
url_string
=
software_release
.
url_string
;
doc
.
title
=
title
;
doc
.
text_content
=
""
;
doc
.
relative_url
=
options
.
jio_key
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
jio_putAttachment
(
doc
.
relative_url
,
url
+
doc
.
relative_url
+
"
/SoftwareRelease_requestHostingSubscription
"
,
doc
);
})
.
push
(
function
(
key
)
{
return
gadget
.
notifySubmitted
({
message
:
'
New service created.
'
,
status
:
'
success
'
})
.
push
(
function
()
{
// Workaround, find a way to open document without break gadget.
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
"
options
"
:
{
"
jio_key
"
:
"
/
"
,
"
page
"
:
"
slap_service_list
"
}});
});
});
});
});
}(
window
,
rJS
,
RSVP
));
\ No newline at end of file
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_js.xml
0 → 100644
View file @
0ce94a7b
This diff is collapsed.
Click to expand it.
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareProduct_getSoftwareReleaseAsHateoas.py
0 → 100644
View file @
0ce94a7b
import
json
if
software_release
.
startswith
(
"product."
):
software_release_list
=
context
.
SoftwareProduct_getSortedSoftwareReleaseList
(
software_product_reference
=
software_release
[
8
:])
else
:
software_release_list
=
context
.
SoftwareProduct_getSortedSoftwareReleaseList
(
software_release_url
=
software_release
)
if
len
(
software_release_list
):
software_release_document
=
software_release_list
[
0
]
return
json
.
dumps
(
software_release_document
.
getRelativeUrl
())
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareProduct_getSoftwareReleaseAsHateoas.xml
0 → 100644
View file @
0ce94a7b
<?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>
software_release
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SoftwareProduct_getSoftwareReleaseAsHateoas
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/bt/template_keep_last_workflow_history_only_path_list
View file @
0ce94a7b
...
...
@@ -5,6 +5,8 @@ web_page_module/rjs_gadget_erp5_page_slap_transfer_computer_html
web_page_module/rjs_gadget_erp5_page_map_html
web_page_module/rjs_gadget_slapos_appcache
web_page_module/rjs_gadget_erp5_page_map_js
web_page_module/rjs_gadget_erp5_page_slap_intent_js
web_page_module/rjs_gadget_erp5_page_slap_intent_html
web_page_module/rjs_gadget_erp5_page_slap_add_computer_html
web_page_module/rjs_gadget_erp5_page_slap_add_computer_js
web_page_module/rjs_gadget_erp5_page_slap_add_hosting_subscription_html
...
...
master/bt5/slapos_jio/bt/template_path_list
View file @
0ce94a7b
...
...
@@ -40,6 +40,8 @@ web_page_module/rjs_gadget_erp5_page_slap_destroy_software_installation_html
web_page_module/rjs_gadget_erp5_page_slap_destroy_software_installation_js
web_page_module/rjs_gadget_erp5_page_slap_hosting_subscription_view_html
web_page_module/rjs_gadget_erp5_page_slap_hosting_subscription_view_js
web_page_module/rjs_gadget_erp5_page_slap_intent_html
web_page_module/rjs_gadget_erp5_page_slap_intent_js
web_page_module/rjs_gadget_erp5_page_slap_invoice_list_html
web_page_module/rjs_gadget_erp5_page_slap_invoice_list_js
web_page_module/rjs_gadget_erp5_page_slap_load_schema_html
...
...
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