Commit 1cb8ac8c authored by Romain Courteaud's avatar Romain Courteaud

slapos_jio: drop software installation creation

parent 8a38ae05
<!DOCTYPE html>
<html>
<!--
data-i18n=New Software Installation created.
data-i18n=The name of a document in ERP5
data-i18n=Software Release to be Installed
data-i18n=Target Compute Node Title
data-i18n=Target Compute Node Reference
data-i18n=Compute Node
data-i18n=Parent Relative Url
data-i18n=Proceed to Supply Software
-->
<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_add_software_installation.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>
/*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("updatePanel", "updatePanel")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("getTranslationList", "getTranslationList")
/////////////////////////////////////////////////////////////////
// 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_getAttachment(doc.relative_url,
url + doc.relative_url + "/SoftwareRelease_requestSoftwareInstallation?compute_node=" + doc.compute_node);
});
})
.push(function (key) {
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"}});
});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function (options) {
var gadget = this,
page_title_translation,
translation_list = [
"New Software Installation created.",
"The name of a document in ERP5",
"Software Release to be Installed",
"Target Compute Node Title",
"Target Compute Node Reference",
"Compute Node",
"Parent Relative Url",
"Proceed to Supply Software"
];
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_view'),
gadget.jio_get(options.jio_key),
gadget.jio_get(options.compute_node_jio_key),
gadget.getTranslationList(translation_list)
]);
})
.push(function (result) {
gadget.message_translation = result[3][0];
page_title_translation = result[3][7];
var doc = result[1],
compute_node = result[2];
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_url_string": {
"description": result[3][1],
"title": result[3][2],
"default": doc.url_string,
"css_class": "",
"required": 0,
"editable": 0,
"key": "title",
"hidden": 0,
"type": "StringField"
},
"your_compute_node_title": {
"description": result[3][1],
"title": result[3][3],
"default": compute_node.title,
"css_class": "",
"required": 0,
"editable": 0,
"key": "title",
"hidden": 0,
"type": "StringField"
},
"your_compute_node_reference": {
"description": result[3][1],
"title": result[3][4],
"default": compute_node.reference,
"css_class": "",
"required": 0,
"editable": 0,
"key": "compute_node_reference",
"hidden": 0,
"type": "StringField"
},
"your_compute_node": {
"description": result[3][5],
"title": result[3][5],
"default": options.compute_node_jio_key,
"css_class": "",
"required": 1,
"editable": 1,
"key": "compute_node",
"hidden": 1,
"type": "StringField"
},
"my_relative_url": {
"description": "",
"title": result[3][6],
"default": options.jio_key,
"css_class": "",
"required": 1,
"editable": 1,
"key": "relative_url",
"hidden": 1,
"type": "StringField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"center",
[["my_url_string"], ["your_compute_node_title"], ["your_compute_node_reference"],
["your_compute_node"], ["my_relative_url"]]
]]
}
})
.push(function () {
return gadget.updatePanel({
jio_key: "software_installation_module"
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'change', options: {"page": "slap_select_software_release"}})
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: page_title_translation + " " + doc.title + " on " + compute_node.reference,
selection_url: url_list[0],
submit_action: true
});
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
import json
portal = context.getPortalObject()
compute_node = portal.restrictedTraverse(compute_node)
compute_node.requestSoftwareRelease(
software_release_url=context.getUrlString(),
state='available')
return json.dumps(context.REQUEST.get('software_installation_url'))
<?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>compute_node</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareRelease_requestSoftwareInstallation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -27,8 +27,6 @@ web_page_module/rjs_gadget_erp5_page_slap_add_organisation_html
web_page_module/rjs_gadget_erp5_page_slap_add_organisation_js
web_page_module/rjs_gadget_erp5_page_slap_add_project_html
web_page_module/rjs_gadget_erp5_page_slap_add_project_js
web_page_module/rjs_gadget_erp5_page_slap_add_software_installation_html
web_page_module/rjs_gadget_erp5_page_slap_add_software_installation_js
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_html
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_js
web_page_module/rjs_gadget_erp5_page_slap_close_ticket_html
......
......@@ -24,8 +24,6 @@ web_page_module/rjs_gadget_erp5_page_slap_add_organisation_html
web_page_module/rjs_gadget_erp5_page_slap_add_organisation_js
web_page_module/rjs_gadget_erp5_page_slap_add_project_html
web_page_module/rjs_gadget_erp5_page_slap_add_project_js
web_page_module/rjs_gadget_erp5_page_slap_add_software_installation_html
web_page_module/rjs_gadget_erp5_page_slap_add_software_installation_js
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_html
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_js
web_page_module/rjs_gadget_erp5_page_slap_close_ticket_html
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment