Commit 3fb609ec by Rafael Monnerat

slapos_jio: Fix parameter form for selecting right schema for the software type.

1 parent dda7b27e
......@@ -654,7 +654,8 @@
.push(function (json) {
var option_index,
option,
option_selected = options.value.parameter.softwaretypeindex,
option_selected = options.value.parameter.softwaretype,
option_selected_index = options.value.parameter.softwaretypeindex,
restricted_softwaretype = options.value.parameter.restricted_softwaretype,
input = gadget.element.querySelector('select.slapos-software-type'),
parameter_shared = gadget.element.querySelector('input.parameter_shared'),
......@@ -682,7 +683,8 @@
}
if (option_selected === undefined) {
option_selected = option_index;
option_selected = option.value;
option_selected_index = option_index;
if (json['software-type'][option_index].shared === true) {
parameter_shared.value = true;
} else {
......@@ -703,6 +705,7 @@
if ((option.value === option_selected) &&
(options.value.parameter.shared == json['software-type'][option_index].shared)) {
option.selected = "selected";
option_selected_index = option_index;
if (json['software-type'][option_index].shared === true) {
parameter_shared.value = true;
} else {
......@@ -732,19 +735,19 @@
}
throw new Error("The software type is not part of the json (" + softwaretype + ")");
}
if (json['software-type'][softwaretype] === undefined) {
if (json['software-type'][option_selected_index] === undefined) {
throw new Error("The sotware type is not part of the json (" + softwaretype + ")");
}
if (json['software-type'][softwaretype].serialisation !== undefined) {
s_input.value = json['software-type'][softwaretype].serialisation;
options.serialisation = json['software-type'][softwaretype].serialisation;
if (json['software-type'][option_selected_index].serialisation !== undefined) {
s_input.value = json['software-type'][option_selected_index].serialisation;
options.serialisation = json['software-type'][option_selected_index].serialisation;
} else {
s_input.value = json.serialisation;
options.serialisation = json.serialisation;
}
return json['software-type'][softwaretype].request;
return json['software-type'][option_selected_index].request;
})
.push(function (parameter_json_schema_url) {
var parameter_dict = {}, json_url_uri, prefix, parameter_entry;
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.24439.33534.42308</string> </value>
<value> <string>966.29810.18989.64802</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1521824575.6</float>
<float>1522149313.98</float>
<string>UTC</string>
</tuple>
</state>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!