Commit 4fa3a1b9 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_core] Allow to view the activity watcher in ERP5JS

parent d72c36be
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>action_type/object_report</string> <string>action_type/object_jio_report</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_report</string> </value> <value> <string>object_jio_report</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
</item> </item>
<item> <item>
<key> <string>pt</string> </key> <key> <string>pt</string> </key>
<value> <string>form_view_dialog</string> </value> <value> <string>form_dialog</string> </value>
</item> </item>
<item> <item>
<key> <string>row_length</string> </key> <key> <string>row_length</string> </key>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<list> <list>
<string>editable</string> <string>editable</string>
<string>gadget_url</string> <string>gadget_url</string>
<string>renderjs_extra</string>
<string>title</string> <string>title</string>
</list> </list>
</value> </value>
...@@ -50,6 +51,10 @@ ...@@ -50,6 +51,10 @@
<key> <string>tales</string> </key> <key> <string>tales</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -64,6 +69,16 @@ ...@@ -64,6 +69,16 @@
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -87,6 +102,12 @@ ...@@ -87,6 +102,12 @@
<key> <string>gadget_url</string> </key> <key> <string>gadget_url</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Watcher</string> </value> <value> <string>Watcher</string> </value>
...@@ -110,4 +131,17 @@ ...@@ -110,4 +131,17 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: {\'read_activity_list_url\': here.absolute_url() + \'/ActivityTool_getSqlStatisticList\'}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<script id="getData" type="text/x-handlebars-template"> <script id="getData" type="text/x-handlebars-template">
Date : {{time}} Date : {{time}}
<table> <table>
<thead>
<tr> <tr>
<th>Type</th> <th>Type</th>
<th>Count</th> <th>Count</th>
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
<th>Min pri</th> <th>Min pri</th>
<th>Max pri</th> <th>Max pri</th>
</tr> </tr>
</thead><tbody>
{{#each messageList1}} {{#each messageList1}}
<tr> <tr>
<td>{{this.messagetype}} </td> <td>{{this.messagetype}} </td>
...@@ -36,8 +38,10 @@ ...@@ -36,8 +38,10 @@
<td>{{this.max_pri}}</td> <td>{{this.max_pri}}</td>
</tr> </tr>
{{/each}} {{/each}}
</tbody>
</table> </table>
<table> <table>
<thead>
<tr> <tr>
<th>Type</th> <th>Type</th>
<th>Priority</th> <th>Priority</th>
...@@ -45,6 +49,7 @@ ...@@ -45,6 +49,7 @@
<th>Avg</th> <th>Avg</th>
<th>Max</th> <th>Max</th>
</tr> </tr>
</thead><tbody>
{{#each messagePri1}} {{#each messagePri1}}
<tr> <tr>
<td>{{this.messagetype}} </td> <td>{{this.messagetype}} </td>
...@@ -63,6 +68,7 @@ ...@@ -63,6 +68,7 @@
<td>{{this.max}}</td> <td>{{this.max}}</td>
</tr> </tr>
{{/each}} {{/each}}
</tbody>
</table> </table>
</script> </script>
......
/*global window, rJS, RSVP, Handlebars, jIO, location, console */ /*global window, rJS, RSVP, Handlebars, jIO, console */
/*jslint nomen: true, maxlen:80, indent:2*/ /*jslint nomen: true, maxlen:80, indent:2*/
(function (rJS, jIO, Handlebars, RSVP, window) { (function (rJS, jIO, Handlebars, RSVP, window) {
"use strict"; "use strict";
...@@ -17,15 +17,24 @@ ...@@ -17,15 +17,24 @@
} }
rJS(window) rJS(window)
.declareMethod('render', function (options) {
console.log(options);
return this.changeState(options);
})
.onLoop(function () { .onLoop(function () {
var form_gadget = this, var form_gadget = this;
basedir = location.pathname.split('/').slice(0, -1).join('/') + '/'; if (!form_gadget.state.read_activity_list_url) {
// renderjs has not yet been called
// gadget doesn't know which URL to call
return;
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return jIO.util.ajax( return jIO.util.ajax(
{ {
"type": "POST", "type": "GET",
"url": basedir + 'ActivityTool_getSqlStatisticList', "url": form_gadget.state.read_activity_list_url,
"xhrFields": { "xhrFields": {
withCredentials: true withCredentials: true
} }
...@@ -35,15 +44,13 @@ ...@@ -35,15 +44,13 @@
.push(function (evt) { .push(function (evt) {
var data = JSON.parse(evt.target.response); var data = JSON.parse(evt.target.response);
form_gadget.element.querySelector(".activity_watcher_gadget") form_gadget.element.querySelector(".activity_watcher_gadget")
.innerHTML = get_data_template( .innerHTML = get_data_template({
{
time: new Date().toTimeString(), time: new Date().toTimeString(),
messageList1: putMessageType(data, 'dict', 'SQLDict'), messageList1: putMessageType(data, 'dict', 'SQLDict'),
messageList2: putMessageType(data, 'queue', 'SQLQueue'), messageList2: putMessageType(data, 'queue', 'SQLQueue'),
messagePri1 : putMessageType(data, 'dict', 'SQLDict2'), messagePri1: putMessageType(data, 'dict', 'SQLDict2'),
messagePri2 : putMessageType(data, 'queue', 'SQLQueue2') messagePri2: putMessageType(data, 'queue', 'SQLQueue2')
} });
);
}, 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