Commit eb538f1d authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Fixup collapse/expand of parameters

parent adee783a
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
display: inline-block; display: inline-block;
} }
button.hidden-button { .display-none {
display: none; display: none;
} }
...@@ -68,29 +68,14 @@ margin: 5px 0 10px; max-height: 250px; width: 80%;} ...@@ -68,29 +68,14 @@ margin: 5px 0 10px; max-height: 250px; width: 80%;}
.subfield { .subfield {
padding-left: 20px; padding-left: 20px;
}
label.slapos-parameter-dict-key::before {
content: "Parameter Entry: ";
}
div.slapos-parameter-dict-key {
margin-top: 10px;
margin-left: 6px;
}
.subfield {
padding-top: 3px; padding-top: 3px;
} }
textarea.slapos-parameter { textarea.slapos-parameter {
width: 400px; width: 400px;
height: 100px; height: 100px;
} }
button.hidden-button {
display: none;
}
label.slapos-parameter-dict-key::before { label.slapos-parameter-dict-key::before {
content: "\25BC Parameter Entry: "; content: "\25BC Parameter Entry: ";
} }
......
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>977.18105.11982.10410</string> </value> <value> <string>1004.33923.4937.19370</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -285,7 +285,7 @@ ...@@ -285,7 +285,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1563920275.64</float> <float>1669223474.78</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</div> </div>
<div class="field" title="hide_show_button"> <div class="field" title="hide_show_button">
<div class="input"> <div class="input">
<button type="button" class="slapos-show-form hidden-button"> Show Parameter Form </button> <button type="button" class="slapos-show-form display-none"> Show Parameter Form </button>
<button type="button" class="slapos-show-raw-parameter"> Show Parameter XML</button> <button type="button" class="slapos-show-raw-parameter"> Show Parameter XML</button>
</div> </div>
</div> </div>
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1000.2322.46712.16657</string> </value> <value> <string>1004.26625.54107.30429</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1668785389.46</float> <float>1669223665.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -375,7 +375,8 @@ ...@@ -375,7 +375,8 @@
render_subform({}, render_subform({},
default_dict[key], default_dict[key],
domsugar("div", {"class": "input"}), domsugar("div", {"class": "input"}),
path + "/" + key) path + "/" + key,
editable)
]); ]);
} else { } else {
input = render_field({"type": "string", "textarea": true}, default_dict[key], false); input = render_field({"type": "string", "textarea": true}, default_dict[key], false);
...@@ -485,13 +486,15 @@ ...@@ -485,13 +486,15 @@
} }
function collapseParameter(element) { function collapseParameter(element) {
element.parentNode.querySelector("div").toggle(300); element.parentNode.querySelectorAll("div.subfield").forEach(function (div, i) {
div.classList.toggle("display-none");
});
element.classList.toggle("slapos-parameter-dict-key-colapse"); element.classList.toggle("slapos-parameter-dict-key-colapse");
return element; return element;
} }
function removeSubParameter(element) { function removeSubParameter(element) {
element.parentNone.parentNode.remove(); element.parentNode.parentNode.remove();
return false; return false;
} }
...@@ -511,7 +514,7 @@ ...@@ -511,7 +514,7 @@
text: input_text.value text: input_text.value
})]); })]);
div = render_subform(subform_json, {}, div, element.name + "/" + input_text.value); div = render_subform(subform_json, {}, div, element.name + "/" + input_text.value, gadget.state.editable);
element.parentNode.parentNode.insertBefore(div, element.parentNode.parentNode.children[1]); element.parentNode.parentNode.insertBefore(div, element.parentNode.parentNode.children[1]);
return div; return div;
} }
...@@ -552,8 +555,8 @@ ...@@ -552,8 +555,8 @@
throw new Error("Select not found."); throw new Error("Select not found.");
} }
to_hide.classList.add("hidden-button"); to_hide.classList.add("display-none");
to_show.classList.remove("hidden-button"); to_show.classList.remove("display-none");
return g.changeState({ return g.changeState({
display_step: DISPLAY_JSON_FORM, display_step: DISPLAY_JSON_FORM,
...@@ -567,8 +570,8 @@ ...@@ -567,8 +570,8 @@
var e = g.element.querySelector("button.slapos-show-raw-parameter"), var e = g.element.querySelector("button.slapos-show-raw-parameter"),
to_show = g.element.querySelector("button.slapos-show-form"); to_show = g.element.querySelector("button.slapos-show-form");
e.classList.add("hidden-button"); e.classList.add("display-none");
to_show.classList.remove("hidden-button"); to_show.classList.remove("display-none");
return g.changeState({ return g.changeState({
display_step: DISPLAY_RAW_XML, display_step: DISPLAY_RAW_XML,
...@@ -685,11 +688,11 @@ ...@@ -685,11 +688,11 @@
if (error_text) { if (error_text) {
if (show_raw_button !== null) { if (show_raw_button !== null) {
show_raw_button.classList.add("hidden-button"); show_raw_button.classList.add("display-none");
} }
if (show_form_button !== null) { if (show_form_button !== null) {
show_form_button.classList.remove("hidden-button"); show_form_button.classList.remove("display-none");
} }
div_error = domsugar('div', { div_error = domsugar('div', {
...@@ -753,11 +756,11 @@ ...@@ -753,11 +756,11 @@
} }
if (to_hide !== null) { if (to_hide !== null) {
to_hide.classList.add("hidden-button"); to_hide.classList.add("display-none");
} }
if (to_show !== null) { if (to_show !== null) {
to_show.classList.remove("hidden-button"); to_show.classList.remove("display-none");
} }
return gadget.loadSoftwareJSON(json_url) return gadget.loadSoftwareJSON(json_url)
.push(function (json) { .push(function (json) {
...@@ -961,7 +964,7 @@ ...@@ -961,7 +964,7 @@
for (i = 0; i < div_list.length; i = i + 1) { for (i = 0; i < div_list.length; i = i + 1) {
// This should be replaced by a proper class hidden-div // This should be replaced by a proper class hidden-div
div_list[i].style.display = 'none'; div_list[i].classList.add('display-none');
} }
for (i = 0; i < label_list.length; i = i + 1) { for (i = 0; i < label_list.length; i = i + 1) {
......
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1004.26620.25323.62993</string> </value> <value> <string>1004.33938.61743.7680</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1668786346.24</float> <float>1669224195.85</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