Commit ed0c1297 authored by Romain Courteaud's avatar Romain Courteaud

erp5_core: improve activity viewer look

Use the html_viewer gadget
parent 4355b153
...@@ -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,29 +73,32 @@ ...@@ -49,29 +73,32 @@
} }
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',
{'class': 'page'}, [
'Date : ', 'Date : ',
new Date().toTimeString(), new Date().toTimeString(),
domsugar('table', [ domsugar('table', [
domsugar('caption', {text: 'Current Activities'}),
domsugar('thead', [domsugar('tr', [ domsugar('thead', [domsugar('tr', [
domsugar('th', {text: 'Type'}), domsugar('th', {text: 'Type'}),
domsugar('th', {text: 'Count'}), domsugar('th', {text: 'Count'}),
...@@ -84,6 +111,7 @@ ...@@ -84,6 +111,7 @@
]), ]),
domsugar('table', [ domsugar('table', [
domsugar('caption', {text: 'Statistics'}),
domsugar('thead', [domsugar('tr', [ domsugar('thead', [domsugar('tr', [
domsugar('th', {text: 'Type'}), domsugar('th', {text: 'Type'}),
domsugar('th', {text: 'Priority'}), domsugar('th', {text: 'Priority'}),
...@@ -93,7 +121,7 @@ ...@@ -93,7 +121,7 @@
])]), ])]),
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