Commit e7ea564f authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_monitoring: split hosting and instance view page

create page hosting subscription list and hosting subscription view, software instance list and software instance view pages.
parent 19f6c666
...@@ -145,49 +145,53 @@ gadget_monitoring_application_panel.html\n ...@@ -145,49 +145,53 @@ gadget_monitoring_application_panel.html\n
gadget_monitoring_chart.html\n gadget_monitoring_chart.html\n
gadget_monitoring_document_edit.html\n gadget_monitoring_document_edit.html\n
gadget_monitoring_header.html\n gadget_monitoring_header.html\n
gadget_monitoring_hosting_overview.html\n gadget_monitoring_hosting_subscription_list.html\n
gadget_monitoring_hosting_subscription_view.html\n
gadget_monitoring_import_export.html\n gadget_monitoring_import_export.html\n
gadget_monitoring_jio.html\n gadget_monitoring_jio.html\n
gadget_monitoring_login.html\n gadget_monitoring_login.html\n
gadget_monitoring_login_widget.html\n gadget_monitoring_login_widget.html\n
gadget_monitoring_main.html\n gadget_monitoring_main.html\n
gadget_monitoring_overview.html\n
gadget_monitoring_process_view.html\n gadget_monitoring_process_view.html\n
gadget_monitoring_promise_interface.html\n gadget_monitoring_promise_interface.html\n
gadget_monitoring_resource_view.html\n gadget_monitoring_resource_view.html\n
gadget_monitoring_router.html\n gadget_monitoring_router.html\n
gadget_monitoring_settings_configurator.html\n gadget_monitoring_settings_configurator.html\n
gadget_monitoring_software_instance_list.html\n
gadget_monitoring_software_instance_view.html\n
gadget_monitoring_status_grid.html\n gadget_monitoring_status_grid.html\n
gadget_monitoring_status_list.html\n gadget_monitoring_status_list.html\n
gadget_monitoring_sync.html\n gadget_monitoring_sync.html\n
gadget_monitoring_widget_instance_list.html\n
gadget_monitoring_widget_listbox.html\n gadget_monitoring_widget_listbox.html\n
gadget_monitoring_widget_listview.html\n gadget_monitoring_widget_listview.html\n
gadget_monitoring_widget_overview.html\n
gadget_monitoring_custom.css\n gadget_monitoring_custom.css\n
gadget_monitoring_tooltipster.css\n gadget_monitoring_tooltipster.css\n
gadget_monitoring_application_panel.js\n gadget_monitoring_application_panel.js\n
gadget_monitoring_chart.js\n gadget_monitoring_chart.js\n
gadget_monitoring_document_edit.js\n gadget_monitoring_document_edit.js\n
gadget_monitoring_header.js\n gadget_monitoring_header.js\n
gadget_monitoring_hosting_overview.js\n gadget_monitoring_hosting_subscription_list.js\n
gadget_monitoring_hosting_subscription_view.js\n
gadget_monitoring_import_export.js\n gadget_monitoring_import_export.js\n
gadget_monitoring_jio.js\n gadget_monitoring_jio.js\n
gadget_monitoring_login.js\n gadget_monitoring_login.js\n
gadget_monitoring_login_widget.js\n gadget_monitoring_login_widget.js\n
gadget_monitoring_main.js\n gadget_monitoring_main.js\n
gadget_monitoring_overview.js\n
gadget_monitoring_process_view.js\n gadget_monitoring_process_view.js\n
gadget_monitoring_promise_interface.js\n gadget_monitoring_promise_interface.js\n
gadget_monitoring_resource_view.js\n gadget_monitoring_resource_view.js\n
gadget_monitoring_router.js\n gadget_monitoring_router.js\n
gadget_monitoring_software_instance_list.js\n
gadget_monitoring_software_instance_view.js\n
gadget_monitoring_static.js\n gadget_monitoring_static.js\n
gadget_monitoring_status_grid.js\n gadget_monitoring_status_grid.js\n
gadget_monitoring_status_list.js\n gadget_monitoring_status_list.js\n
gadget_monitoring_sync.js\n gadget_monitoring_sync.js\n
gadget_monitoring_tooltipster.min.js\n gadget_monitoring_tooltipster.min.js\n
gadget_monitoring_widget_instance_list.js\n
gadget_monitoring_widget_listbox.js\n gadget_monitoring_widget_listbox.js\n
gadget_monitoring_widget_listview.js\n gadget_monitoring_widget_listview.js\n
gadget_monitoring_widget_overview.js\n
gadget_translation.js\n gadget_translation.js\n
gadget_translation_data.js\n gadget_translation_data.js\n
erp5_launcher.js\n erp5_launcher.js\n
...@@ -330,7 +334,7 @@ NETWORK:\n ...@@ -330,7 +334,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.21023.22440.29593</string> </value> <value> <string>951.30729.47924.44561</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -348,7 +352,7 @@ NETWORK:\n ...@@ -348,7 +352,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464194710.25</float> <float>1464342540.22</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
<script id="panel-template-body" type="text/x-handlebars-template"> <script id="panel-template-body" type="text/x-handlebars-template">
<div class="ui-content"> <div class="ui-content">
<ul data-role="listview" class="ui-listview"> <ul data-role="listview" class="ui-listview">
<li><a href="#page=hosting_overview"><i class="fa fa-globe"></i><span data-i18n="Hosting Subscriptions">Hosting Subscriptions</span></a></li> <li><a href="#page=status_list"><i class="fa fa-th-list"></i><span data-i18n="Promises Status">Promises Status</span></a></li>
<li><a href="#page=overview"><i class="fa fa-cube"></i><span data-i18n="Software Instances">Software Instances</span></a></li> <li><a href="#page=software_instance_list"><i class="fa fa-cube"></i><span data-i18n="Software Instances">Software Instances</span></a></li>
<li><a href="#page=status_list"><i class="fa fa-th-list"></i><span data-i18n="Promises Overview">Promises Overview</span></a></li> <li><a href="#page=hosting_subscription_list"><i class="fa fa-globe"></i><span data-i18n="Hosting Subscriptions">Hosting Subscriptions</span></a></li>
<li><a href="#page=settings_configurator"><i class="fa fa-cog"></i><span data-i18n="Monitoring Configuration">Monitoring Configuration</span></a></li> <li><a href="#page=settings_configurator"><i class="fa fa-cog"></i><span data-i18n="Monitoring Configuration">Monitoring Configuration</span></a></li>
<li><a href="#page=import_export"><i class="fa fa-exchange"></i><span data-i18n="Import / Export">Import / Export</span></a></li> <li><a href="#page=import_export"><i class="fa fa-exchange"></i><span data-i18n="Import / Export">Import / Export</span></a></li>
</ul> </ul>
......
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.17777.16093.25088</string> </value> <value> <string>951.29615.38155.21196</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464107507.78</float> <float>1464275565.87</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -180,7 +180,7 @@ html .ui-panel-overview table { ...@@ -180,7 +180,7 @@ html .ui-panel-overview table {
} }
html .content-details table tr th, html .content-details table tr td { html .content-details table tr th, html .content-details table tr td {
padding: 5px; padding: 7px;
} }
html .content-details .instances-parameters table tr td { html .content-details .instances-parameters table tr td {
padding: 0 0 0 10px; padding: 0 0 0 10px;
...@@ -468,6 +468,9 @@ html .custom-grid-wrap table thead tr th { ...@@ -468,6 +468,9 @@ html .custom-grid-wrap table thead tr th {
color: #344558; color: #344558;
padding: 8px 0; padding: 8px 0;
} }
.graph-full {
margin: 0 20px;
}
.graph-medium { .graph-medium {
height: 200px; height: 200px;
width: 100%; width: 100%;
...@@ -484,6 +487,10 @@ html .custom-grid-wrap table thead tr th { ...@@ -484,6 +487,10 @@ html .custom-grid-wrap table thead tr th {
font-weight: normal; font-weight: normal;
} }
.hosting-block {
width: 80%;
}
/* INfo Box */ /* INfo Box */
.infobox { .infobox {
display: inline-block; display: inline-block;
...@@ -812,6 +819,9 @@ margin-top: 5px; ...@@ -812,6 +819,9 @@ margin-top: 5px;
/************** Media @ **********************/ /************** Media @ **********************/
@media all and (max-width: 62em) { @media all and (max-width: 62em) {
.m-hidden {
display: none;
}
form.search .ui-block-a { form.search .ui-block-a {
width: 60%; width: 60%;
float: left; float: left;
...@@ -823,6 +833,21 @@ margin-top: 5px; ...@@ -823,6 +833,21 @@ margin-top: 5px;
.ui-panel-overview { .ui-panel-overview {
margin: 15px 0 20px 0; margin: 15px 0 20px 0;
} }
html .ui-content {
padding: .1em;
}
html .jqm-navmenu-panel .ui-content {
padding: 1em;
}
.graph {
margin: 10px 0;
}
.graph-full {
margin: 0 10px;
}
.hosting-block {
width: 100%;
}
html table:not(.ui-responsive) tbody tr td:first-child a, html table:not(ui-responsive) tbody tr th:first-child a { html table:not(.ui-responsive) tbody tr td:first-child a, html table:not(ui-responsive) tbody tr th:first-child a {
position: relative; position: relative;
} }
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.7641.18647.23022</string> </value> <value> <string>951.30698.54042.4164</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464100990.73</float> <float>1464340503.33</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Monitoring Hosting Subscription</title>
<link href="gadget_monitoring_custom.css" rel="stylesheet" type="text/css"/>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script id="template-hostings-list" type="text/x-handlebars-template">
{{#each hosting_list}}
<tr>
<td>
<a class="ui-link" href="{{href}}"><span class="label label-{{status}}">{{status}}</span></a>
</td>
<td>
<a class="ui-link" href="{{href}}">{{title}}</a>
</td>
<td>
<a class="ui-link" href="{{href}}">{{date}}</a>
</td>
</tr>
{{/each}}
</script>
<script src="gadget_monitoring_hosting_subscription_list.js"></script>
</head>
<body>
<div data-gadget-url="gadget_monitoring_jio.html" data-gadget-scope="jio_gadget" data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_monitoring_login_widget.html" data-gadget-scope="login_gadget" data-gadget-sandbox="public"></div>
<!--<div data-gadget-url="gadget_monitoring_document_edit.html" data-gadget-scope="config_gadget" data-gadget-sandbox="public"></div>-->
<div class="ui-grid-a ui-responsive">
<div class="ui-block-a">
<div class="ui-panel-overview" style="min-height: 450px;">
<div class="overview-header">
<div class='content-title ui-instance-title'>
<div class="overview-title">
<i class="fa fa-globe"></i> <span>Hosting Subscriptions</span>
</div>
<div class="commands">
</div>
</div>
</div>
<div class="overview-content">
<div class="ui-listview-container">
<table class="ui-responsive ui-body-c ui-table-inset instance-overview">
<thead class="ui-bar-inherit">
<tr>
<th class="padding-10">Status</th>
<th>Name</th>
<th>Status Date</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="ui-bar-inherit"></tfoot>
</table>
</div>
</div>
</div>
</div>
<div class="ui-block-b" style="position: relative">
</div>
</div>
</body>
</html>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_hosting_overview.html</string> </value> <value> <string>gadget_monitoring_hosting_subscription_list.html</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_monitoring_hosting_overview_html</string> </value> <value> <string>gadget_monitoring_hosting_subscription_list_html</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Monitoring Hosting Subscription Overview</string> </value> <value> <string>Monitoring Hosting Subscription List</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.27801.5339.60876</string> </value> <value> <string>951.29612.46793.45533</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464166945.92</float> <float>1464277179.89</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, Handlebars */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, Handlebars) {
"use strict";
var gadget_klass = rJS(window),
templater = gadget_klass.__template_element,
hosting_widget_template = Handlebars.compile(
templater.getElementById("template-hostings-list").innerHTML
);
function safeGet(gadget, url) {
var document_id = 'monitor.global';
gadget.props.jio_gadget.createJio({
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: url
}
}
});
return gadget.props.jio_gadget.get(document_id)
.push(function (doc) {
return doc;
}, function (error) {
console.log(error);
return undefined;
});
}
function getHostingData(gadget, url_list) {
var promise_list = [],
i;
for (i = 0; i < url_list.length; i += 1) {
gadget.props.jio_gadget.createJio({
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: url_list[i]
}
}
});
promise_list.push(safeGet(gadget, url_list[i]));
}
return RSVP.all(promise_list);
}
gadget_klass
.ready(function (gadget) {
gadget.props = {};
gadget.props.hosting_list = [];
gadget.props.opml_key_list = [];
gadget.props.title = 'Monitoring Hosting Subscriptions';
return gadget.getDeclaredGadget("login_gadget")
.push(function (login_gadget) {
gadget.props.login_gadget = login_gadget;
});
})
.ready(function (gadget) {
return gadget.getElement()
.push(function (element) {
gadget.props.element = element;
gadget.props.render_deferred = RSVP.defer();
});
})
.ready(function (gadget) {
return gadget.getDeclaredGadget("jio_gadget")
.push(function (jio_gadget) {
gadget.props.jio_gadget = jio_gadget;
});
})
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareMethod("render", function (options) {
var gadget = this,
opml_tmp_key_list,
hosting_url_list;
//return gadget.props.jio_gadget.getMonitorUrlList()
gadget.props.options = options;
return gadget.updateHeader({
title: gadget.props.title
})
.push(function () {
return gadget.getSetting('monitor_url_description');
})
.push(function (url_description_dict) {
var key,
promise_list = [];
gadget.props.opml_dict = url_description_dict;
opml_tmp_key_list = [];
for (key in url_description_dict) {
opml_tmp_key_list.push(key);
promise_list.push(gadget.props.jio_gadget.getMonitorUrlList(undefined,
url_description_dict[key].title));
}
return RSVP.all(promise_list);
})
.push(function (url_list) {
var i,
j,
promise_list = [];
for (i = 0; i < url_list.length; i += 1) {
if (url_list[i]) {
promise_list.push(getHostingData(gadget, url_list[i]));
} else {
//This Feed is not available, remove from key_list
opml_tmp_key_list[i] = undefined;
}
}
return RSVP.all(promise_list);
})
.push(function (document_list) {
var i,
status,
hosting_dict,
hosting_title,
date,
content,
j;
for (i = 0; i < opml_tmp_key_list.length; i += 1) {
if (opml_tmp_key_list[i] !== undefined) {
gadget.props.opml_key_list.push(opml_tmp_key_list[i]);
}
}
for (i = 0; i < document_list.length; i += 1) {
hosting_dict = {};
status = 'OK';
hosting_dict.instance_list = [];
date = '';
for (j = 0; j < document_list[i].length; j += 1) {
if (document_list[i][j] === undefined) {
continue;
}
hosting_dict.instance_list.push({
title: document_list[i][j].title,
status: document_list[i][j].status,
url: document_list[i][j]._links.monitor.href
});
if (document_list[i][j].status === 'ERROR') {
if (status !== 'ERROR') {
status = 'ERROR';
date = document_list[i][j].date || '';
hosting_title = document_list[i][j]['hosting-title'] || '';
}
} else if (document_list[i][j].status === 'WARNING') {
if (status !== 'ERROR' && status !== 'WARNING') {
status = 'WARNING';
date = document_list[i][j].date || '';
hosting_title = document_list[i][j]['hosting-title'] || '';
}
} else if (date === '') {
date = document_list[i][j].date || '';
hosting_title = document_list[i][j]['hosting-title'] || '';
}
}
hosting_dict.status = status;
hosting_dict.title = hosting_title;
hosting_dict.date = date;
hosting_dict.href = "#page=hosting_subscription_view&key=" +
gadget.props.opml_key_list[i];
gadget.props.hosting_list.push(hosting_dict);
}
content = hosting_widget_template({
hosting_list: gadget.props.hosting_list
});
gadget.props.element.querySelector('.ui-block-a table tbody')
.innerHTML = content;
return gadget.props.render_deferred.resolve();
});
})
.declareService(function () {
var gadget = this;
});
}(window, rJS, Handlebars));
\ No newline at end of file
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_hosting_overview.js</string> </value> <value> <string>gadget_monitoring_hosting_subscription_list.js</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_monitoring_hosting_overview_js</string> </value> <value> <string>gadget_monitoring_hosting_subscription_list_js</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Monitoring Hosting Subscription Overview Js</string> </value> <value> <string>Monitoring Hosting Subscription list Js</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.17701.12410.54528</string> </value> <value> <string>951.29657.60907.41591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464106260.69</float> <float>1464281193.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,29 +4,13 @@ ...@@ -4,29 +4,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Monitoring Hosting Subscription</title> <title>Monitoring Hosting Subscription View</title>
<link href="gadget_monitoring_custom.css" rel="stylesheet" type="text/css"/> <link href="gadget_monitoring_custom.css" rel="stylesheet" type="text/css"/>
<script src="rsvp.js"></script> <script src="rsvp.js"></script>
<script src="renderjs.js"></script> <script src="renderjs.js"></script>
<script id="template-hostings-list" type="text/x-handlebars-template">
{{#each hosting_list}}
<tr rel={{index}}>
<td>
<a class="ui-link" href="#{{status}}"><span class="label label-{{status}}">{{status}}</span></a>
</td>
<td>
<a class="ui-link" href="">{{title}}</a>
</td>
<td>
<a class="ui-link" href="">{{date}}</a>
</td>
</tr>
{{/each}}
</script>
<script id="instance-details-widget-overview" type="text/x-handlebars-template"> <script id="instance-details-widget-overview" type="text/x-handlebars-template">
{{#if status_list_url}} {{#if status_list_url}}
<!--<div data-role="controlgroup"> <!--<div data-role="controlgroup">
...@@ -132,74 +116,35 @@ ...@@ -132,74 +116,35 @@
{{/if}} {{/if}}
</script> </script>
<script src="gadget_monitoring_hosting_overview.js"></script> <script src="gadget_monitoring_hosting_subscription_view.js"></script>
</head> </head>
<body> <body>
<div data-gadget-url="gadget_monitoring_jio.html" data-gadget-scope="jio_gadget" data-gadget-sandbox="public"></div> <div data-gadget-url="gadget_monitoring_jio.html" data-gadget-scope="jio_gadget" data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_monitoring_login_widget.html" data-gadget-scope="login_gadget" data-gadget-sandbox="public"></div> <div data-gadget-url="gadget_monitoring_login_widget.html" data-gadget-scope="login_gadget" data-gadget-sandbox="public"></div>
<!--<div data-gadget-url="gadget_monitoring_document_edit.html" data-gadget-scope="config_gadget" data-gadget-sandbox="public"></div>--> <div class="ui-responsive hosting-block">
<div class="ui-grid-a ui-responsive"> <div class="signal ui-content-hidden"></div>
<div class="ui-block-a"> <div class="ui-panel-overview">
<div class="overview-header">
<div class="ui-panel-overview" style="min-height: 450px;"> <div class='content-title ui-instance-title'>
<div class="overview-header"> <div class="overview-title">
<div class='content-title ui-instance-title'> <i class="fa fa-share-alt"></i> <span></span>
<div class="overview-title">
<i class="fa fa-globe"></i> <span>Hosting Subscriptions</span>
</div>
<div class="commands">
</div>
</div> </div>
</div> <div class="commands">
<div class="overview-content">
<div class="ui-listview-container">
<table class="ui-responsive ui-body-c ui-table-inset instance-overview">
<thead class="ui-bar-inherit">
<tr>
<th class="padding-10">Status</th>
<th>Name</th>
<th>Status Date</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="ui-bar-inherit"></tfoot>
</table>
</div> </div>
</div> </div>
</div> </div>
<div class="content-details">
</div> <h2><i class="fa fa-wrench"></i> <strong>Software Instances Parameters</strong></h2>
<div class="ui-block-b" style="position: relative"> <div style="overflow: auto;" class="padding-lr-10 instances-parameters">
<div class="signal ui-content-hidden"></div>
<div class="ui-panel-overview ui-content-hidden">
<div class="overview-header">
<div class='content-title ui-instance-title'>
<div class="overview-title">
<i class="fa fa-share-alt"></i> <span></span>
</div>
<div class="commands">
</div>
</div>
</div> </div>
<div class="content-details"> <div class="padding-5"></div>
<h2><i class="fa fa-wrench"></i> <strong>Instances Parameters</strong></h2> <h2><i class="fa fa-cubes"></i> <strong>Software Instances Status</strong></h2>
<div style="overflow: auto;" class="padding-lr-10 instances-parameters"> <div class="instances-status">
</div>
<div class="padding-5"></div>
<h2><i class="fa fa-cubes"></i> <strong>Instances Status</strong></h2>
<div class="instances-status">
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>classification/collaborative/public</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_hosting_subscription_view.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_monitoring_hosting_subscription_view_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Monitoring Hosting Subscription View</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464275301.8</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.30694.32099.54323</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464340229.53</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464275180.09</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
var gadget_klass = rJS(window), var gadget_klass = rJS(window),
templater = gadget_klass.__template_element, templater = gadget_klass.__template_element,
hosting_widget_template = Handlebars.compile(
templater.getElementById("template-hostings-list").innerHTML
),
parameters_widget_template = Handlebars.compile( parameters_widget_template = Handlebars.compile(
templater.getElementById("parameters-widget-template").innerHTML templater.getElementById("parameters-widget-template").innerHTML
), ),
...@@ -16,29 +13,14 @@ ...@@ -16,29 +13,14 @@
templater.getElementById("instance-details-widget-overview").innerHTML templater.getElementById("instance-details-widget-overview").innerHTML
); );
function keysrt(key,desc) {
return function(a,b){
return desc ? ~~(a[key] < b[key]) : ~~(a[key] > b[key]);
};
}
function safeGet(gadget, url) { function safeGet(gadget, url) {
var document_id = 'monitor.global'; var document_id = 'monitor.global';
gadget.props.jio_gadget.createJio({
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: url
}
}
});
return gadget.props.jio_gadget.get(document_id) return gadget.props.jio_gadget.get(document_id)
.push(function (doc) { .push(function (doc) {
return doc; return doc;
}, function (error) { }, function (error) {
console.log(error); console.log(error);
gadget.props.error_list.push(url);
return undefined; return undefined;
}); });
} }
...@@ -53,7 +35,7 @@ ...@@ -53,7 +35,7 @@
type: "drivetojiomapping", type: "drivetojiomapping",
sub_storage: { sub_storage: {
type: "dav", type: "dav",
url: url_list[i] url: url_list[i].replace('public', 'private') // Hard path to change!!
} }
} }
}); });
...@@ -62,12 +44,53 @@ ...@@ -62,12 +44,53 @@
return RSVP.all(promise_list); return RSVP.all(promise_list);
} }
function getMonitorCredentials(gadget, monitor, hosting_title, index) {
return gadget.props.login_gadget.loginRedirect(
monitor.url,
{
page: 'hosting_overview',
select: index
},
monitor.title,
hosting_title
);
}
function getInstanceDict(monitor_dict) {
var instance_dict,
tmp_url,
tmp_process_url;
// Resource view URLs
tmp_url = "#page=resource_view&title=" + monitor_dict.title +
"&root=" + monitor_dict['hosting-title'] +
"&jio_for=" + monitor_dict._links.private_url.href;
tmp_process_url = "#page=process_view&title=" + monitor_dict.title +
"&root=" + monitor_dict['hosting-title'] +
"&jio_for=" + monitor_dict._links.private_url.href;
instance_dict = {
title: monitor_dict.title,
root_title: monitor_dict['hosting-title'],
date: monitor_dict.date,
status: monitor_dict.status,
instance: monitor_dict._embedded.instance || '',
public_url: monitor_dict._links.hasOwnProperty('public_url') ? monitor_dict._links.public_url.href : '',
private_url: monitor_dict._links.hasOwnProperty('private_url') ? monitor_dict._links.private_url.href : '',
rss_url: monitor_dict._links.hasOwnProperty('rss_url') ? monitor_dict._links.rss_url.href : '',
resource_url: tmp_url,
process_url: tmp_process_url
};
return instance_dict;
}
gadget_klass gadget_klass
.ready(function (gadget) { .ready(function (gadget) {
gadget.props = {}; gadget.props = {};
gadget.props.hosting_list = []; gadget.props.hosting_list = [];
gadget.props.opml_key_list = []; gadget.props.opml_key_list = [];
gadget.props.title = 'Monitoring Hosting Subscriptions'; gadget.props.title = 'Hosting Subscriptions View';
return gadget.getDeclaredGadget("login_gadget") return gadget.getDeclaredGadget("login_gadget")
.push(function (login_gadget) { .push(function (login_gadget) {
gadget.props.login_gadget = login_gadget; gadget.props.login_gadget = login_gadget;
...@@ -109,93 +132,65 @@ ...@@ -109,93 +132,65 @@
return gadget.getSetting('monitor_url_description'); return gadget.getSetting('monitor_url_description');
}) })
.push(function (url_description_dict) { .push(function (url_description_dict) {
var key, if (url_description_dict.hasOwnProperty(options.key)) {
promise_list = []; gadget.props.hosting = url_description_dict[options.key];
gadget.props.opml_dict = url_description_dict; return gadget.props.jio_gadget.getMonitorUrlList(undefined,
opml_tmp_key_list = []; url_description_dict[options.key].title);
for (key in url_description_dict) { } else {
opml_tmp_key_list.push(key); return redirect({
promise_list.push(gadget.props.jio_gadget.getMonitorUrlList(undefined, page: 'notfound',
url_description_dict[key].title)); reference: options.key
});
} }
return RSVP.all(promise_list);
}) })
.push(function (url_list) { .push(function (url_list) {
var i, return getHostingData(gadget, url_list);
j,
promise_list = [];
for (i = 0; i < url_list.length; i += 1) {
if (url_list[i]) {
promise_list.push(getHostingData(gadget, url_list[i]));
} else {
//This Feed is not available, remove from key_list
opml_tmp_key_list[i] = undefined;
}
}
return RSVP.all(promise_list);
}) })
.push(function (document_list) { .push(function (document_list) {
var i, var parameter_content,
status, instance_list = [],
hosting_dict, parameter_list = [],
hosting_title, status_url = '',
date, i,
content, instance_content;
j;
gadget.props.document_list = document_list;
gadget.props.element.querySelector('.hosting-block .overview-title span')
.innerHTML = gadget.props.hosting.title; // + '<span class="label label-{{status}}">{{status}}</span>';
for (i = 0; i < document_list.length; i += 1) { for (i = 0; i < document_list.length; i += 1) {
hosting_dict = {}; instance_list.push(
status = 'OK'; getInstanceDict(document_list[i])
hosting_dict.instance_list = []; );
date = ''; if (document_list[i].hasOwnProperty('parameters')) {
for (j = 0; j < document_list[i].length; j += 1) { parameter_list.push({
if (document_list[i][j] === undefined) { title: document_list[i].title,
continue; parameters: document_list[i].parameters,
} base_url: document_list[i]._links.hasOwnProperty('private_url') ? document_list[i]._links.private_url.href : '',
hosting_dict.instance_list.push({ index: i
title: document_list[i][j].title,
status: document_list[i][j].status,
url: document_list[i][j]._links.monitor.href
}); });
if (document_list[i][j].status === 'ERROR') {
if (status !== 'ERROR') {
status = 'ERROR';
date = document_list[i][j].date || '';
hosting_title = document_list[i][j]['hosting-title'] || '';
}
} else if (document_list[i][j].status === 'WARNING') {
if (status !== 'ERROR' && status !== 'WARNING') {
status = 'WARNING';
date = document_list[i][j].date || '';
hosting_title = document_list[i][j]['hosting-title'] || '';
}
} else if (date === '') {
date = document_list[i][j].date || '';
hosting_title = document_list[i][j]['hosting-title'] || '';
}
} }
hosting_dict.status = status;
hosting_dict.title = hosting_title;
hosting_dict.date = date;
hosting_dict.index = i;
gadget.props.hosting_list.push(hosting_dict);
} }
for (i = 0; i < opml_tmp_key_list.length; i += 1) { status_url = "#page=status_list&search=" + gadget.props.hosting.title
if (opml_tmp_key_list[i] !== undefined) { + "&reset_filter=1";
gadget.props.opml_key_list.push(opml_tmp_key_list[i]); parameter_content = parameters_widget_template({parameter_list: parameter_list});
} instance_content = instance_widget_template({
} instance_list: instance_list,
content = hosting_widget_template({ status_list_url: status_url
hosting_list: gadget.props.hosting_list
}); });
gadget.props.element.querySelector('.ui-block-a table tbody')
.innerHTML = content;
gadget.props.element.querySelector('.hosting-block .instances-parameters')
.innerHTML = parameter_content;
gadget.props.element.querySelector('.hosting-block .instances-status')
.innerHTML = instance_content;
return gadget.props.render_deferred.resolve(); return gadget.props.render_deferred.resolve();
})
.push(function () {
$(".hosting-block .signal").addClass("ui-content-hidden");
return $(gadget.props.element.querySelectorAll('.hosting-block .ui-listview-outer')).listview().listview("refresh");
}); });
}) })
.declareService(function () { .declareService(function () {
var gadget = this; var gadget = this;
...@@ -219,7 +214,7 @@ ...@@ -219,7 +214,7 @@
var element = gadget.props.element.querySelector('table[title="' + title + '"]'), var element = gadget.props.element.querySelector('table[title="' + title + '"]'),
tmp, tmp,
i; i;
if (!element) { if (!element) {
return; return;
} }
...@@ -234,7 +229,7 @@ ...@@ -234,7 +229,7 @@
function editMonitorProps (element) { function editMonitorProps (element) {
var index = parseInt($(element).attr('rel'), 10), var index = parseInt($(element).attr('rel'), 10),
promise_list = []; promise_list = [];
if (isNaN(index) || gadget.props.document_list.length < index) { if (isNaN(index) || gadget.props.document_list.length < index) {
return; return;
} }
...@@ -271,7 +266,7 @@ ...@@ -271,7 +266,7 @@
i, i,
monitor_user = '', monitor_user = '',
monitor_password = ''; monitor_password = '';
// Try to save monitor credential if they are pres // Try to save monitor credential if they are pres
for (i = 0; i < data.length; i += 1) { for (i = 0; i < data.length; i += 1) {
if (data[i].key === 'monitor-password') { if (data[i].key === 'monitor-password') {
...@@ -297,18 +292,6 @@ ...@@ -297,18 +292,6 @@
}); });
} }
function getMonitorCredentials(monitor, hosting_title, index) {
return gadget.props.login_gadget.loginRedirect(
monitor.url,
{
page: 'hosting_overview',
select: index
},
monitor.title,
hosting_title
);
}
function getMonitorDocument(url, auth_login) { function getMonitorDocument(url, auth_login) {
var jio_options = { var jio_options = {
type: "query", type: "query",
...@@ -329,168 +312,29 @@ ...@@ -329,168 +312,29 @@
return gadget.props.jio_gadget.get(document_id); return gadget.props.jio_gadget.get(document_id);
} }
function getInstanceDict(monitor_dict) {
var instance_dict,
tmp_url,
tmp_process_url;
// Resource view URLs
tmp_url = "#page=resource_view&title=" + monitor_dict.title +
"&root=" + monitor_dict['hosting-title'] +
"&jio_for=" + monitor_dict._links.private_url.href;
tmp_process_url = "#page=process_view&title=" + monitor_dict.title +
"&root=" + monitor_dict['hosting-title'] +
"&jio_for=" + monitor_dict._links.private_url.href;
instance_dict = {
title: monitor_dict.title,
root_title: monitor_dict['hosting-title'],
date: monitor_dict.date,
status: monitor_dict.status,
instance: monitor_dict._embedded.instance || '',
public_url: monitor_dict._links.hasOwnProperty('public_url') ? monitor_dict._links.public_url.href : '',
private_url: monitor_dict._links.hasOwnProperty('private_url') ? monitor_dict._links.private_url.href : '',
rss_url: monitor_dict._links.hasOwnProperty('rss_url') ? monitor_dict._links.rss_url.href : '',
resource_url: tmp_url,
process_url: tmp_process_url
};
return instance_dict;
}
function showHostingConfiguration(element) {
var index = parseInt($(element).attr('rel'), 10);
if (isNaN(index) || gadget.props.hosting_list.length < index) {
return;
}
return new RSVP.Queue()
.push(function () {
return $(gadget.props.element.querySelectorAll('.ui-block-b .ui-listview-container li > a')).unbind( "click" );
})
.push(function () {
return $(gadget.props.element.querySelectorAll('.ui-block-b .line-edit')).unbind( "click" );
})
.push(function () {
var old_element = $(gadget.props.element.querySelector('.ui-listview-container table td > a.selected'));
if (old_element) {
old_element.removeClass('selected');
}
$(".ui-block-b .signal").removeClass("ui-content-hidden");
return $(element.querySelector('td:first-child > a')).addClass('selected');
})
/*.push(function () {
var i,
cred_promise_list = [];
for (i = 0; i < gadget.props.hosting_list[index].instance_list.length; i += 1) {
cred_promise_list.push(
getMonitorCredentials(gadget.props.hosting_list[index].instance_list[i],
gadget.props.hosting_list[index].title,
index
));
}
return RSVP.all(cred_promise_list);
})*/
.push(function () {
var i,
promise_list = [];
for (i = 0; i < gadget.props.hosting_list[index].instance_list.length; i += 1) {
promise_list.push(getMonitorDocument(
gadget.props.hosting_list[index].instance_list[i].url
//cred_list[i].hash
));
}
return RSVP.all(promise_list);
})
.push(function (document_list) {
var parameter_content,
instance_list = [],
parameter_list = [],
status_url = '',
i,
instance_content,
content_panel = $(gadget.props.element.querySelector('.ui-block-b .ui-panel-overview'));
if (content_panel.hasClass('ui-content-hidden')) {
content_panel.removeClass('ui-content-hidden');
}
gadget.props.document_list = document_list;
gadget.props.element.querySelector('.ui-block-b .overview-title span')
.innerHTML = gadget.props.hosting_list[index].title; // + '<span class="label label-{{status}}">{{status}}</span>';
for (i = 0; i < document_list.length; i += 1) {
instance_list.push(
getInstanceDict(document_list[i])
);
if (document_list[i].hasOwnProperty('parameters')) {
parameter_list.push({
title: document_list[i].title,
parameters: document_list[i].parameters,
base_url: document_list[i]._links.hasOwnProperty('private_url') ? document_list[i]._links.private_url.href : '',
index: i
});
}
}
if (gadget.props.opml_dict[gadget.props.opml_key_list[index]] !== undefined) {
status_url = "#page=status_list&search=" + gadget.props.opml_dict[gadget.props.opml_key_list[index]].title;
}
parameter_content = parameters_widget_template({parameter_list: parameter_list});
instance_content = instance_widget_template({
instance_list: instance_list,
status_list_url: status_url
});
gadget.props.element.querySelector('.ui-block-b .instances-parameters')
.innerHTML = parameter_content;
gadget.props.element.querySelector('.ui-block-b .instances-status')
.innerHTML = instance_content;
return '';
})
.push(function () {
$(".ui-block-b .signal").addClass("ui-content-hidden");
return $(gadget.props.element.querySelectorAll('.ui-block-b .ui-listview-outer')).listview().listview("refresh");
})
.push(function () {
var promise_list = [],
element_list = gadget.props.element.querySelectorAll('.ui-block-b .ui-listview-container li > a'),
edit_list = gadget.props.element.querySelectorAll('.ui-block-b .line-edit'),
i;
for (i = 0; i < element_list.length; i += 1) {
promise_list.push(loopEventListener(
element_list[i],
'click',
false,
bindOnClick.bind(gadget, element_list[i])
));
}
for (i = 0; i < edit_list.length; i += 1) {
promise_list.push(loopEventListener(
edit_list[i],
'click',
false,
editMonitorProps.bind(gadget, edit_list[i])
));
}
return RSVP.all(promise_list);
});
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.props.render_deferred.promise; return gadget.props.render_deferred.promise;
}) })
.push(function () { .push(function () {
var promise_list = [], var promise_list = [],
element_list = gadget.props.element.querySelectorAll('.ui-listview-container table tr'), element_list = gadget.props.element.querySelectorAll('.hosting-block .ui-listview-container li > a'),
edit_list = gadget.props.element.querySelectorAll('.hosting-block .line-edit'),
i; i;
for (i = 0; i < element_list.length; i += 1) { for (i = 0; i < element_list.length; i += 1) {
promise_list.push(loopEventListener( promise_list.push(loopEventListener(
element_list[i], element_list[i],
'click', 'click',
false, false,
showHostingConfiguration.bind(gadget, element_list[i]) bindOnClick.bind(gadget, element_list[i])
));
}
for (i = 0; i < edit_list.length; i += 1) {
promise_list.push(loopEventListener(
edit_list[i],
'click',
false,
editMonitorProps.bind(gadget, edit_list[i])
)); ));
} }
return RSVP.all(promise_list); return RSVP.all(promise_list);
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>classification/collaborative/public</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_hosting_subscription_view.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_monitoring_hosting_subscription_view_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Monitoring Hosting Subscription View Js</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464275223.91</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.30703.26577.30839</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464341533.1</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464275183.55</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -4,18 +4,18 @@ ...@@ -4,18 +4,18 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Monitoring Status Interface</title> <title>Monitoring Software Instance List</title>
<link href="gadget_monitoring_custom.css" rel="stylesheet" type="text/css"/> <link href="gadget_monitoring_custom.css" rel="stylesheet" type="text/css"/>
<script src="rsvp.js"></script> <script src="rsvp.js"></script>
<script src="renderjs.js"></script> <script src="renderjs.js"></script>
<script src="gadget_monitoring_overview.js"></script> <script src="gadget_monitoring_software_instance_list.js"></script>
</head> </head>
<body> <body>
<div data-gadget-url="gadget_monitoring_widget_overview.html" data-gadget-scope="listview"></div> <div data-gadget-url="gadget_monitoring_widget_instance_list.html" data-gadget-scope="listview"></div>
</body> </body>
</html> </html>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_overview.html</string> </value> <value> <string>gadget_monitoring_software_instance_list.html</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_monitoring_overview_html</string> </value> <value> <string>gadget_monitoring_software_instance_list_html</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Monitoring Overview Interface</string> </value> <value> <string>Monitoring Software Instance List</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>948.50296.46997.62737</string> </value> <value> <string>951.29252.10342.1587</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1453979456.82</float> <float>1464253720.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
"title": 'Software Instances List' "title": 'Software Instances List'
}, },
listview_options = { listview_options = {
search_page: 'overview', search_page: 'software_instance_list',
search: options.search, search: options.search,
filter: options.filter,
selection: '', selection: '',
column: { column: {
select: 'title', select: 'title',
...@@ -40,7 +41,8 @@ ...@@ -40,7 +41,8 @@
{select: 'hosting-title', title: 'Date'} {select: 'hosting-title', title: 'Date'}
], ],
query: { query: {
select_list: ['title', 'status', 'date', '_links', 'state', 'hosting-title'], select_list: ['title', 'status', 'date', '_links', 'state',
'hosting-title'],
//query: '_id:"monitor.global"', //query: '_id:"monitor.global"',
sort_on: [["status", "ascending"]] sort_on: [["status", "ascending"]]
} }
...@@ -48,23 +50,9 @@ ...@@ -48,23 +50,9 @@
return gadget.updateHeader(header) return gadget.updateHeader(header)
.push(function () { .push(function () {
var filter_part_list = [],
j;
/*if (options.sort_on && options.sort_on !== 'status') {
listview_options.query.sort_on = [[options.sort_on, 'ascending']];
}*/
if (options.status && options.status !== '') {
for (j = 0; j < options.status.split('+').length; j += 1) {
filter_part_list.push('(status:"' + options.status.split('+')[j].toUpperCase() + '")');
}
listview_options.query.query += ' AND (' + filter_part_list.join(' OR ') + ')';
}
return gadget.property_dict.listview.render(listview_options); return gadget.property_dict.listview.render(listview_options);
}); });
}) })
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("updateHeader", "updateHeader"); .declareAcquiredMethod("updateHeader", "updateHeader");
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_overview.js</string> </value> <value> <string>gadget_monitoring_software_instance_list.js</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_monitoring_overview_js</string> </value> <value> <string>gadget_monitoring_software_instance_list_js</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Monitoring Overview Gadget JS</string> </value> <value> <string>Monitoring Instance List Gadget JS</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.9445.6535.55671</string> </value> <value> <string>951.29297.41836.68</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464107170.21</float> <float>1464256864.93</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Monitoring Software Instance</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js"></script>
<script id="details-widget-overview" type="text/x-handlebars-template">
<div class="overview-header">
<div class='content-title ui-instance-title'>
<div class="overview-title">
<i class="fa fa-cubes"></i><span>
{{root_title}} >&nbsp;
{{title}}
</span>
</div>
<div class="commands">
</div>
</div>
</div>
<div class="content-details">
<div class="ui-text-left" style="padding-bottom: 15px;">
<h2><i class="fa fa-info-circle"></i> <strong>Software Instance State Information</strong></h2>
<div class="padding-10">
<div class="ui-grid-a ui-responsive">
<div class="ui-block-a">
<fieldset data-role="controlgroup" data-type="horizontal">
{{#if resource_url }}
<a href="{{resource_url}}" class="ui-btn ui-corner-all ui-btn-inline ui-mini" title="Software Instance Resource comsumption"><i class="fa fa-pie-chart"></i> Resources</a>
{{/if}}
{{#if process_url }}
<a href="{{process_url}}" class="ui-btn ui-corner-all ui-btn-inline ui-mini" title="Processes usage"><i class="fa fa-list-alt"></i> Processes</a>
{{/if}}
</fieldset>
</div>
<div class="ui-block-b">
<fieldset data-role="controlgroup" data-type="horizontal">
{{#if public_url}}
<!--<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" target='_blank' href="{{public_url}}" title="Public"><i class="fa fa-folder-open-o"></i> Public</a>-->
{{/if}}
{{#if private_url}}
<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" target='_blank' href="{{private_url}}" title="Browse Private Directory"><i class="fa fa-lock"></i> Private Folder</a>
{{/if}}
{{#if rss_url}}
<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" target='_blank' href="{{rss_url}}" title="RSS"><i class="fa fa-rss-square"></i> RSS</a>
{{/if}}
</fieldset>
</div>
</div>
<div class="ui-grid-a ui-responsive">
{{#with instance}}
<div class="ui-block-a">
<table data-role="table" data-mode="columntoggle" class="table-stroke">
<tr>
<th><i class="fa fa-desktop m-hidden"></i> <strong>Computer</strong></th>
<td title="Computer Reference">{{computer}}</td>
</tr>
<tr>
<th><i class="fa fa-square m-hidden"></i> <strong>Computer Partition</strong></th>
<td title="Partition Reference">{{partition}}</td>
</tr>
<tr>
<th><i class="fa fa-globe m-hidden"></i> <strong>IPv4 Address</strong></th>
<td title="IPv4">{{ipv4}}</td>
</tr>
<tr>
<th><i class="fa fa-globe m-hidden"></i> <strong>IPv6 Address</strong></th>
<td title="IPv6">{{ipv6}}</td>
</tr>
<tr>
<th><strong>Software Type</strong></th>
<td title="Software type">{{software-type}}</td>
</tr>
</table>
</div>
<div class="ui-block-b">
<table data-role="table" data-mode="columntoggle" class="table-stroke">
<tr>
<th><i class="fa fa-tachometer m-hidden"></i> <strong>Status</strong></th>
<td><span class="label label-{{../status}}">{{../status}}</span></td>
</tr>
<tr>
<th><i class="fa fa-clock-o m-hidden" aria-hidden="true"></i> <strong>Report Date</strong></th>
<td title="Report Date">{{../date}}</td>
</tr>
<tr>
<th><strong>Software Release</strong></th>
<td><a style="padding: 0; min-height: initial;" href="{{software-release}}" title="{{software-release}}" target='_blank'>Click to open <i class="fa fa-external-link"></i></a></td>
</tr>
<tr>
<th></i> <strong>Promises Error</strong></th>
<td title="Number of promises error in Software Instance">{{../error}}</td>
</tr>
<tr>
<th><strong>Promises OK</strong></th>
<td title="Number of promises OK in Software Instance">{{../success}}</td>
</tr>
</table>
</div>
{{/with}}
</div>
</div>
</div>
</div>
</script>
<script id="promiselist-widget-template" type="text/x-handlebars-template">
{{#if promise_list}}
<h2><i class="fa fa-th-list"></i> <strong>Software Instance Promises</strong></h2>
<div style="overflow: auto;" class="padding-lr-10">
<table data-role="table" data-mode="columntoggle" class="table-stroke">
{{#each promise_list}}
<tr title="Promise reported at {{../date}}">
<td><a href="{{href}}">{{title}}</a></td>
<td class="m-hidden" style="text-align: center;">{{../short_date}} {{time}}</td>
<td style="text-align: center;"><span class="label label-{{status}}">{{status}}</span></td>
</tr>
{{/each}}
</table>
</div>
{{/if}}
</script>
<!-- custom script -->
<script src="gadget_monitoring_software_instance_view.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_monitoring_jio.html" data-gadget-scope="jio_gadget" data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_monitoring_login_widget.html" data-gadget-scope="login_gadget" data-gadget-sandbox="public"></div>
<div class="ui-panel-overview">
<div class="overview-details">
</div>
<div class="graph-full">
<h2><i class="fa fa-line-chart" aria-hidden="true"></i> <strong>Promises result progression</strong></h2>
<div data-gadget-url="gadget_erp5_graph.html" data-gadget-scope="graph_gadget" class="graph graph-medium "></div>
</div>
<div class="promise-list">
</div>
</div>
</body>
</html>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>classification/collaborative/team</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_software_instance_view.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_monitoring_software_instance_view_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Monitoring Software Instance View</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464251887.79</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.29605.58541.5853</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464275000.12</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464250270.25</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
/*global window, rJS, RSVP, Handlebars, loopEventListener, $ */
/*jslint nomen: true, indent: 2 */
(function (window, rJS, RSVP, Handlebars, loopEventListener, $) {
"use strict";
/////////////////////////////////////////////////////////////////
// templates
/////////////////////////////////////////////////////////////////
var gadget_klass = rJS(window),
templater = gadget_klass.__template_element;
/////////////////////////////////////////////////////////////////
// some methods
/////////////////////////////////////////////////////////////////
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
.ready(function (gadget) {
gadget.property_dict = {
render_deferred: RSVP.defer()
};
})
.ready(function (gadget) {
return gadget.getElement()
.push(function (element) {
gadget.property_dict.element = element;
});
})
.ready(function (gadget) {
return gadget.getDeclaredGadget("jio_gadget")
.push(function (jio_gadget) {
gadget.property_dict.jio_gadget = jio_gadget;
});
})
.ready(function (gadget) {
return gadget.getDeclaredGadget("graph_gadget")
.push(function (graph_gadget) {
gadget.property_dict.graph = graph_gadget;
});
})
.ready(function (gadget) {
return gadget.getDeclaredGadget("login_gadget")
.push(function (login_gadget) {
gadget.property_dict.login_gadget = login_gadget;
});
})
/*.ready(function (gadget) {
return gadget.getSetting('instance_overview_selection')
.push(function (selection) {
gadget.property_dict.selection = selection || '';
});
})*/
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod('render', function (option_dict) {
var gadget = this,
jio_options = {
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: option_dict.url
}
}
},
document_id = 'monitor.global';
return new RSVP.Queue()
.push(function () {
// This is needed now to get status_data in online mode
return gadget.property_dict.login_gadget.loginRedirect(
option_dict.url,
{
page: 'software_instance_view',
url: option_dict.url
},
option_dict.title,
option_dict.root_title
);
})
.push(function (cred) {
jio_options.sub_storage.sub_storage.basic_login = cred.hash;
gadget.property_dict.jio_gadget.createJio(jio_options);
return gadget.property_dict.jio_gadget.get(
document_id
);
})
.push(function (current_document) {
var instance_content,
promise_list_template;
if (current_document.hasOwnProperty('data') &&
current_document.data.hasOwnProperty('state')) {
jio_options.sub_storage.sub_storage.url = current_document._links.private_url.href + 'data/';
instance_content = Handlebars.compile(
templater.getElementById("details-widget-overview").innerHTML
),
promise_list_template = Handlebars.compile(
templater.getElementById("promiselist-widget-template").innerHTML
);
// Create online jio
gadget.property_dict.jio_gadget.createJio(jio_options, false);
return gadget.property_dict.jio_gadget.get(
current_document.data.state
)
.push(undefined, function (error) {
console.log(error);
return {};
})
.push(function (element_dict) {
$(gadget.property_dict.element.querySelector(".ui-block-b .ui-panel-overview")).show();
var content,
promise_content,
promise_list = [],
i,
tmp_url,
tmp_process_url,
promise_data = ["Date, Success, Error, Warning"];
gadget.property_dict.promise_data = element_dict.data || promise_data;
// Resource view URLs
tmp_url = "#page=resource_view&title=" + current_document.title +
"&root=" + current_document['hosting-title'] +
"&jio_for=" + current_document._links.private_url.href;
tmp_process_url = "#page=process_view&title=" + current_document.title +
"&root=" + current_document['hosting-title'] +
"&jio_for=" + current_document._links.private_url.href;
content = instance_content({
title: current_document.title,
root_title: current_document['hosting-title'],
date: current_document.date,
status: current_document.status,
error: current_document.state.error,
success: current_document.state.success,
instance: current_document._embedded.instance || '',
public_url: current_document._links.hasOwnProperty('public_url') ? current_document._links.public_url.href : '',
private_url: current_document._links.hasOwnProperty('private_url') ? current_document._links.private_url.href : '',
rss_url: current_document._links.hasOwnProperty('rss_url') ? current_document._links.rss_url.href : '',
resource_url: tmp_url,
process_url: tmp_process_url
});
if (current_document._embedded.promises !== undefined) {
for (i = 0; i < current_document._embedded.promises.length; i += 1) {
promise_list.push(current_document._embedded.promises[i]);
promise_list[i].href = "#page=view&jio_key=" +
promise_list[i].title + '.status' + "&jio_for=" +
current_document._links.public_url.href;
}
}
promise_content = promise_list_template({
promise_list: promise_list,
date: current_document.date,
short_date: new Date(current_document.date).toISOString().split('T')[0]
});
gadget.property_dict.element.querySelector(".overview-details")
.innerHTML = content;
gadget.property_dict.element.querySelector(".promise-list")
.innerHTML = promise_content;
return $(gadget.property_dict.element.querySelectorAll('fieldset[data-role="controlgroup"]'))
.controlgroup().controlgroup('refresh');
});
}
})
.push(function () {
return gadget.property_dict.render_deferred.resolve();
});
})
/////////////////////////////////////////////////////////////////
// declared service
/////////////////////////////////////////////////////////////////
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.property_dict.render_deferred.promise;
})
.push(function () {
var data = gadget.property_dict.promise_data.join('\n');
return gadget.property_dict.graph.render(
data,
{
ylabel: '<span class="graph-label"><i class="fa fa-bar-chart"></i> Success/Failure count</span>',
legend: 'always',
labelsDivStyles: { 'textAlign': 'right' }
},
"customInteractionModel"
);
});
//return RSVP.all(promise_list);
});
}(window, rJS, RSVP, Handlebars, loopEventListener, $));
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>classification/collaborative/team</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_software_instance_view.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_monitoring_software_instance_view_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Monitoring Software Instance View JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464252015.64</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.29601.58484.42154</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464274806.79</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1464251854.13</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -70,6 +70,9 @@ ...@@ -70,6 +70,9 @@
return gadget.updateHeader(header) return gadget.updateHeader(header)
.push(function () { .push(function () {
if (options.reset_filter === "1") {
return;
}
if (!options.hasOwnProperty('search') || !options.hasOwnProperty('filter')) { if (!options.hasOwnProperty('search') || !options.hasOwnProperty('filter')) {
return gadget.getSetting('status_list_selection_key') return gadget.getSetting('status_list_selection_key')
.push(function (selection) { .push(function (selection) {
...@@ -88,7 +91,11 @@ ...@@ -88,7 +91,11 @@
filter: options.filter || '', filter: options.filter || '',
search: options.search || '' search: options.search || ''
}; };
return gadget.setSetting('status_list_selection_key', selection); if (options.reset_filter !== "1") {
return gadget.setSetting('status_list_selection_key', selection);
} else {
return '';
}
}) })
.push(function () { .push(function () {
if (options.root_title) { if (options.root_title) {
...@@ -129,26 +136,37 @@ ...@@ -129,26 +136,37 @@
.declareAcquiredMethod("jio_get", "jio_get") .declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareService(function () { .declareService(function () {
var gadget = this; var gadget = this,
current_sync_date;
return gadget.getSetting('status_list_refresh_id') return gadget.getSetting('latest_sync_time')
.push(function (sync_time) {
current_sync_date = sync_time;
return gadget.getSetting('status_list_refresh_id');
})
.push(function (timer_id) { .push(function (timer_id) {
var new_timer_id; var new_timer_id;
if (timer_id) { if (timer_id) {
clearTimeout(timer_id); clearInterval(timer_id);
} }
new_timer_id = setTimeout(function(){ new_timer_id = setInterval(function(){
var hash = window.location.toString().split('#')[1], var hash = window.location.toString().split('#')[1],
scroll_position, scroll_position,
doc = document.documentElement; doc = document.documentElement;
if (hash.indexOf('page=status_list') >= 0) { if (hash.indexOf('page=status_list') >= 0) {
scroll_position = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); return gadget.getSetting('latest_sync_time')
return gadget.renderApplication({args: gadget.property_dict.options}) .push(function (sync_time) {
.push(function () { if (sync_time > current_sync_date) {
$(document).scrollTop(scroll_position); scroll_position = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
current_sync_date = sync_time;
return gadget.renderApplication({args: gadget.property_dict.options})
.push(function () {
$(document).scrollTop(scroll_position);
});
}
}); });
} }
}, 120000); }, 60000);
return gadget.setSetting('status_list_refresh_id', new_timer_id); return gadget.setSetting('status_list_refresh_id', new_timer_id);
}); });
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.28233.17496.1826</string> </value> <value> <string>951.30706.51220.30105</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464193389.51</float> <float>1464340992.01</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<tr rel="{{index}}"> <tr rel="{{index}}">
<td class="ui-text-center"><a class="ui-link" href="{{href}}"> <td class="ui-text-center"><a class="ui-link" href="{{href}}">
<span class="ui-status-icon ui-status-{{status}}"></span></a></td> <span class="ui-status-icon ui-status-{{status}}"></span></a></td>
<td><a class="ui-link" href="{{href}}">{{date}}</a></td>
<td><a class="ui-link" href="{{href}}">{{value}}</a></td> <td><a class="ui-link" href="{{href}}">{{value}}</a></td>
<td><a class="ui-link" href="{{href}}">{{hosting_value}}</a></td> <td><a class="ui-link" href="{{href}}">{{hosting_value}}</a></td>
</tr> </tr>
...@@ -62,105 +63,12 @@ ...@@ -62,105 +63,12 @@
</div> </div>
</script> </script>
<script id="details-widget-overview" type="text/x-handlebars-template">
<div class="overview-header">
<div class='content-title ui-instance-title'>
<div class="overview-title">
<i class="fa fa-cubes"></i><span>
{{#if root_title}}
{{root_title}} >&nbsp;
{{/if}}
{{title}}
</span>
</div>
<div class="commands">
</div>
</div>
</div>
<div class="content-details">
<div class="ui-text-left" style="padding-bottom: 15px;">
<h2><i class="fa fa-info-circle"></i> <strong>Instance State Information</strong></h2>
<div class="padding-10">
<div class="ui-grid-a ui-responsive">
<div class="ui-block-a">
<fieldset data-role="controlgroup" data-type="horizontal">
{{#if resource_url }}
<a href="{{resource_url}}" class="ui-btn ui-corner-all ui-btn-inline ui-mini" title="Instance Resource comsumption"><i class="fa fa-pie-chart"></i> Resources</a>
{{/if}}
{{#if process_url }}
<a href="{{process_url}}" class="ui-btn ui-corner-all ui-btn-inline ui-mini" title="Processes usage"><i class="fa fa-list-alt"></i> Processes</a>
{{/if}}
</fieldset>
</div>
<div class="ui-block-b">
<fieldset data-role="controlgroup" data-type="horizontal">
{{#if public_url}}
<!--<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" target='_blank' href="{{public_url}}" title="Public"><i class="fa fa-folder-open-o"></i> Public</a>-->
{{/if}}
{{#if private_url}}
<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" target='_blank' href="{{private_url}}" title="Browse Private Directory"><i class="fa fa-lock"></i> Private</a>
{{/if}}
{{#if rss_url}}
<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" target='_blank' href="{{rss_url}}" title="RSS"><i class="fa fa-rss-square"></i> RSS</a>
{{/if}}
</fieldset>
</div>
</div>
<table data-role="table" data-mode="columntoggle" class="ui-responsive table-stroke">
<tr>
<th><i class="fa fa-tachometer"></i> <strong>Status</strong></th>
<td><span class="label label-{{status}}">{{status}}</span></td>
<td title="Report Date">{{date}}</td>
</tr>
{{#with instance}}
<tr>
<th><i class="fa fa-desktop"></i> <strong>Computer</strong></th>
<td title="Computer Reference">{{computer}}</td>
<td title="Partition Reference">{{partition}}</td>
</tr>
<tr>
<th><i class="fa fa-globe"></i> <strong>IP Addresses</strong></th>
<td title="IPv4">{{ipv4}}</td>
<td title="IPv6">{{ipv6}}</td>
</tr>
<tr>
<th><i class="fa fa-square-o" aria-hidden="true"></i> <strong>Software Type</strong></th>
<td title="Software type">{{software-type}}</td>
<td><a style="padding: 0; min-height: initial;" href="{{software-release}}" title="{{software-release}}" target='_blank'>Click to open <i class="fa fa-external-link"></i></a></td>
</tr>
{{/with}}
</table>
</div>
</div>
</div>
</script>
<script id="promiselist-widget-template" type="text/x-handlebars-template">
{{#if promise_list}}
<h2><i class="fa fa-th-list"></i> <strong>Instance Promises List</strong></h2>
<div style="overflow: auto;" class="padding-lr-10">
<table data-role="table" data-mode="columntoggle" class="table-stroke">
{{#each promise_list}}
<tr title="Promise reported at {{../date}}">
<td><a href="{{href}}">{{title}}</a></td>
<td style="text-align: center;">{{time}}</td>
<td style="text-align: center;"><span class="label label-{{status}}">{{status}}</span></td>
</tr>
{{/each}}
</table>
</div>
{{/if}}
</script>
<!-- custom script --> <!-- custom script -->
<script src="gadget_monitoring_widget_overview.js" type="text/javascript"></script> <script src="gadget_monitoring_widget_instance_list.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div data-gadget-url="gadget_monitoring_jio.html" data-gadget-scope="jio_gadget" data-gadget-sandbox="public"></div> <div data-gadget-url="gadget_monitoring_jio.html" data-gadget-scope="jio_gadget" data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_monitoring_login_widget.html" data-gadget-scope="login_gadget" data-gadget-sandbox="public"></div>
<div class="overview-filter-panel"> <div class="overview-filter-panel">
<form class='filter'> <form class='filter'>
<h2>Configure Displayed Result</h2> <h2>Configure Displayed Result</h2>
...@@ -179,32 +87,18 @@ ...@@ -179,32 +87,18 @@
</form> </form>
</div> </div>
<div class="ui-grid-a ui-responsive custom-listbox"> <div class="ui-grid-solo ui-responsive custom-listbox">
<div class="ui-block-a"> <div class="ui-panel-overview" style="min-height: 450px;">
<div class="ui-panel-overview" style="min-height: 450px;"> <div class="overview-header">
<div class="overview-header"> <div class='content-title ui-instance-title'>
<div class='content-title ui-instance-title'> <div class="overview-title">
<div class="overview-title"> <i class="fa fa-desktop"></i><span>Software Instances List</span>
<i class="fa fa-desktop"></i><span>Software Instances List</span> </div>
</div> <div class="commands">
<div class="commands">
</div>
</div> </div>
</div>
<div class="overview-content">
</div> </div>
</div> </div>
</div> <div class="overview-content">
<div class="ui-block-b" style="position: relative">
<div class="signal ui-content-hidden"></div>
<div class="ui-panel-overview">
<div class="overview-details">
</div>
<div style="margin: 0 20px;">
<div data-gadget-url="gadget_erp5_graph.html" data-gadget-scope="graph_gadget" class="graph graph-medium "></div>
</div>
<div class="promise-list">
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_widget_overview.html</string> </value> <value> <string>gadget_monitoring_widget_instance_list.html</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Monitoring Widget Overview</string> </value> <value> <string>Monitoring Widget Software Instance List</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.27817.37423.50688</string> </value> <value> <string>951.29269.36506.17954</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464168027.07</float> <float>1464254807.83</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
var gadget_klass = rJS(window), var gadget_klass = rJS(window),
templater = gadget_klass.__template_element, templater = gadget_klass.__template_element,
listbox_widget_template = Handlebars.compile(
templater.getElementById("overview-widget-listview").innerHTML
),
header_listbox_widget = Handlebars.compile( header_listbox_widget = Handlebars.compile(
templater.getElementById("header-widget-overview").innerHTML templater.getElementById("header-widget-overview").innerHTML
),
listbox_widget_template = Handlebars.compile(
templater.getElementById("overview-widget-listview").innerHTML
); );
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
return gadget.getElement() return gadget.getElement()
.push(function (element) { .push(function (element) {
gadget.property_dict.element = element; gadget.property_dict.element = element;
gadget.property_dict.block_index = 0;
gadget.property_dict.filter_panel = $(gadget.property_dict.element.querySelector(".overview-filter-panel")); gadget.property_dict.filter_panel = $(gadget.property_dict.element.querySelector(".overview-filter-panel"));
}); });
}) })
...@@ -45,18 +44,6 @@ ...@@ -45,18 +44,6 @@
gadget.property_dict.jio_gadget = jio_gadget; gadget.property_dict.jio_gadget = jio_gadget;
}); });
}) })
.ready(function (gadget) {
return gadget.getDeclaredGadget("graph_gadget")
.push(function (graph_gadget) {
gadget.property_dict.graph = graph_gadget;
});
})
.ready(function (gadget) {
return gadget.getDeclaredGadget("login_gadget")
.push(function (login_gadget) {
gadget.property_dict.login_gadget = login_gadget;
});
})
.ready(function (gadget) { .ready(function (gadget) {
gadget.property_dict.filter_panel.panel({ gadget.property_dict.filter_panel.panel({
"position-fixed": true, "position-fixed": true,
...@@ -68,12 +55,6 @@ ...@@ -68,12 +55,6 @@
.ready(function (gadget) { .ready(function (gadget) {
return gadget.property_dict.filter_panel.trigger("create"); return gadget.property_dict.filter_panel.trigger("create");
}) })
.ready(function (gadget) {
return gadget.getSetting('instance_overview_selection')
.push(function (selection) {
gadget.property_dict.selection = selection || '';
});
})
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// published methods // published methods
...@@ -96,12 +77,13 @@ ...@@ -96,12 +77,13 @@
.declareMethod('render', function (option_dict) { .declareMethod('render', function (option_dict) {
var gadget = this, var gadget = this,
content = '', content = '',
j,
k, k,
k_len, k_len,
search_string = '', search_string = '',
translated_column_list = [], translated_column_list = [],
all_document_list = [], all_document_list = [],
monitor_url_list = [], filter_part_list = [],
getPartialData; getPartialData;
// Create the search query // Create the search query
...@@ -114,7 +96,18 @@ ...@@ -114,7 +96,18 @@
if (option_dict.query.query) { if (option_dict.query.query) {
option_dict.query.query = '(' + search_string + ') AND ' + option_dict.query.query; option_dict.query.query = '(' + search_string + ') AND ' + option_dict.query.query;
} else { } else {
option_dict.query.query = search_string; option_dict.query.query = '(' + search_string+ ')';
}
}
if (option_dict.filter && option_dict.filter !== '') {
for (j = 0; j < option_dict.filter.split('+').length; j += 1) {
filter_part_list.push('(status:"' + option_dict.filter.split('+')[j].toUpperCase() + '")');
}
if (option_dict.query.query) {
option_dict.query.query += ' AND (' + filter_part_list.join(' OR ') + ')';
} else {
option_dict.query.query = filter_part_list.join(' OR ');
} }
} }
...@@ -173,12 +166,13 @@ ...@@ -173,12 +166,13 @@
gadget.property_dict.document_list = all_document_list; gadget.property_dict.document_list = all_document_list;
for (i = 0, i_len = all_document_list.length; i < i_len; i += 1) { for (i = 0, i_len = all_document_list.length; i < i_len; i += 1) {
promise_list.push(gadget.getUrlFor({ promise_list.push(gadget.getUrlFor({
jio_key: all_document_list[i].id, title: all_document_list[i].title,
jio_for: monitor_url_list[i], root_title: all_document_list[i]['hosting-title'],
page: 'overview_details' url: all_document_list[i]._links.monitor.href,
page: 'software_instance_view'
})); }));
} }
return RSVP.all(promise_list); return RSVP.all(promise_list);
}) })
.push(function (link_list) { .push(function (link_list) {
...@@ -194,6 +188,7 @@ ...@@ -194,6 +188,7 @@
"href": link_list[j], "href": link_list[j],
"search": option_dict.search, "search": option_dict.search,
"index": j, "index": j,
"date": all_document_list[j].date,
"value": all_document_list[j].title, "value": all_document_list[j].title,
"hosting_value": all_document_list[j]['hosting-title'] || '', "hosting_value": all_document_list[j]['hosting-title'] || '',
"status": all_document_list[j].hasOwnProperty('status') ? all_document_list[j].status.toLowerCase() : '' "status": all_document_list[j].hasOwnProperty('status') ? all_document_list[j].status.toLowerCase() : ''
...@@ -205,7 +200,12 @@ ...@@ -205,7 +200,12 @@
}*/ }*/
return RSVP.all([ return RSVP.all([
row_list, row_list,
[{title: 'Status'}, {title: 'Instance'}, {title: 'Hosting Subscription'}] [
{title: 'Status'},
{title: 'Report Date'},
{title: 'Software Instance'},
{title: 'Hosting Subscription'}
]
]); ]);
}) })
.push(function (result_list) { .push(function (result_list) {
...@@ -230,9 +230,6 @@ ...@@ -230,9 +230,6 @@
} }
} }
}) })
.push(function () {
return $(gadget.property_dict.element.querySelector(".ui-block-b .ui-panel-overview")).hide();
})
.push(function () { .push(function () {
return gadget.property_dict.render_deferred.resolve(); return gadget.property_dict.render_deferred.resolve();
}); });
...@@ -243,174 +240,23 @@ ...@@ -243,174 +240,23 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareService(function () { .declareService(function () {
var gadget = this; var gadget = this;
function showInstanceDetails(element) {
var jio_options = {
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav"
}
}
},
index = parseInt($(element).attr('rel'), 10),
private_link;
if (!isNaN(index) && (gadget.property_dict.document_list.length > index)) {
private_link = gadget.property_dict.document_list[index]._links.monitor.href;
} else {
return;
}
return new RSVP.Queue()
.push(function () {
$(".ui-block-b .signal").removeClass("ui-content-hidden");
return gadget.setSetting('instance_overview_selection', private_link);
})
.push(function () {
return gadget.property_dict.login_gadget.loginRedirect(
private_link,
{
page: gadget.property_dict.option_dict.search_page || '',
sort_on: gadget.property_dict.option_dict.sort_on || '',
search: gadget.property_dict.option_dict.search || '',
select: private_link
},
gadget.property_dict.document_list[index].title,
gadget.property_dict.document_list[index]['hosting-title']
);
})
.push(function (cred) {
jio_options.sub_storage.sub_storage.url = private_link;
jio_options.sub_storage.sub_storage.basic_login = cred.hash;
gadget.property_dict.jio_gadget.createJio(jio_options);
return gadget.property_dict.jio_gadget.get(
gadget.property_dict.option_dict.data_id
);
})
.push(function (current_document) {
var instance_content,
promise_list_template;
if (current_document.hasOwnProperty('data') &&
current_document.data.hasOwnProperty('state')) {
jio_options.sub_storage.sub_storage.url = current_document._links.private_url.href + 'data/';
instance_content = Handlebars.compile(
templater.getElementById("details-widget-overview").innerHTML
),
promise_list_template = Handlebars.compile(
templater.getElementById("promiselist-widget-template").innerHTML
);
gadget.property_dict.jio_gadget.createJio(jio_options, false);
return gadget.property_dict.jio_gadget.get(
current_document.data.state
)
.push(function (element_dict) {
$(gadget.property_dict.element.querySelector(".ui-block-b .ui-panel-overview")).show();
return element_dict;
})
.push(function (element_dict) {
var data = element_dict.data.join('\n'),
old_element = $(gadget.property_dict.element.querySelector('.ui-listview-container table td > a.selected'));
if (old_element) {
old_element.removeClass('selected');
}
return gadget.property_dict.graph.render(
data,
{
xlabel: '<span class="graph-label"><i class="fa fa-bar-chart"></i> Promises Success/Failure Result</span>',
legend: 'always',
labelsDivStyles: { 'textAlign': 'right' }
},
"customInteractionModel"
);
})
.push(function () {
var content,
promise_content,
promise_list = [],
i,
tmp_url,
tmp_process_url;
// Resource view URLs
tmp_url = "#page=resource_view&title=" + current_document.title +
"&root=" + current_document['hosting-title'] +
"&jio_for=" + current_document._links.private_url.href;
tmp_process_url = "#page=process_view&title=" + current_document.title +
"&root=" + current_document['hosting-title'] +
"&jio_for=" + current_document._links.private_url.href;
content = instance_content({
title: current_document.title,
root_title: current_document['hosting-title'],
date: current_document.date,
status: current_document.status,
instance: current_document._embedded.instance || '',
public_url: current_document._links.hasOwnProperty('public_url') ? current_document._links.public_url.href : '',
private_url: current_document._links.hasOwnProperty('private_url') ? current_document._links.private_url.href : '',
rss_url: current_document._links.hasOwnProperty('rss_url') ? current_document._links.rss_url.href : '',
resource_url: tmp_url,
process_url: tmp_process_url
});
if (current_document._embedded.promises !== undefined) {
for (i = 0; i < current_document._embedded.promises.length; i += 1) {
promise_list.push(current_document._embedded.promises[i]);
promise_list[i].href = "#page=view&jio_key=" +
promise_list[i].title + '.status' + "&jio_for=" +
current_document._links.public_url.href;
}
}
promise_content = promise_list_template({
promise_list: promise_list,
date: current_document.date
});
$(element.querySelector('td:first-child > a')).addClass('selected');
gadget.property_dict.element.querySelector(".overview-details")
.innerHTML = content;
gadget.property_dict.element.querySelector(".promise-list")
.innerHTML = promise_content;
$(".ui-block-b .signal").addClass("ui-content-hidden");
return $(element.querySelectorAll('fieldset[data-role="controlgroup"]'))
.controlgroup().controlgroup('refresh');
});
}
$(".ui-block-b .signal").addClass("ui-content-hidden");
return false;
});
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.property_dict.render_deferred.promise; return gadget.property_dict.render_deferred.promise;
}) })
.push(function () { .push(function () {
var promise_list = [], var promise_list = [];
element_list = gadget.property_dict.element.querySelectorAll('.ui-listview-container table tr'),
i;
for (i = 0; i < element_list.length; i += 1) {
promise_list.push(loopEventListener(
element_list[i],
'click',
false,
showInstanceDetails.bind(gadget, element_list[i])
));
}
promise_list.push(loopEventListener( promise_list.push(loopEventListener(
gadget.property_dict.element.querySelector('form.search'), gadget.property_dict.element.querySelector('form.search'),
'submit', 'submit',
false, false,
function (evt) { function (evt) {
return gadget.redirect({ return gadget.redirect({
jio_key: gadget.property_dict.option_dict.jio_key || '',
page: gadget.property_dict.option_dict.search_page || '', page: gadget.property_dict.option_dict.search_page || '',
sort_on: gadget.property_dict.option_dict.sort_on || '', sort_on: gadget.property_dict.option_dict.sort_on || '',
search: evt.target[0].value search: evt.target[0].value,
filter: gadget.property_dict.option_dict.filter || ''
}); });
}) })
); );
...@@ -431,6 +277,7 @@ ...@@ -431,6 +277,7 @@
page: gadget.property_dict.option_dict.search_page || '', page: gadget.property_dict.option_dict.search_page || '',
sort_on: gadget.property_dict.option_dict.sort_on || '', sort_on: gadget.property_dict.option_dict.sort_on || '',
search: gadget.property_dict.option_dict.search || '', search: gadget.property_dict.option_dict.search || '',
filter: gadget.property_dict.option_dict.filter || '',
t: Date.now() / 1000 | 0 t: Date.now() / 1000 | 0
}); });
}) })
...@@ -455,20 +302,10 @@ ...@@ -455,20 +302,10 @@
page: gadget.property_dict.option_dict.search_page || '', page: gadget.property_dict.option_dict.search_page || '',
sort_on: gadget.property_dict.option_dict.sort_on || '', sort_on: gadget.property_dict.option_dict.sort_on || '',
search: gadget.property_dict.option_dict.search || '', search: gadget.property_dict.option_dict.search || '',
status: filter_status.join('+') filter: filter_status.join('+')
}); });
}) })
); );
if ( gadget.property_dict.selection) {
for (i = 0; i < gadget.property_dict.document_list.length; i += 1) {
if (gadget.property_dict.document_list[i]._links.monitor.href === gadget.property_dict.selection) {
promise_list.push($(gadget.property_dict.element.querySelector(
'.ui-listview-container table tr[rel="' + i + '"]')
).click());
break;
}
}
}
return RSVP.all(promise_list); return RSVP.all(promise_list);
}); });
}); });
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_monitoring_widget_overview.js</string> </value> <value> <string>gadget_monitoring_widget_instance_list.js</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Monitoring Widget Overview JS</string> </value> <value> <string>Monitoring Widget Software Instance List JS</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.26805.9745.42530</string> </value> <value> <string>951.29330.13166.23057</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464168098.17</float> <float>1464258374.01</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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