Commit 4e542151 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: trigger gadgets after change select

parent 64fa97d7
...@@ -1168,7 +1168,12 @@ ...@@ -1168,7 +1168,12 @@
loading_element.textContent = '(' + pagination_message + ')'; loading_element.textContent = '(' + pagination_message + ')';
}) })
.push(function () { .push(function () {
var sub_element_list = []; var sub_element_list = [
domsugar("option", {
"value": "",
"text": " ---------- "
})
];
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( sub_element_list.push(
domsugar("option", { domsugar("option", {
...@@ -1182,104 +1187,106 @@ ...@@ -1182,104 +1187,106 @@
gadget.element.firstChild gadget.element.firstChild
); );
}); });
/*.push(function () { });
var div = domsugar("div", {"class": "graphic-section"}), } else if (modification_dict.hasOwnProperty("graphic_type") &&
gadget_list = [], modification_dict.graphic_type !== "") {
domain_list = JSON.parse(gadget.state.domain_list_json); return result_queue
gadget.element.insertBefore(div, gadget.element.firstChild); .push(function () {
gadget_list.push( var div = domsugar("div", {"class": "graphic-section"}),
gadget.declareGadget('gadget_graphic.html', { gadget_list = [],
scope: 'gadget_graphic', domain_list = JSON.parse(gadget.state.domain_list_json);
element: div gadget.element.insertBefore(div, gadget.element.firstChild);
}) gadget_list.push(
); gadget.declareGadget('gadget_graphic.html', {
for (i = 0; i < domain_list.length; i += 1) { scope: 'gadget_graphic',
div = domsugar("div", { element: div
"class": "graphic-section " + domain_list[i][0] })
}); );
gadget.element.insertBefore(div, gadget.element.firstChild); for (i = 0; i < domain_list.length; i += 1) {
gadget_list.push( div = domsugar("div", {
gadget.declareGadget('gadget_graphic.html', { "class": "graphic-section " + domain_list[i][0]
scope: 'gadget_graphic_' + domain_list[i][0], });
element: div gadget.element.insertBefore(div, gadget.element.firstChild);
}) gadget_list.push(
); gadget.declareGadget('gadget_graphic.html', {
} scope: 'gadget_graphic_' + domain_list[i][0],
return RSVP.all(gadget_list); element: div
})*/ })
/*.push(function (gadget_list) { );
var default_param_list = JSON.parse(gadget.state.column_list_json), }
domain_dict = JSON.parse(gadget.state.domain_dict_json), return RSVP.all(gadget_list);
domain_list = [], })
queue_list = [], .push(function (gadget_list) {
group_by, var default_param_list = JSON.parse(gadget.state.column_list_json),
group_by_title, domain_dict = JSON.parse(gadget.state.domain_dict_json),
domain_id, domain_list = [],
domain; queue_list = [],
for (domain_id in domain_dict) { group_by,
if (domain_dict.hasOwnProperty(domain_id)) { group_by_title,
domain = { domain_id,
"domain_id": domain_id, domain;
"domain_list": [], for (domain_id in domain_dict) {
"column_list": [] if (domain_dict.hasOwnProperty(domain_id)) {
}; domain = {
for (i = 0; i < domain_dict[domain_id].length; i += 1) { "domain_id": domain_id,
domain.column_list.push(domain_dict[domain_id][i][0]); "domain_list": [],
domain.domain_list.push(domain_dict[domain_id][i][1]); "column_list": []
} };
domain_list.push(domain); for (i = 0; i < domain_dict[domain_id].length; i += 1) {
} domain.column_list.push(domain_dict[domain_id][i][0]);
domain.domain_list.push(domain_dict[domain_id][i][1]);
} }
for (i = 0; i < default_param_list.length; i += 1) { domain_list.push(domain);
if (default_param_list[i][0].indexOf("_state") !== -1) { }
group_by = default_param_list[i][0]; }
group_by_title = default_param_list[i][1]; for (i = 0; i < default_param_list.length; i += 1) {
if (default_param_list[i][0].indexOf("_state") !== -1) {
group_by = default_param_list[i][0];
group_by_title = default_param_list[i][1];
}
}
if (gadget_list) {
queue_list.push(gadget_list[0].render({
group_by: group_by,
query_by: {},
title: gadget.state.title,
list_method_template: gadget.state.list_method_template,
list_method: gadget.state.list_method,
layout: {
x: {
"title": group_by_title,
"key": group_by
},
y: {
"title": "Quantity"
} }
} }
if (gadget_list) { }));
queue_list.push(gadget_list[0].render({ for (i = 0; i < domain_list.length; i += 1) {
group_by: group_by, queue_list.push(gadget_list[i + 1].render({
query_by: {}, group_by: group_by,
title: gadget.state.title, query_by: {},
list_method_template: gadget.state.list_method_template, title: gadget.state.title,
list_method: gadget.state.list_method, list_method_template: gadget.state.list_method_template,
layout: { list_method: gadget.state.list_method,
x: { layout: {
"title": group_by_title, x: {
"key": group_by "title": group_by_title,
}, "key": group_by,
y: { "domain_id": domain_list[i].domain_id,
"title": "Quantity" "domain_list": domain_list[i].domain_list,
} "column_list": domain_list[i].column_list
},
y: {
"title": "Quantity"
} }
}));
for (i = 0; i < domain_list.length; i += 1) {
queue_list.push(gadget_list[i + 1].render({
group_by: group_by,
query_by: {},
title: gadget.state.title,
list_method_template: gadget.state.list_method_template,
list_method: gadget.state.list_method,
layout: {
x: {
"title": group_by_title,
"key": group_by,
"domain_id": domain_list[i].domain_id,
"domain_list": domain_list[i].domain_list,
"column_list": domain_list[i].column_list
},
y: {
"title": "Quantity"
}
}
}));
} }
return RSVP.all(queue_list); }));
} }
});*/ return RSVP.all(queue_list);
}
}); });
} }
return result_queue; return result_queue;
}) })
...@@ -1523,10 +1530,14 @@ ...@@ -1523,10 +1530,14 @@
show_clipboard_action: false show_clipboard_action: false
}); });
} }
if (evt.target.type === "select-one") { if (evt.target.type === "select-one") {
// XXX Move it to onEvent > "change" probably // XXX Move it to onEvent > "change" probably
return gadget.changeState({"graphic_type": evt.target.value}); return gadget.changeState({
"graphic_type": evt.target.value
});
} }
if ((evt.target.type === 'button') && if ((evt.target.type === 'button') &&
((evt.target.name === 'SelectAction') || (evt.target.name === 'ClipboardAction'))) { ((evt.target.name === 'SelectAction') || (evt.target.name === 'ClipboardAction'))) {
console.log("I am here"); console.log("I am here");
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>994.21450.459.32358</string> </value> <value> <string>994.21596.49508.22784</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>1629844472.66</float> <float>1629853271.24</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