Commit ed0c1297 authored by Romain Courteaud's avatar Romain Courteaud

erp5_core: improve activity viewer look

Use the html_viewer gadget
parent 4355b153
Pipeline #20670 failed with stage
in 0 seconds
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
<script src="gadget_activity_watcher.js" type="text/javascript"></script> <script src="gadget_activity_watcher.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div class="activity_watcher_gadget"></div> <div data-gadget-url="gadget_html_viewer.html" data-gadget-scope="html_viewer"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -9,11 +9,23 @@ ...@@ -9,11 +9,23 @@
for (i = 0; i < data[string].line_list.length; i += 1) { for (i = 0; i < data[string].line_list.length; i += 1) {
array.push(domsugar('tr', [ array.push(domsugar('tr', [
domsugar('td', {text: messagetype}), domsugar('td', {text: messagetype}),
domsugar('td', {text: data[string].line_list[i].count}), domsugar('td', {
text: data[string].line_list[i].count,
style: 'text-align: right;'
}),
domsugar('td', {text: data[string].line_list[i].method_id}), domsugar('td', {text: data[string].line_list[i].method_id}),
domsugar('td', {text: data[string].line_list[i].node}), domsugar('td', {
domsugar('td', {text: data[string].line_list[i].min_pri}), text: data[string].line_list[i].node,
domsugar('td', {text: data[string].line_list[i].max_pri}) style: 'text-align: right;'
}),
domsugar('td', {
text: data[string].line_list[i].min_pri,
style: 'text-align: right;'
}),
domsugar('td', {
text: data[string].line_list[i].max_pri,
style: 'text-align: right;'
})
])); ]));
} }
} }
...@@ -25,10 +37,22 @@ ...@@ -25,10 +37,22 @@
for (i = 0; i < data[string].line_list.length; i += 1) { for (i = 0; i < data[string].line_list.length; i += 1) {
array.push(domsugar('tr', [ array.push(domsugar('tr', [
domsugar('td', {text: messagetype}), domsugar('td', {text: messagetype}),
domsugar('td', {text: data[string].line_list[i].pri}), domsugar('td', {
domsugar('td', {text: data[string].line_list[i].min}), text: data[string].line_list[i].pri,
domsugar('td', {text: data[string].line_list[i].avg}), style: 'text-align: right;'
domsugar('td', {text: data[string].line_list[i].max}) }),
domsugar('td', {
text: data[string].line_list[i].min,
style: 'text-align: right;'
}),
domsugar('td', {
text: data[string].line_list[i].avg,
style: 'text-align: right;'
}),
domsugar('td', {
text: data[string].line_list[i].max,
style: 'text-align: right;'
})
])); ]));
} }
} }
...@@ -49,51 +73,55 @@ ...@@ -49,51 +73,55 @@
} }
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return jIO.util.ajax( return RSVP.hash({
{ evt: jIO.util.ajax({
"type": "GET", "type": "GET",
"url": form_gadget.state.read_activity_list_url, "url": form_gadget.state.read_activity_list_url,
"xhrFields": { "xhrFields": {
withCredentials: true withCredentials: true
} }
} }),
); html_viewer: form_gadget.getDeclaredGadget('html_viewer')
});
}) })
.push(function (evt) { .push(function (hash) {
var data = JSON.parse(evt.target.response), var data = JSON.parse(hash.evt.target.response),
tbody1_content_list = [], tbody1_content_list = [],
tbody2_content_list = []; tbody2_content_list = [];
putMessageType(data, 'dict', 'SQLDict', tbody1_content_list); putMessageType(data, 'dict', 'SQLDict', tbody1_content_list);
putMessageType(data, 'queue', 'SQLQueue', tbody1_content_list); putMessageType(data, 'queue', 'SQLQueue', tbody1_content_list);
putMessageType2(data, 'dict', 'SQLDict2', tbody2_content_list); putMessageType2(data, 'dict', 'SQLDict2', tbody2_content_list);
putMessageType2(data, 'queue', 'SQLQueue2', tbody2_content_list); putMessageType2(data, 'queue', 'SQLQueue2', tbody2_content_list);
domsugar(form_gadget.element.querySelector(".activity_watcher_gadget"), [ return hash.html_viewer.render({value: domsugar('div',
'Date : ', {'class': 'page'}, [
new Date().toTimeString(), 'Date : ',
new Date().toTimeString(),
domsugar('table', [ domsugar('table', [
domsugar('thead', [domsugar('tr', [ domsugar('caption', {text: 'Current Activities'}),
domsugar('th', {text: 'Type'}), domsugar('thead', [domsugar('tr', [
domsugar('th', {text: 'Count'}), domsugar('th', {text: 'Type'}),
domsugar('th', {text: 'Method Id'}), domsugar('th', {text: 'Count'}),
domsugar('th', {text: 'Processing Node'}), domsugar('th', {text: 'Method Id'}),
domsugar('th', {text: 'Min pri'}), domsugar('th', {text: 'Processing Node'}),
domsugar('th', {text: 'Max pri'}) domsugar('th', {text: 'Min pri'}),
])]), domsugar('th', {text: 'Max pri'})
domsugar('tbody', tbody1_content_list) ])]),
]), domsugar('tbody', tbody1_content_list)
]),
domsugar('table', [ domsugar('table', [
domsugar('thead', [domsugar('tr', [ domsugar('caption', {text: 'Statistics'}),
domsugar('th', {text: 'Type'}), domsugar('thead', [domsugar('tr', [
domsugar('th', {text: 'Priority'}), domsugar('th', {text: 'Type'}),
domsugar('th', {text: 'Min'}), domsugar('th', {text: 'Priority'}),
domsugar('th', {text: 'Avg'}), domsugar('th', {text: 'Min'}),
domsugar('th', {text: 'Max'}) domsugar('th', {text: 'Avg'}),
])]), domsugar('th', {text: 'Max'})
domsugar('tbody', tbody2_content_list) ])]),
]) domsugar('tbody', tbody2_content_list)
]); ])
]).outerHTML});
}, function (error) { }, function (error) {
//Exception is raised if network is lost for some reasons, //Exception is raised if network is lost for some reasons,
......
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