Commit 8dc14833 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Changes on raw parameter text area are picked by the form

   Whenever a user changes the Raw XML them return to the form, the  changes on XML are loaded into the form. This allow the user reuse a known xml form as template.
parent 36f02301
...@@ -673,18 +673,18 @@ ...@@ -673,18 +673,18 @@
textarea = document.createElement("textarea"), textarea = document.createElement("textarea"),
fieldset = document.createElement("fieldset"), fieldset = document.createElement("fieldset"),
fieldset_list = g.element.querySelectorAll('fieldset'), fieldset_list = g.element.querySelectorAll('fieldset'),
button0 = g.element.querySelector("button.slapos-show-raw-parameter"), show_raw_button = g.element.querySelector("button.slapos-show-raw-parameter"),
button1 = g.element.querySelector("button.slapos-show-form"); show_form_button = g.element.querySelector("button.slapos-show-form");
if (g.disable_raw_edit === true) { if (g.disable_raw_edit === true) {
return fieldset; return fieldset;
} }
if (button0 !== null) { if (show_raw_button !== null) {
$(button0).addClass("hidden-button"); $(show_raw_button).addClass("hidden-button");
} }
if (button1 !== null) { if (show_form_button !== null) {
$(button1).addClass("hidden-button"); $(show_form_button).addClass("hidden-button");
} }
div.setAttribute("class", "field"); div.setAttribute("class", "field");
...@@ -1069,18 +1069,20 @@ ...@@ -1069,18 +1069,20 @@
function showParameterForm(evt) { function showParameterForm(evt) {
var e = g.element.getElementsByTagName('select')[0], var e = g.element.getElementsByTagName('select')[0],
to_hide = g.element.querySelector("button.slapos-show-form"), to_hide = g.element.querySelector("button.slapos-show-form"),
to_show = g.element.querySelector("button.slapos-show-raw-parameter"); to_show = g.element.querySelector("button.slapos-show-raw-parameter"),
text_content = g.element.querySelector('textarea[name=text_content]');
if (e === undefined) { if (e === undefined) {
throw new Error("Select not found."); throw new Error("Select not found.");
} }
$(to_hide).addClass("hidden-button"); $(to_hide).addClass("hidden-button");
$(to_show).removeClass("hidden-button"); $(to_show).removeClass("hidden-button");
g.options.value.parameter.softwaretype = e.value; g.options.value.parameter.softwaretype = e.value;
g.options.value.parameter.softwaretypeindex = e.selectedOptions[0]["data-id"]; g.options.value.parameter.softwaretypeindex = e.selectedOptions[0]["data-id"];
g.options.value.parameter.parameter_xml = text_content.value;
g.options.value.parameter.parameter_hash = btoa(text_content.value);
return g.render(g.options) return g.render(g.options)
.push(function () { .push(function () {
return loadEventList(g); return loadEventList(g);
......
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1648851023.11</float> <float>1649100821.17</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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