Commit 832d0b30 authored by Romain Courteaud's avatar Romain Courteaud

slapos_jio: drop slap_add_compute_node page

parent ad9478d7
<!doctype html>
<html>
<!--
data-i18n=New Compute Node created.
data-i18n=The name of a document in ERP5
data-i18n=Title
data-i18n=Reference
data-i18n=Link to the Compute Node
data-i18n=Your Certificate
data-i18n=Your Key
data-i18n=Parent Relative Url
data-i18n=New Compute Node
-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Add Text Document</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_slap_add_compute_node.js"></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_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) {
// This is horrible
return gadget.jio_getAttachment(doc.parent_relative_url,
url + doc.parent_relative_url + "/Person_requestComputeNode?title=" + doc.title);
});
})
.push(function (result) {
return gadget.notifySubmitted({message: gadget.message_translation, status: 'success'})
.push(function () {
return gadget.render(result);
});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function (options) {
var gadget = this,
page_title_translation,
translation_list = [
"New Compute Node created.",
"The name of a document in ERP5",
"Title",
"Reference",
"Link to the Compute Node",
"Your Certificate",
"Your Key",
"Parent Relative Url",
"New Compute Node"
];
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_view'),
gadget.getUrlFor({command: "change",
options: { jio_key: options.relative_url, page: "slap_controller"}}),
gadget.getTranslationList(translation_list)
]);
})
.push(function (result) {
gadget.message_translation = result[2][0];
page_title_translation = result[2][8];
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": result[2][1],
"title": result[2][2],
"default": "",
"css_class": "",
"required": 1,
"editable": 1,
"key": "title",
"hidden": (options.certificate === undefined) ? 0 : 1,
"type": "StringField"
},
"my_reference": {
"description": result[2][1],
"title": result[2][3],
"default": options.reference,
"css_class": "",
"required": 1,
"editable": 0,
"key": "reference",
"hidden": (options.reference === undefined) ? 1 : 0,
"type": "StringField"
},
"my_compute_node_url": {
"description": "",
"title": result[2][4],
"default": "<a href=" + result[1] + "> Click here to access your compute_node </a>",
"css_class": "",
"required": 1,
"editable": 0,
"key": "compute_node_url",
"hidden": (options.certificate === undefined) ? 1 : 0,
"type": "EditorField"
},
"my_certificate": {
"description": "",
"title": result[2][5],
"default": options.certificate,
"css_class": "",
"required": 1,
"editable": 1,
"key": "certificate",
"hidden": (options.certificate === undefined) ? 1 : 0,
"type": "TextAreaField"
},
"my_key": {
"description": "",
"title": result[2][6],
"default": options.key,
"css_class": "",
"required": 1,
"editable": 1,
"key": "key",
"hidden": (options.key === undefined) ? 1 : 0,
"type": "TextAreaField"
},
"my_parent_relative_url": {
"description": "",
"title": result[2][7],
"default": "compute_node_module",
"css_class": "",
"required": 1,
"editable": 1,
"key": "parent_relative_url",
"hidden": 1,
"type": "StringField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_parent_relative_url"]]
], [
"center",
[["my_key"], ["my_certificate"]]
], [
"bottom",
[["my_compute_node_url"]]
]]
}
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "compute_node_module"
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'change', options: {page: "slap_compute_node_list"}})
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: page_title_translation,
selection_url: url_list[0],
submit_action: true
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
...@@ -136,7 +136,6 @@ ...@@ -136,7 +136,6 @@
}) })
.push(function (frontpage_gadget) { .push(function (frontpage_gadget) {
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: "change", options: {"page": "slap_add_compute_node"}}),
gadget.getUrlFor({command: "change", options: {page: "slap_compute_node_get_token"}}), gadget.getUrlFor({command: "change", options: {page: "slap_compute_node_get_token"}}),
gadget.getUrlFor({command: "change", options: {"page": frontpage_gadget}}), gadget.getUrlFor({command: "change", options: {"page": frontpage_gadget}}),
gadget.updatePanel({jio_key: "compute_node_module"}) gadget.updatePanel({jio_key: "compute_node_module"})
...@@ -146,10 +145,9 @@ ...@@ -146,10 +145,9 @@
.push(function (result) { .push(function (result) {
return gadget.updateHeader({ return gadget.updateHeader({
page_title: servers_translation, page_title: servers_translation,
token_url: result[1], token_url: result[0],
selection_url: result[2], selection_url: result[1],
filter_action: true, filter_action: true
add_url: result[0]
}); });
}); });
}); });
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1010.39712.21917.33587</string> </value> <value> <string>1002.12197.26478.31573</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1692646587.64</float> <float>1660728449.33</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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 = dict(compute_node_title=title)
person.requestComputeNode(**request_kw)
compute_node = context.restrictedTraverse(context.REQUEST.get('compute_node'))
compute_node.generateCertificate()
response.setHeader('Content-Type', "application/json")
return json.dumps({
"certificate" : request.get('compute_node_certificate'),
"key" : request.get('compute_node_key'),
"reference": compute_node.getReference(),
"relative_url": compute_node.getRelativeUrl()
})
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_requestComputeNode</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -16,8 +16,6 @@ web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_html ...@@ -16,8 +16,6 @@ web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_html
web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_js web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_js
web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_html web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_html
web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_js web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_js
web_page_module/rjs_gadget_erp5_page_slap_add_compute_node_html
web_page_module/rjs_gadget_erp5_page_slap_add_compute_node_js
web_page_module/rjs_gadget_erp5_page_slap_add_instance_tree_html web_page_module/rjs_gadget_erp5_page_slap_add_instance_tree_html
web_page_module/rjs_gadget_erp5_page_slap_add_instance_tree_js web_page_module/rjs_gadget_erp5_page_slap_add_instance_tree_js
web_page_module/rjs_gadget_erp5_page_slap_add_network_html web_page_module/rjs_gadget_erp5_page_slap_add_network_html
...@@ -193,4 +191,4 @@ web_page_module/slapos_admin_front_page ...@@ -193,4 +191,4 @@ web_page_module/slapos_admin_front_page
web_site_module/hostingjs web_site_module/hostingjs
web_site_module/hostingjs/** web_site_module/hostingjs/**
web_site_module/renderjs_oss web_site_module/renderjs_oss
web_site_module/renderjs_oss/** web_site_module/renderjs_oss/**
\ No newline at end of file
...@@ -16,8 +16,6 @@ web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_html ...@@ -16,8 +16,6 @@ web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_html
web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_js web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_js
web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_html web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_html
web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_js web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_js
web_page_module/rjs_gadget_erp5_page_slap_add_compute_node_html
web_page_module/rjs_gadget_erp5_page_slap_add_compute_node_js
web_page_module/rjs_gadget_erp5_page_slap_add_instance_tree_html web_page_module/rjs_gadget_erp5_page_slap_add_instance_tree_html
web_page_module/rjs_gadget_erp5_page_slap_add_instance_tree_js web_page_module/rjs_gadget_erp5_page_slap_add_instance_tree_js
web_page_module/rjs_gadget_erp5_page_slap_add_network_html web_page_module/rjs_gadget_erp5_page_slap_add_network_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