Commit e1a3efb7 authored by Roque's avatar Roque

erp5_web_monitoring: options header gadget (custom header options)

- header links in processes and resources views
- fix jump page and header link
parent 0e5c376c
......@@ -30,8 +30,9 @@
promise_list.push(gadget.getUrlFor({command: "display", options: options}));
if (options.title !== undefined &&
options.search_page !== undefined) {
promise_list.push(gadget.getUrlFor({command: "change", options: {
promise_list.push(gadget.getUrlFor({command: "display", options: {
page: options.search_page,
portal_type: options.portal_type,
extended_search: options.title
}}));
}
......
......@@ -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>963.27666.8050.30907</string> </value>
<value> <string>1016.618.22640.54749</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1510581537.14</float>
<float>1713546953.85</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Monitoring Options Header</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="jiodev.js"></script>
<!-- custom script -->
<script src="gadget_officejs_monitoring_options_header.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("jio_get", "jio_get")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("getOptions", function (portal_type_dict, page_options, header_options) {
var gadget = this;
switch (portal_type_dict.view) {
case "instance_tree":
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(page_options.jio_key);
})
.push(function (instance_tree) {
return gadget.getUrlFor({command: 'store_and_change', options: {
page: "ojsm_jump",
jio_key: instance_tree.opml_url,
title: instance_tree.title,
view_title: "Related OPML",
search_page: "ojs_local_controller",
portal_type: "Promise Module"
}});
})
.push(function (url) {
header_options.jump_url = url;
header_options.save_action = true;
return header_options;
});
case "software_instance":
var promise_list = [];
return new RSVP.Queue()
.push(function () {
promise_list.push({ command: 'change', options: page_options.view_action_dict.view_list.monitoring_resources_view });
promise_list.push({ command: 'change', options: page_options.view_action_dict.view_list.monitoring_processes_view });
promise_list.push({command: 'history_previous'});
return gadget.getUrlForList(promise_list);
})
.push(function (url_list) {
header_options.refresh_action = true;
if (page_options.doc._links !== undefined) {
header_options.resources_url = url_list[0];
header_options.processes_url = url_list[1];
if (header_options.hasOwnProperty('actions_url'))
delete header_options.actions_url;
if (header_options.hasOwnProperty('tab_url'))
delete header_options.tab_url;
}
if (page_options.form_definition.title == "Processes") {
header_options.selection_url = url_list[2];
delete header_options.processes_url;
delete header_options.refresh_action;
delete header_options.previous_url;
delete header_options.next_url;
}
if (page_options.form_definition.title == "Resources") {
header_options.selection_url = url_list[2];
delete header_options.resources_url;
delete header_options.refresh_action;
delete header_options.previous_url;
delete header_options.next_url;
}
return header_options;
});
case "promise":
header_options.refresh_action = true;
return header_options;
default:
return header_options;
}
});
}(document, window, rJS, RSVP));
\ No newline at end of file
......@@ -23,17 +23,16 @@
<script data-renderjs-configuration="erp5_attachment_synchro" type="text/x-renderjs-configuration"></script>
<div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div>
<!-- new router -->
<script data-renderjs-configuration="about_page" type="text/x-renderjs-configuration">xxx</script>
<script data-renderjs-configuration="portal_skin_folder" type="text/x-renderjs-configuration">erp5_web_monitoring</script>
<script data-renderjs-configuration="app_view_reference" type="text/x-renderjs-configuration">monitoring_view</script>
<script data-renderjs-configuration="app_actions" type="text/x-renderjs-configuration">('Software Instance | monitoring_view', 'Software Instance | monitoring_resources_view', 'Software Instance | monitoring_processes_view', 'Software Instance Module | monitoring_view', 'Instance Tree | monitoring_view', 'Instance Tree Module | monitoring_view', 'Promise Module | monitoring_view', 'Promise | monitoring_view')</script>
<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}</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="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}</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}</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>
</body>
</html>
\ No newline at end of file
......@@ -265,7 +265,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1015.45803.6525.35293</string> </value>
<value> <string>1015.64618.55700.30993</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -285,7 +285,7 @@
</tuple>
<state>
<tuple>
<float>1712335243.95</float>
<float>1713455034.07</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