Commit 38a59f88 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: clean up

parent 8d3c403e
......@@ -1206,11 +1206,26 @@
domain_id,
domain;
for (i = 0; i < column_list_json.length; i += 1) {
if (column_list_json[i][0] === modification_dict.graphic_type) {
group_by = column_list_json[i][0];
group_by_title = column_list_json[i][1];
console.log({
group_by: group_by,
query_by: {},
title: group_by_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"
}
}
});
return graphic_gadget.render({
group_by: group_by,
query_by: {},
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.22782.45811.61201</string> </value>
<value> <string>994.22784.37631.18722</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1629924514.44</float>
<float>1629990890.83</float>
<string>UTC</string>
</tuple>
</state>
......
/*global document, window, Option, rJS, RSVP, console, Array, SimpleQuery, Query,
ComplexQuery, loopEventListener, domsugar */
/*global window, rJS, RSVP, Array, SimpleQuery, Query, ComplexQuery, domsugar */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Array, SimpleQuery, Query, ComplexQuery,
loopEventListener, domsugar) {
domsugar) {
"use strict";
var color_list = ["#CCA08D", "#58ADC4", "#F9B39B", "#B75937",
......@@ -81,7 +80,9 @@
graph_gadget: "unsafe/gadget_field_graph_echarts.html"
},
perfomance_mapping = {
"translated_simulation_state_title": "simulation_state"
"translated_simulation_state_title": [
"simulation_state", "getTranslatedSimulationStateTitle"
]
},
domain_list,
i,
......@@ -97,17 +98,18 @@
group_by = options.group_by;
}
console.log(group_by);
for (i = 0; i < group_by.length; i += 1) {
if (perfomance_mapping.hasOwnProperty(group_by[i])) {
group_by[i] = perfomance_mapping[group_by[i]];
options.layout.x.key = perfomance_mapping[group_by[i]][1];
data.x = options.layout.x.key;
group_by[i] = perfomance_mapping[group_by[i]][0];
}
}
if (Array.isArray(options.group_by)) {
data.y = "count(" + (options.group_by[0] || options.layout.x.key) + ")";
if (Array.isArray(group_by)) {
data.y = "count(" + (group_by[0] || options.layout.x.key) + ")";
} else {
data.y = "count(" + (options.group_by || options.layout.x.key) + ")";
data.y = "count(" + (group_by || options.layout.x.key) + ")";
}
for (i in query_by) {
......@@ -136,10 +138,10 @@
}
}
}
console.log(select_list, [data.y, options.layout.x.key]);
select_list = select_list.concat(
[data.y, options.layout.x.key].filter(function (el) {
return el;
[data.y, options.layout.x.key].filter(function (el, index) {
return select_list.indexOf(el) !== index;
})
);
......@@ -207,37 +209,6 @@
return gadget.changeState(data);
});
})
/*.declareService(function () {
var gadget = this,
restore_filter_input = gadget.element.querySelectorAll("input")[0];
return gadget.getUrlParameter('extended_search')
.push(function (result) {
if (result !== undefined) {
restore_filter_input.disabled = false;
restore_filter_input.classList.remove("ui-disabled");
}
});
})
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
var restore_filter_input = gadget.element.querySelectorAll("input")[0],
one = loopEventListener(restore_filter_input, "click", false, function () {
restore_filter_input.disabled = true;
restore_filter_input.classList.add("ui-disabled");
return gadget.redirect({
command: "change",
options: {
extended_search: undefined,
field_listbox_begin_from: undefined
}
});
}, true);
return one;
});
})*/
.onStateChange(function (modification_dict) {
var i,
gadget = this,
......@@ -249,6 +220,9 @@
element: gadget.element.querySelector(".wrap")
})
];
console.log("query", gadget.state.query);
console.log("query_list", query_list);
if (gadget.state.query) {
queue_list.push(gadget.jio_allDocs(gadget.state.query));
}
......@@ -257,7 +231,6 @@
}
return new RSVP.Queue(RSVP.all(queue_list))
.push(function (result_list) {
console.log(result_list);
var bar_chart = gadget.element.querySelector(".wrap"),
loader = gadget.element.querySelector(".graph-spinner"),
graph_gadget = result_list[0],
......@@ -276,7 +249,6 @@
function avoidFunction(el) {
return el && !el.match(/^\D+\(\w+\)$/);
}
if (gadget.state.query &&
"object" === typeof gadget.state.query &&
gadget.state.query.select_list.filter(avoidFunction).length <= 1) {
......@@ -377,12 +349,10 @@
}
}
if (data_list.length === 0) {
console.log("I am here");
return domsugar(gadget.element, [
domsugar("p", {"text": "No data"})
]);
}
console.log(data_list, data_list.length);
return graph_gadget.render({
value: {
data: data_list,
......@@ -401,5 +371,4 @@
});
});
}(window, rJS, RSVP, Array, SimpleQuery, Query, ComplexQuery,
rJS.loopEventListener, domsugar));
\ No newline at end of file
}(window, rJS, RSVP, Array, SimpleQuery, Query, ComplexQuery, domsugar));
\ No newline at end of file
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.22799.44674.238</string> </value>
<value> <string>994.24186.33564.18483</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1629926042.93</float>
<float>1630008647.86</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