Commit 5aa5af44 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Turn restricted_softwaretype internal only

  As long the software type is passed, the restricted mode is enabled, since it is the only possible outcome.

  This simplifies the parameters passed to the editor.
parent 566e2482
......@@ -107,13 +107,10 @@
parameter_dict = {
'parameter' : {
'json_url': doc.url_string.split('?')[0] + ".json",
//'json_url': "https://lab.node.vifib.com/nexedi/slapos/raw/master/software/kvm/software.cfg.json",
'parameter_hash': btoa('<?xml version="1.0" encoding="utf-8" ?><instance/>'),
'restricted_softwaretype': false
'parameter_hash': btoa('<?xml version="1.0" encoding="utf-8" ?><instance/>')
}
};
if (options.software_type) {
parameter_dict["parameter"]['restricted_softwaretype'] = true;
parameter_dict["parameter"]['softwaretype'] = options.software_type;
}
if (options.shared) {
......
......@@ -279,7 +279,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>999.2068.62564.17</string> </value>
<value> <string>1000.31175.43828.12919</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -297,7 +297,7 @@
</tuple>
<state>
<tuple>
<float>1652724671.12</float>
<float>1669310140.13</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -226,8 +226,7 @@
'json_url': gadget.state.doc.url_string.split('?')[0] + ".json",
'softwaretype': gadget.state.doc.source_reference,
'shared': gadget.state.doc.root_slave ? 1 : 0,
'parameter_hash': btoa('<?xml version="1.0" encoding="utf-8" ?><instance></instance>'),
'restricted_softwaretype': true
'parameter_hash': btoa('<?xml version="1.0" encoding="utf-8" ?><instance></instance>')
}
};
if (gadget.state.doc.text_content !== undefined) {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1004.26871.45800.22818</string> </value>
<value> <string>1004.26872.6486.682</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1668800165.86</float>
<float>1669310224.29</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -1069,7 +1069,8 @@
})
.declareMethod('render', function (options) {
var parameter_hash = options.value.parameter.parameter_hash,
var restricted_softwaretype,
parameter_hash = options.value.parameter.parameter_hash,
// XXX Do we directly get parameter_xml parameter?
parameter_xml = options.value.parameter.parameter_xml;
......@@ -1078,6 +1079,12 @@
parameter_xml = atob(parameter_hash);
}
if (options.value.parameter.softwaretype !== undefined) {
restricted_softwaretype = true;
} else {
restricted_softwaretype = false;
}
return this.changeState({
// Not used parameters
// hidden: options.hidden,
......@@ -1085,7 +1092,7 @@
serialisation: options.serialisation,
json_url: options.value.parameter.json_url,
parameter_xml: parameter_xml,
restricted_softwaretype: options.value.parameter.restricted_softwaretype,
restricted_softwaretype: restricted_softwaretype,
shared: options.value.parameter.shared,
softwaretype: options.value.parameter.softwaretype,
softwareindex: options.value.parameter.softwareindex,
......
......@@ -280,7 +280,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1004.35236.24159.46370</string> </value>
<value> <string>1004.35244.29312.7338</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -298,7 +298,7 @@
</tuple>
<state>
<tuple>
<float>1669302506.42</float>
<float>1669310000.93</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -65,6 +65,7 @@
})
.declareMethod("triggerSubmit", function () {
// @ts-ignore
return this.element.querySelector('button[type="submit"]').click();
})
......@@ -72,10 +73,17 @@
if (options.url_string === undefined) {
options.url_string = "";
}
if (options.editable === undefined) {
options.editable = true;
}
if (options.restricted_softwaretype === undefined) {
options.restricted_softwaretype = false;
}
return this.changeState({
"url_string": options.url_string,
"parameter_output": options.parameter_output
})
"parameter_output": options.parameter_output,
"restricted_softwaretype": options.restricted_softwaretype
});
})
.onStateChange(function onStateChange() {
......
......@@ -277,7 +277,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1003.56162.18447.41164</string> </value>
<value> <string>1004.31514.19921.44151</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -295,7 +295,7 @@
</tuple>
<state>
<tuple>
<float>1666635866.16</float>
<float>1669083537.85</float>
<string>UTC</string>
</tuple>
</state>
......
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