Commit b19429a0 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: Improve code to display listbox if there is no option to render graphics

parent ad42cf34
...@@ -598,12 +598,12 @@ ...@@ -598,12 +598,12 @@
i, i,
j, j,
result_queue = new RSVP.Queue(), result_queue = new RSVP.Queue(),
graphic_option_list = [],
button_selector_list = ['button[name="Sort"]', 'button[name="Hide"]', button_selector_list = ['button[name="Sort"]', 'button[name="Hide"]',
'button[name="Clipboard"]', 'button[name="Clipboard"]',
'button[name="Configure"]', 'button[name="Configure"]',
'button[name="SelectRows"]'], 'button[name="SelectRows"]'],
button; button;
/* /*
if (modification_dict.hasOwnProperty('error_text') && this.state.error_text !== undefined) { if (modification_dict.hasOwnProperty('error_text') && this.state.error_text !== undefined) {
// XXX TODO // XXX TODO
...@@ -917,8 +917,7 @@ ...@@ -917,8 +917,7 @@
} }
domsugar(table_element.querySelector('tr'), th_element_list); domsugar(table_element.querySelector('tr'), th_element_list);
if (gadget.state.extended_search || !gadget.state.option_list.length) {
if (gadget.state.extended_search) {
domsugar(container, [ domsugar(container, [
domsugar('div', { domsugar('div', {
"class": 'ui-table-header ui-header' "class": 'ui-table-header ui-header'
...@@ -1180,37 +1179,41 @@ ...@@ -1180,37 +1179,41 @@
}) })
.push(function () { .push(function () {
var loading_element = gadget.element.querySelector(".listboxloader"), var loading_element = gadget.element.querySelector(".listboxloader"),
graphic_option_list = [],
loading_element_classList; loading_element_classList;
if (loading_element) { if (loading_element) {
loading_element_classList = loading_element.classList; loading_element_classList = loading_element.classList;
loading_element_classList.remove.apply(loading_element_classList, loading_class_list); loading_element_classList.remove.apply(loading_element_classList, loading_class_list);
loading_element.textContent = '(' + pagination_message + ')'; loading_element.textContent = '(' + pagination_message + ')';
} }
}) if (gadget.state.option_list.length > 0 &&
.push(function () { gadget.state.enable_graphic &&
var sub_element_list = []; !gadget.state.extended_search) {
for (i = 0; i < gadget.state.option_list.length; i += 1) { for (i = 0; i < gadget.state.option_list.length; i += 1) {
sub_element_list.push( graphic_option_list.push(
domsugar("option", { domsugar("option", {
"value": gadget.state.option_list[i][0], "value": gadget.state.option_list[i][0],
"text": gadget.state.option_list[i][1] "text": gadget.state.option_list[i][1]
}) })
); );
} }
if (!gadget.state.extended_search && gadget.state.enable_graphic) { if (!gadget.state.extended_search &&
gadget.state.enable_graphic) {
domsugar(gadget.element.querySelector(".graphic_section"), [ domsugar(gadget.element.querySelector(".graphic_section"), [
domsugar("select", { domsugar("select", {
"name": "GraphicSelect", "name": "GraphicSelect",
"value": gadget.state.graphic_type "value": gadget.state.graphic_type
}, sub_element_list), }, graphic_option_list),
domsugar("div", {"class": "graphic_area"}) domsugar("div", {"class": "graphic_area"})
]); ]);
} }
}
}); });
}); });
if (!gadget.state.extended_search && if (!gadget.state.extended_search &&
gadget.state.enable_graphic && gadget.state.enable_graphic &&
gadget.state.graphic_type && gadget.state.graphic_type &&
gadget.state.option_list.length > 0 &&
gadget.state.graphic_type !== "") { gadget.state.graphic_type !== "") {
result_queue result_queue
.push(function () { .push(function () {
...@@ -1484,7 +1487,6 @@ ...@@ -1484,7 +1487,6 @@
graphic_select = gadget.element.querySelector( graphic_select = gadget.element.querySelector(
'select[name="GraphicSelect"]' 'select[name="GraphicSelect"]'
); );
if (evt.target == graphic_select) { if (evt.target == graphic_select) {
return gadget.redirect({ return gadget.redirect({
command: 'change', command: 'change',
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>997.28008.46664.51182</string> </value> <value> <string>997.29175.11523.25804</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>1641918364.42</float> <float>1641931639.38</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