Commit ca12f168 authored by Roque's avatar Roque

erp5_web_monitoring: update app router configuration

- custom submit gadget
- update precache manifest
- update software instance graph
- graph gadget field to software instance view form
parent dd3a84ec
......@@ -29,11 +29,11 @@
<script data-renderjs-configuration="app_allowed_sub_types" type="text/x-renderjs-configuration">('Software Instance Module | Software Instance', 'Instance Tree Module | Instance Tree', 'Software Instance | Promise')</script>
<script data-renderjs-configuration="app_configurator" type="text/x-renderjs-configuration">ojsm_import_export</script>
<script data-renderjs-configuration="software_instance_module_dict" type="text/x-renderjs-configuration">{"front_page": 1, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 1, "panel_action": 1, "previous_next_button": 0, "history_previous_link": 0, "title": "Software Instances Status", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0}</script>
<script data-renderjs-configuration="software_instance_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "title": "Instance: ", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "software_instance" }</script>
<script data-renderjs-configuration="software_instance_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "title": "Instance: ", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "software_instance", "custom_submit": "gadget_officejs_monitoring_submit.html" }</script>
<script data-renderjs-configuration="instance_tree_module_dict" type="text/x-renderjs-configuration">{"front_page": 1, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 1, "panel_action": 1, "previous_next_button": 0, "history_previous_link": 0, "title": "Instance Trees Status", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0}</script>
<script data-renderjs-configuration="instance_tree_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "title": "Instance Tree: ", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "instance_tree" }</script>
<script data-renderjs-configuration="promise_module_dict" type="text/x-renderjs-configuration">{"front_page": 1, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 1, "panel_action": 1, "previous_next_button": 0, "history_previous_link": 0, "title": "Monitoring Promises Status", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0}</script>
<script data-renderjs-configuration="promise_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "title": "Promise: ", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "promise" }</script>
<script data-renderjs-configuration="promise_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "title": "Promise: ", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "promise", "custom_submit": "gadget_officejs_monitoring_submit.html" }</script>
<script data-renderjs-configuration="opml_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "opml" }</script>
</body>
</html>
\ No newline at end of file
......@@ -265,7 +265,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.647.28295.7065</string> </value>
<value> <string>1016.14833.29696.5154</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -285,7 +285,7 @@
</tuple>
<state>
<tuple>
<float>1713548933.12</float>
<float>1714399787.87</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Monitoring Submit</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="jiodev.js"></script>
<!-- custom script -->
<script src="gadget_officejs_monitoring_submit.js"></script>
</head>
<body></body>
</html>
/*global document, window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 10, maxlen: 80 */
(function (document, window, rJS, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("redirect", "redirect")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("handle_submit", function () {
return this.redirect({command: 'reload'});
});
}(document, window, rJS, RSVP));
\ No newline at end of file
......@@ -12,8 +12,93 @@
rJS(window)
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("jio_get", 'jio_get')
.declareMethod('render', function (options) {
var field_json = options || {},
var gadget = this, graph_data, instance = options, opml;
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(instance.parent_id);
})
.push(function (opml_outline) {
return gadget.jio_get(opml_outline.parent_url);
})
.push(function (opml_doc) {
opml = opml_doc;
var graph_options = {
data_url: "",
data_filename: "monitor_state.data",
basic_login: ""
};
if (instance._links !== undefined) {
graph_options = {
data_url: instance._links.private_url.href +
'documents/',
data_filename: instance.data.state,
basic_login: opml.basic_login
};
}
graph_options.extract_method = function (element_dict) {
var promise_data = [
"Date, Success, Error",
new Date() + ",0,0"
],
data = element_dict.data || promise_data,
data_list = [],
line_list,
i;
data_list.push({
value_dict: {"0": [], "1": []},
type: "scatter",
axis_mapping_id_dict: {"1": "1_1"},
title: "promises success"
});
data_list.push({
value_dict: {"0": [], "1": []},
type: "scatter",
axis_mapping_id_dict: {"1": "1_2"},
title: "promises error"
});
for (i = 1; i < data.length; i += 1) {
line_list = data[i].split(',');
data_list[0].value_dict["0"].push(line_list[0]);
data_list[0].value_dict["1"].push(line_list[1]);
// XXX repeating date entry
data_list[1].value_dict["0"].push(line_list[0]);
data_list[1].value_dict["1"].push(line_list[2]);
}
return data_list;
};
graph_options.data_dict = {
data: {},
layout: {
axis_dict : {
"0": {
"title": "Promises Failure Progression",
"scale_type": "linear",
"value_type": "date"
},
"1_1": {
"title": "Promises success",
"position": "right"
},
"1_2": {
"title": "Promises error",
"position": "right"
}
},
title: "Promises Failure Progression"
}
};
return graph_options;
})
.push(function (g) {
graph_data = { value: g };
var field_json = graph_data,
state_dict = {
data_dict: field_json.value.data_dict,
data_url: field_json.value.data_url,
......@@ -21,7 +106,8 @@
extract_method: field_json.value.extract_method,
basic_login: field_json.value.basic_login
};
return this.changeState(state_dict);
return gadget.changeState(state_dict);
});
})
.onStateChange(function () {
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.26990.55688.60364</string> </value>
<value> <string>1016.15098.37978.45994</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1514372119.82</float>
<float>1714415735.15</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -79,6 +79,7 @@
<key> <string>bottom</string> </key>
<value>
<list>
<string>graph</string>
<string>listbox</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="GadgetField" module="Products.ERP5Form.GadgetField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>graph</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>no_validator</string> </key>
<value> <string>Does not support this operation.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>data_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>gadget_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>data_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>gadget_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>data_url</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>gadget_url</string> </key>
<value> <string>gadget_ojsm_graph_field.html</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>graph</string> </value>
</item>
<item>
<key> <string>validator_field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>validator_form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -130,7 +130,9 @@ url_list = [
"gadget_erp5_page_ojsm_parameters_view.html",
"gadget_erp5_page_ojsm_parameters_view.js",
"gadget_officejs_monitoring_options_header.html",
"gadget_officejs_monitoring_options_header.js"
"gadget_officejs_monitoring_options_header.js",
"gadget_officejs_monitoring_submit.html",
"gadget_officejs_monitoring_submit.js"
]
return url_list
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