Commit 339d44af authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: Add select to not display graphic at the same time

With this, we will able to select the graphic we want and display. For now, we have only the select.

The rest is broken :)
parent f5ae3524
......@@ -476,7 +476,9 @@
j,
column_id,
column_title,
not_concatenated_list = [field_json.column_list, (field_json.all_column_list || [])];
not_concatenated_list = [field_json.column_list, (field_json.all_column_list || [])],
option_list = field_json.domain_root_list || [];
// Calculate the list of all displayable columns
for (i = 0; i < not_concatenated_list.length; i += 1) {
for (j = 0; j < not_concatenated_list[i].length; j += 1) {
......@@ -500,10 +502,22 @@
}
}
}
if (displayed_column_item_list.length === 0) {
displayed_column_item_list = field_json.column_list;
}
for (i = 0; i < not_concatenated_list.length; i += 1) {
for (j = 0; j < not_concatenated_list[i].length; j += 1) {
if (not_concatenated_list[i][j][0].indexOf("_state") !== -1) {
option_list.push([
not_concatenated_list[i][j][0],
not_concatenated_list[i][j][1]
]);
}
}
}
return gadget.changeState({
key: field_json.key,
title: field_json.title,
......@@ -530,6 +544,7 @@
list_method: field_json.list_method,
list_method_template: field_json.list_method_template,
option_list: option_list,
domain_list_json: JSON.stringify(field_json.domain_root_list || []),
domain_dict_json: JSON.stringify(field_json.domain_dict || {}),
......@@ -1153,6 +1168,21 @@
loading_element.textContent = '(' + pagination_message + ')';
})
.push(function () {
var sub_element_list = [];
for (i = 0; i < gadget.state.option_list.length; i += 1) {
sub_element_list.push(
domsugar("option", {
"value": gadget.state.option_list[i][0],
"text": gadget.state.option_list[i][1]
})
);
}
gadget.element.insertBefore(
domsugar("select", sub_element_list),
gadget.element.firstChild
);
});
/*.push(function () {
var div = domsugar("div", {"class": "graphic-section"}),
gadget_list = [],
domain_list = JSON.parse(gadget.state.domain_list_json);
......@@ -1176,8 +1206,8 @@
);
}
return RSVP.all(gadget_list);
})
.push(function (gadget_list) {
})*/
/*.push(function (gadget_list) {
var default_param_list = JSON.parse(gadget.state.column_list_json),
domain_dict = JSON.parse(gadget.state.domain_dict_json),
domain_list = [],
......@@ -1246,7 +1276,7 @@
}
return RSVP.all(queue_list);
}
});
});*/
});
}
......@@ -1431,7 +1461,6 @@
return result;
});
}, {mutex: 'changestate'})
.onEvent('click', function click(evt) {
// For some reason, Zelenium can click even if button has the disabled
// attribute. So, it is needed for now to manually checks
......@@ -1494,9 +1523,13 @@
show_clipboard_action: false
});
}
if (evt.target.type === "select-one") {
// XXX Move it to onEvent > "change" probably
return gadget.changeState({"graphic_type": evt.target.value});
}
if ((evt.target.type === 'button') &&
((evt.target.name === 'SelectAction') || (evt.target.name === 'ClipboardAction'))) {
console.log("I am here");
evt.preventDefault();
checked_uid_list = [];
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.20931.24218.2065</string> </value>
<value> <string>994.21450.459.32358</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1629813427.28</float>
<float>1629844472.66</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