Commit e2bf0e29 authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_monitoring: improve user interface and offline mode

parent d62fa8e3
......@@ -107,7 +107,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Fri, 20 Mai 2016 15:47:33 +0000\n
# generated on Fri, 25 Mai 2016 15:47:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -137,6 +137,7 @@ jquerymobile.css\n
jquerymobile.js\n
jsen.min.js\n
magnific-popup.css\n
notify.min.js\n
renderjs.js\n
rsvp.js\n
# gadget_officejs_page_sync.html\n
......@@ -329,7 +330,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.21023.1861.15223</string> </value>
<value> <string>951.21023.22440.29593</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -347,7 +348,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1463759960.49</float>
<float>1464194710.25</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -41,8 +41,8 @@
<script id="panel-template-body" type="text/x-handlebars-template">
<div class="ui-content">
<ul data-role="listview" class="ui-listview">
<li><a href="#page=hosting_overview"><i class="fa fa-globe"></i><span data-i18n="Applications Overview">Applications Overview</span></a></li>
<li><a href="#page=overview"><i class="fa fa-cube"></i><span data-i18n="Instances Overview">Instances Overview</span></a></li>
<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=overview"><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=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>
......
......@@ -237,7 +237,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.11404.26472.10461</string> </value>
<value> <string>951.17777.16093.25088</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -255,7 +255,7 @@
</tuple>
<state>
<tuple>
<float>1459508166.41</float>
<float>1464107507.78</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -777,16 +777,17 @@ margin-top: 5px;
border: 4px solid #024352;
border-radius: 50px;
height: 50px;
left: 50%;
left: 75%;
margin: -15px 0 0 -15px;
/*opacity: 0;*/
position: absolute;
top: 90px;
position: fixed;
top: 200px;
width: 50px;
/*animation: pulsate .5s ease-out;
animation-iteration-count: infinite;*/
animation: rotate 0.8s infinite linear;
border-right-color: transparent;
z-index: 100;
}
@keyframes rotate {
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.7640.35673.52906</string> </value>
<value> <string>951.7641.18647.23022</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1462957037.05</float>
<float>1464100990.73</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -31,7 +31,6 @@
<!--div data-role="header" data-theme="a" class="ui-header ui-bar-a" data-position="fixed" data-tap-toggle="false"-->
<div data-role="header" data-position="fixed" data-theme="a" class="ui-header ui-bar-a" data-tap-toggle="false">
<div data-gadget-url="gadget_monitoring_sync.html" data-gadget-scope="sync_gadget" data-gadget-sandbox="public"></div>
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">
<div class="ui-controlgroup-controls">
</div>
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.17777.16093.25088</string> </value>
<value> <string>951.20770.48030.58606</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463744803.95</float>
<float>1464184576.96</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -44,13 +44,6 @@
};
})
.ready(function (g) {
return g.getDeclaredGadget("sync_gadget")
.push(function (sync_gadget) {
g.props.sync_gadget = sync_gadget;
});
})
// Assign the element to a variable
.ready(function (g) {
return g.getElement()
......@@ -104,7 +97,7 @@
return this.render(this.stats.options);
}
})
/*
.declareMethod('notifyChange', function () {
if (!this.stats.modified) {
this.stats.modified = true;
......@@ -125,7 +118,7 @@
return this.render(this.stats.options);
}
})
*/
.declareMethod('render', function (options) {
var gadget = this,
possible_left_link_list = [
......@@ -273,10 +266,6 @@
gadget.props.title_element.innerHTML = my_translated_html_list[0];
gadget.props.left_link.innerHTML = my_translated_html_list[1];
gadget.props.right_link.innerHTML = my_translated_html_list[2];
})
.push(function () {
// set auto sync timer
return gadget.props.sync_gadget.startSync();
});
})
......
......@@ -235,7 +235,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.20773.60158.51182</string> </value>
<value> <string>951.28063.61835.56814</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -253,7 +253,7 @@
</tuple>
<state>
<tuple>
<float>1463745210.1</float>
<float>1464184478.05</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -29,9 +29,9 @@
<script id="instance-details-widget-overview" type="text/x-handlebars-template">
{{#if status_list_url}}
<div data-role="controlgroup">
<a class="ui-btn ui-corner-all" href="{{status_list_url}}" title="Public"><i class="fa fa-check-square"></i> View Promises Status</a>
</div>
<!--<div data-role="controlgroup">
<a class="ui-btn ui-corner-all" href="{{status_list_url}}" title="Public"><i class="fa fa-check-square"></i> Promises</a>
</div>-->
{{/if}}
<div class="ui-listview-container">
<ul data-role="listview" class="ui-listview-outer" data-inset="true">
......@@ -45,11 +45,14 @@
<fieldset>
<div class="ui-field-contain">
<fieldset data-role="controlgroup" data-type="horizontal">
{{#if ../status_list_url}}
<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" href="{{../status_list_url}}" title="Instance Promises List"><i class="fa fa-check-square"></i> Promises</a>
{{/if}}
{{#if resource_url }}
<a href="{{resource_url}}" class="ui-btn ui-corner-all ui-btn-inline ui-mini"><i class="fa fa-pie-chart"></i> Resources</a>
<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"><i class="fa fa-list-alt"></i> Processes</a>
<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}}
{{#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>
......@@ -59,7 +62,7 @@
<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="Private"><i class="fa fa-lock"></i> Private</a>
<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}}
-->
</fieldset>
......@@ -74,13 +77,18 @@
{{#with instance}}
<tr>
<th><i class="fa fa-desktop"></i> <strong>Computer</strong></th>
<td>{{computer}}</td>
<td>{{partition}}</td>
<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-globe"></i> <strong>IP Address</strong></th>
<td>{{ipv4}}</td>
<td>{{ipv6}}</td>
<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>
......@@ -139,7 +147,7 @@
<div class="overview-header">
<div class='content-title ui-instance-title'>
<div class="overview-title">
<i class="fa fa-globe"></i> <span>Monitoring Applications</span>
<i class="fa fa-globe"></i> <span>Hosting Subscriptions</span>
</div>
<div class="commands">
</div>
......@@ -151,7 +159,7 @@
<table class="ui-responsive ui-body-c ui-table-inset instance-overview">
<thead class="ui-bar-inherit">
<tr>
<th class="padding-10"></th>
<th class="padding-10">Status</th>
<th>Name</th>
<th>Status Date</th>
</tr>
......@@ -184,7 +192,7 @@
<div style="overflow: auto;" class="padding-lr-10 instances-parameters">
</div>
<div class="padding-5"></div>
<h2><i class="fa fa-cubes"></i> <strong>Instances State List</strong></h2>
<h2><i class="fa fa-cubes"></i> <strong>Instances Status</strong></h2>
<div class="instances-status">
</div>
</div>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.10932.20107.12578</string> </value>
<value> <string>951.27801.5339.60876</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>1463154501.48</float>
<float>1464166945.92</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -67,7 +67,7 @@
gadget.props = {};
gadget.props.hosting_list = [];
gadget.props.opml_key_list = [];
gadget.props.title = 'Monitoring Registered Applications';
gadget.props.title = 'Monitoring Hosting Subscriptions';
return gadget.getDeclaredGadget("login_gadget")
.push(function (login_gadget) {
gadget.props.login_gadget = login_gadget;
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.17698.39476.46574</string> </value>
<value> <string>951.17701.12410.54528</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463560631.34</float>
<float>1464106260.69</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -19,7 +19,7 @@
.declareMethod('render', function (options) {
var gadget = this,
header = {
"title": 'Instances Status Overview'
"title": 'Software Instances List'
},
listview_options = {
search_page: 'overview',
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.9443.43477.54732</string> </value>
<value> <string>951.9445.6535.55671</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463065265.96</float>
<float>1464107170.21</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -23,20 +23,22 @@
</tr>
<tr>
<th><i class="fa fa-calendar"></i> Status Date</th>
<td>{{status_date}}</td>
<td title="The date of this status.">{{status_date}}</td>
</tr>
<tr>
<th><i class="fa fa-clock-o"></i> Report Date</th>
<td>{{start-date}}</td>
<td title="The date when the promise result was collected.">{{start-date}}</td>
</tr>
</table>
{{#if message}}
<div style="border: 1px solid rgba(0,0,0,0.1); margin-top: 10px;">
<div class="ui-body">
{{#if message}}
<p><strong>{{status}}</strong>: {{message}}</p>
{{else}}
<p><strong>No output message!</strong></p>
{{/if}}
</div>
</div>
{{/if}}
<br/>
{{/with}}
</script>
......@@ -54,13 +56,13 @@
</fieldset>
</div>
<table data-role="table" data-mode="columntoggle" class="ui-responsive table-stroke">
<tr>
<th><i class="fa fa-puzzle-piece"></i> App Title</th>
<td>{{root_title}}</td>
<tr title="Hosting Subscription">
<th><i class="fa fa-puzzle-piece"></i> H. Subscription</th>
<td title="Hosting Subscription title">{{root_title}}</td>
</tr>
<tr>
<th><i class="fa fa-cube"></i> Instance</th>
<td>{{title}}</td>
<td title="Software Instance title">{{title}}</td>
</tr>
<tr>
<th><i class="fa fa-tachometer"></i> Status</th>
......@@ -68,19 +70,15 @@
</tr>
<tr>
<th><i class="fa fa-clock-o"></i> Report Date</th>
<td>{{date}}</td>
<td title="The date when the instance status was collected.">{{date}}</td>
</tr>
<tr>
<th>Errors Ratio</th>
<td>{{errors}} %</td>
<td title="Percentage of promises errors in Software Instance">{{errors}} %</td>
</tr>
<tr>
<th>Success Ratio</th>
<td>{{success}} %</td>
</tr>
<tr>
<th>Warning Ratio</th>
<td>{{warning}} %</td>
<td title="Percentage of promises success in Software Instance">{{success}} %</td>
</tr>
</table>
{{#with instance}}
......@@ -120,10 +118,10 @@
<div class="ui-field-contain">
<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>
<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" target='_blank' href="{{public_url}}" title="Public Directory"><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="Private"><i class="fa fa-lock"></i> Private</a>
<a class="ui-btn ui-corner-all ui-btn-inline ui-mini" target='_blank' href="{{private_url}}" title="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>
......@@ -133,9 +131,9 @@
</script>
<script id="phistory-widget-template" type="text/x-handlebars-template">
{{#if history_list}}
<h2><i class="fa fa-history"></i> <strong>Promise Status History</strong></h2>
<div style="max-height: 200px; overflow: auto;">
{{#if history_list}}
<table data-role="table" data-mode="columntoggle" class="ui-responsive table-stroke">
{{#each history_list}}
<tr title="{{message}}">
......@@ -145,8 +143,10 @@
</tr>
{{/each}}
</table>
</div>
{{else}}
History not found!
{{/if}}
</div>
</script>
</head>
......@@ -175,7 +175,7 @@
<div data-gadget-url="gadget_monitoring_chart.html" data-gadget-scope="chart0"></div>
</div>
<br/><br/>
<h2><i class="fa fa-line-chart"></i> <strong>Instance Promises Status History</strong></h2>
<h2><i class="fa fa-line-chart"></i> <strong>Instance Promises Result History</strong></h2>
<div data-gadget-url="gadget_monitoring_chart.html" data-gadget-scope="chart1"></div>
</div>
</div>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>949.26772.37443.60825</string> </value>
<value> <string>951.27884.45406.55586</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>1456500574.55</float>
<float>1464171822.28</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -128,7 +128,7 @@
element: element
});
gadget.property_dict.element.querySelector(".ui-promise-content .ui-promise-title h2")
.innerHTML += 'Promise ' + element.title;
.innerHTML += element.hosting_subscription + ' > ' + element.instance + ' > ' + element.title;
gadget.property_dict.element.querySelector("#promise-overview .ui-block-a")
.innerHTML += content;
if (element.hasOwnProperty('_links') && element._links.hasOwnProperty('monitor') && element._links.monitor.href) {
......@@ -213,20 +213,26 @@
}
};
gadget.property_dict.jio_gadget.createJio(jio_options, false);
return gadget.property_dict.jio_gadget.allDocs({
select_list: ['title', 'message', 'start-date', 'status'],
query: '_id: "%.history.status"',
limit: [0, 30],
sort_on: [["start-date", "descending"]]
return gadget.property_dict.jio_gadget.get(title+'.history')
.push(undefined, function (error) {
console.log(error);
return undefined;
})
.push(function (result_list) {
.push(function (status_history) {
var i,
start_index = 0,
history_size,
history_list = [];
if (result_list) {
for (i = 0; i < result_list.data.rows.length; i += 1) {
history_list.push(result_list.data.rows[i].value);
if (status_history && status_history.hasOwnProperty('data')) {
if (history_size > 200) {
start_index = history_size - 200;
}
history_size = status_history.data.length;
for (i = start_index; i < history_size; i += 1) {
history_list.push(status_history.data[i]);
}
history_list.reverse();
}
history_content = history_widget_template({history_list: history_list});
gadget.property_dict.element.querySelector("#promise-overview .ui-block-a")
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.10830.35453.12458</string> </value>
<value> <string>951.26579.32109.21009</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463152445.63</float>
<float>1464105558.24</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -197,6 +197,37 @@
});
}
function updateIOData() {
var i,
element,
prev_element,
date_diff,
io_data = "";
function convertElement(element) {
var element_list = element.split(',');
return [
element_list[0],
parseFloat(element_list[1].trim()),
parseFloat(element_list[2].trim()),
element_list[3].trim()
];
}
if (gadget.property_dict.io_data.data.length > 1) {
prev_element = convertElement(gadget.property_dict.io_data.data[1]);
io_data = gadget.property_dict.io_data.data[0];
for (i = 2; i < gadget.property_dict.io_data.data.length; i += 1) {
element = convertElement(gadget.property_dict.io_data.data[i]);
date_diff = (new Date(element[0]).getTime() - new Date(prev_element[0]).getTime())/1000;
io_data += "\n" + element[0] + "," +
(element[1] - prev_element[1])/(1024*date_diff) +
"," + (element[2] - prev_element[2])/1000 + "," + element[3];
prev_element = element;
}
}
gadget.property_dict.io_data_csv = io_data;
}
function formatDateToString(d) {
return d.toISOString().slice(0,10) + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
}
......@@ -270,20 +301,21 @@
});
})
.push(function () {
updateIOData();
return gadget.property_dict.graph_io_rw.updateOptions({
file: gadget.property_dict.io_data.data.join('\n'),
file: gadget.property_dict.io_data_csv,
dateWindow: date_window
});
})
.push(function () {
return gadget.property_dict.graph_io_counter.updateOptions({
file: gadget.property_dict.io_data.data.join('\n'),
file: gadget.property_dict.io_data_csv,
dateWindow: date_window
});
})
.push(function () {
return gadget.property_dict.graph_disk_used.updateOptions({
file: gadget.property_dict.io_data.data.join('\n'),
file: gadget.property_dict.io_data_csv,
dateWindow: date_window
});
})
......@@ -339,10 +371,11 @@
);
})
.push(function () {
updateIOData();
return gadget.property_dict.graph_io_rw.render(
gadget.property_dict.io_data.data.join('\n'),
gadget.property_dict.io_data_csv,
{
xlabel: '<span class="graph-label"><i class="fa fa-bar-chart"></i> IO RW Bytes</span>',
xlabel: '<span class="graph-label"><i class="fa fa-bar-chart"></i> IO RW KBytes/s</span>',
labelsDivStyles: { 'textAlign': 'right' },
legend: 'always',
visibility: [true, false, false],
......@@ -354,9 +387,9 @@
})
.push(function () {
return gadget.property_dict.graph_io_counter.render(
gadget.property_dict.io_data.data.join('\n'),
gadget.property_dict.io_data_csv,
{
xlabel: '<span class="graph-label"><i class="fa fa-bar-chart"></i> IO RW counter</span>',
xlabel: '<span class="graph-label"><i class="fa fa-bar-chart"></i> IO RW counter/1000</span>',
labelsDivStyles: { 'textAlign': 'right' },
legend: 'always',
visibility: [false, true, false],
......@@ -368,7 +401,7 @@
})
.push(function () {
return gadget.property_dict.graph_disk_used.render(
gadget.property_dict.io_data.data.join('\n'),
gadget.property_dict.io_data_csv,
{
xlabel: '<span class="graph-label"><i class="fa fa-pie-chart"></i> Disk Used (Mo)</span>',
labelsDivStyles: { 'textAlign': 'right' },
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.63263.62080.55091</string> </value>
<value> <string>951.26681.53491.34628</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463147612.98</float>
<float>1464099522.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -14,6 +14,6 @@
</head>
<body>
<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_sync.html" data-gadget-scope="sync_gadget" data-gadget-sandbox="public"></div>
</body>
</html>
\ No newline at end of file
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.31897.52316.17715</string> </value>
<value> <string>951.17777.16093.25088</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1455106483.86</float>
<float>1464184595.79</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -54,6 +54,13 @@
};
})
.ready(function (g) {
return g.getDeclaredGadget("sync_gadget")
.push(function (sync_gadget) {
g.props.sync_gadget = sync_gadget;
});
})
.declareMethod("getCommandUrlFor", function (options) {
var prefix = '',
result,
......@@ -112,14 +119,11 @@
return gadget.props.start_deferred.promise;
})
.push(function () {
return listenHashChange(gadget);
});
// set auto sync timer
return gadget.props.sync_gadget.startSync();
})
.allowPublicAcquisition("loginRedirect", function (param_list) {
return gadget.getDeclaredGadget('login_gadget')
.push(function (login_gadget) {
return login_gadget.loginRedirect.apply(login_gadget, param_list);
.push(function () {
return listenHashChange(gadget);
});
});
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>949.3559.49397.5563</string> </value>
<value> <string>951.28098.61294.47240</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1455107074.45</float>
<float>1464184505.26</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -130,7 +130,7 @@
<div class="overview-header">
<div class='content-title ui-instance-title'>
<div class="overview-title">
<i class="fa fa-link"></i><span>Monitoring Instances list</span>
<i class="fa fa-link"></i><span>Monitoring OPML List</span>
</div>
<div class="commands">
</div>
......@@ -175,11 +175,12 @@
<input type="radio" name="sync-data-timer" id="sync-data-1h" value="3600000">
<label for="sync-data-1h">1 h</label>
</fieldset>
<p>Last sync date: <span class="last-sync"></span></p>
<button class="ui-btn ui-corner-all ui-btn-inline sync-all"><i class="fa fa-download"></i> Sync Data Now</button>
</div>
<div class="padding-5">
<h2><strong>Access links:</strong></h2>
<a href="#page=hosting_overview">Access Applications</a>
<a href="#page=hosting_overview">Access Hosting Subscriptions</a>
<a href="#page=import_export">Export Settings</a>
</div>
</div>
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.21014.7809.37444</string> </value>
<value> <string>951.27941.44029.13363</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463759407.22</float>
<float>1464175062.51</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -18,6 +18,16 @@
return false;
}
function formatDate(d){
function addZero(n){
return n < 10 ? '0' + n : '' + n;
}
return d.getFullYear() + "-" + addZero(d.getMonth()+1)
+ "-" + addZero(d.getDate()) + " " + addZero(d.getHours())
+ ":" + addZero(d.getMinutes()) + ":" + addZero(d.getMinutes());
}
function setjIODAVConfiguration(gadget, options) {
var url = "",
//login_input = gadget.props.element.querySelector("input[name='dav_username']").value,
......@@ -98,7 +108,7 @@
enable_search: false,
disable_href: true,
column_list: [{
title: 'Title',
title: 'Instance',
select: 'title'
}, {
title: 'Hosting Subscription',
......@@ -237,7 +247,7 @@
}
).push(function(new_gadget) {
jio_gadget = new_gadget;
jio_gadget.createJio(jio_options);
jio_gadget.createJio(jio_options, false);
return jio_gadget.get('config');
})
.push(function (doc) {
......@@ -328,7 +338,7 @@
.declareMethod("render", function (options) {
var gadget = this;
return gadget.updateHeader({
title: "Configure monitoring instances URLs"/*,
title: "Configure monitoring Instances"/*,
back_url: "#page=main",
panel_action: false*/
})
......@@ -358,6 +368,16 @@
content = opml_url_template({opml_list: opml_list});
gadget.props.element.querySelector("#config-manage .opml-tablelinks > tbody")
.innerHTML = content;
return gadget.getSetting('latest_sync_time');
})
.push(function (latest_sync_time) {
if (latest_sync_time !== undefined) {
gadget.props.element.querySelector(".last-sync")
.innerHTML = formatDate(new Date(latest_sync_time));
} else {
gadget.props.element.querySelector(".last-sync")
.innerHTML = '--';
}
})
.push(function () {
if (!options.tab || options.tab !== 'manage') {
......@@ -478,6 +498,16 @@
.innerHTML = title;
gadget.props.element.querySelector('.sync-all')
.disabled = false;
return gadget.getSetting('latest_sync_time');
})
.push(function (latest_sync_time) {
if (latest_sync_time !== undefined) {
gadget.props.element.querySelector(".last-sync")
.innerHTML = formatDate(new Date(latest_sync_time));
} else {
gadget.props.element.querySelector(".last-sync")
.innerHTML = '--';
}
});
}
));
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.21015.25528.41881</string> </value>
<value> <string>951.27964.58076.47957</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463759548.44</float>
<float>1464176559.4</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -20,10 +20,6 @@
return gadget.getDeclaredGadget("listbox")
.push(function (listbox_gadget) {
gadget.property_dict.listbox = listbox_gadget;
return gadget.getSetting('monitoring_display_style');
})
.push(function (display_option) {
gadget.property_dict.display_option = display_option || 'list';
});
})
.declareMethod('render', function (options) {
......@@ -38,7 +34,7 @@
column_link: {select: 'source'},
column_id: {select: 'title'},
column_list: [{
title: 'Title',
title: 'Promise',
select: 'title'
}, {
title: 'Instance',
......@@ -47,11 +43,12 @@
title: 'Hosting Subscription',
select: 'reference'
}, {
select: 'date',
title: 'Date'
select: 'lastBuildDate',
title: 'Report Date',
convertDate: true
}, {
select: 'message',
title: 'Output',
title: 'Message',
css_class: 'text-overview'
}, {
select: 'category',
......@@ -65,13 +62,34 @@
],
query: {
select_list: ['title', 'siteTitle', 'reference', 'category',
'date', 'message', 'link', 'source'],
'date', 'message', 'link', 'source', 'lastBuildDate'],
query: '_id: (NOT "_replicate_%")',
sort_on: [["category", "ascending"]]
}
};
return gadget.updateHeader(header)
.push(function () {
if (!options.hasOwnProperty('search') || !options.hasOwnProperty('filter')) {
return gadget.getSetting('status_list_selection_key')
.push(function (selection) {
if (selection) {
return gadget.redirect({
page: 'status_list',
filter: options.filter || selection.filter,
search: options.search || selection.search
});
}
});
}
})
.push(function () {
var selection = {
filter: options.filter || '',
search: options.search || ''
};
return gadget.setSetting('status_list_selection_key', selection);
})
.push(function () {
if (options.root_title) {
return gadget.property_dict.jio_gadget.getFeedUrlList({
......@@ -99,13 +117,43 @@
}
}
listbox_configuration.storage_list = listbox_storage_list;
gadget.property_dict.options = options;
return gadget.property_dict.listbox.render(listbox_configuration);
});
})
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("renderApplication", "renderApplication")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs");
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareService(function () {
var gadget = this;
return gadget.getSetting('status_list_refresh_id')
.push(function (timer_id) {
var new_timer_id;
if (timer_id) {
clearTimeout(timer_id);
}
new_timer_id = setTimeout(function(){
var hash = window.location.toString().split('#')[1],
scroll_position,
doc = document.documentElement;
if (hash.indexOf('page=status_list') >= 0) {
scroll_position = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
return gadget.renderApplication({args: gadget.property_dict.options})
.push(function () {
$(document).scrollTop(scroll_position);
});
}
}, 120000);
return gadget.setSetting('status_list_refresh_id', new_timer_id);
});
});
}(window, rJS, $));
\ No newline at end of file
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.16713.3981.39628</string> </value>
<value> <string>951.28233.17496.1826</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463501364.68</float>
<float>1464193389.51</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -12,6 +12,7 @@
<script src="renderjs.js"></script>
<script src="gadget_monitoring_sync.js"></script>
<script src="notify.min.js"></script>
</head>
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.15435.34499.18483</string> </value>
<value> <string>951.15436.10786.58709</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1463424729.85</float>
<float>1464108182.16</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -29,6 +29,16 @@
monitor_cred_dict = {},
sync_lock = false;
function formatDate(d){
function addZero(n){
return n < 10 ? '0' + n : '' + n;
}
return d.getFullYear() + "-" + addZero(d.getMonth()+1)
+ "-" + addZero(d.getDate()) + " " + addZero(d.getHours())
+ ":" + addZero(d.getMinutes()) + ":" + addZero(d.getMinutes());
}
function syncStorage(gadget, storage_dict, query) {
gadget.props.jio_gadget.createJio(storage_dict, true, query);
return gadget.props.jio_gadget.repair()
......@@ -104,14 +114,29 @@
}
function syncAllStorage() {
var monitor_storage_list = [];
var monitor_storage_list = [],
last_sync_time;
if (sync_lock === true) {
return [];
}
if (options.now) {
sync_lock = true;
}
return gadget.props.login_gadget.getUrlDict()
return new RSVP.Queue()
.push(function () {
$(".notifyjs-wrapper").remove();
return $.notify(
"Synchronizing Data...",
{
position:"bottom right",
autoHide: false,
className: "info"
}
);
})
.push(function () {
return gadget.props.login_gadget.getUrlDict();
})
.push(function(url_dict) {
monitor_cred_dict = url_dict;
......@@ -131,15 +156,38 @@
return RSVP.all(promise_list);
})
.push(function () {
var sync_time = new Date().getTime();
last_sync_time = new Date().getTime();
sync_lock = false;
return gadget.setSetting('latest_sync_time', sync_time);
return gadget.setSetting('latest_sync_time', last_sync_time);
})
.push(function () {
$(".notifyjs-wrapper").remove();
return $.notify(
"Synchronisation finished.",
{
position:"bottom right",
autoHide: true,
className: "info",
autoHideDelay: 3000
}
);
})
.push(function () {
return $.notify(
"Last Sync: " + formatDate(new Date(last_sync_time)),
{
position:"bottom right",
autoHide: true,
className: "success",
autoHideDelay: 30000
}
);
});
}
function syncDataTimer() {
if (gadget.props.timer) {
clearInterval(gadget.props.timer);
clearTimeout(gadget.props.timer);
}
gadget.props.timer = setTimeout(function(){
return new RSVP.Queue()
......@@ -190,8 +238,8 @@
if (latest_sync_time !== undefined) {
time_diff = current_time - latest_sync_time;
if ((time_diff - 10000) >= gadget.props.timer_interval) {
// sync in after 5 second
gadget.props.timer_interval = 5000;
// sync in after 10 second
gadget.props.timer_interval = 10000;
} else {
gadget.props.timer_interval = gadget.props.timer_interval - time_diff;
}
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.20979.34222.27938</string> </value>
<value> <string>951.28202.20258.49390</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1463759827.91</float>
<float>1464194624.26</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -201,6 +201,16 @@
j,
k;
function formatDate(d){
function addZero(n){
return n < 10 ? '0' + n : '' + n;
}
return d.getFullYear() + "-" + addZero(d.getMonth()+1)
+ "-" + addZero(d.getDate()) + " " + addZero(d.getHours())
+ ":" + addZero(d.getMinutes()) + ":" + addZero(d.getMinutes());
}
gadget.property_dict.data_result = [];
// build handlebars object
for (k = 0; k < all_docs_result_list.length; k += 1) {
......@@ -212,6 +222,9 @@
cell_list = [];
for (i = 0, i_len = option_dict.column_list.length; i < i_len; i += 1) {
current_value = all_docs_result_list[k].data.rows[j].value[option_dict.column_list[i].select];
if (option_dict.column_list[i].convertDate) {
current_value = formatDate(new Date(current_value));
}
cell_list.push({
"href": (option_dict.disable_href) ? '' : link_list[k][j],
"value": current_value,
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.9258.8411.9847</string> </value>
<value> <string>951.28151.1724.37000</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463055528.9</float>
<float>1464187692.31</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -67,10 +67,10 @@
<div class='content-title ui-instance-title'>
<div class="overview-title">
<i class="fa fa-cubes"></i><span>
{{title}}
{{#if root_title}}
&nbsp; [{{root_title}}]
{{root_title}} >&nbsp;
{{/if}}
{{title}}
</span>
</div>
<div class="commands">
......@@ -80,16 +80,16 @@
</div>
<div class="content-details">
<div class="ui-text-left" style="padding-bottom: 15px;">
<h2><i class="fa fa-info-circle"></i> <strong>Instance Current State</strong></h2>
<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"><i class="fa fa-pie-chart"></i> Resources</a>
<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"><i class="fa fa-list-alt"></i> Processes</a>
<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>
......@@ -99,7 +99,7 @@
<!--<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="Private"><i class="fa fa-lock"></i> Private</a>
<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>
......@@ -111,19 +111,24 @@
<tr>
<th><i class="fa fa-tachometer"></i> <strong>Status</strong></th>
<td><span class="label label-{{status}}">{{status}}</span></td>
<td>{{date}}</td>
<td title="Report Date">{{date}}</td>
</tr>
{{#with instance}}
<tr>
<th><i class="fa fa-desktop"></i> <strong>Computer</strong></th>
<td>{{computer}}</td>
<td>{{partition}}</td>
<td title="Computer Reference">{{computer}}</td>
<td title="Partition Reference">{{partition}}</td>
</tr>
<tr>
<th><i class="fa fa-globe"></i> <strong>IP Address</strong></th>
<td>{{ipv4}}</td>
<td>{{ipv6}}</td>
<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>
......@@ -134,11 +139,11 @@
<script id="promiselist-widget-template" type="text/x-handlebars-template">
{{#if promise_list}}
<h2><i class="fa fa-th-list"></i> <strong>Instance Promise List</strong></h2>
<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>
<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>
......@@ -180,7 +185,7 @@
<div class="overview-header">
<div class='content-title ui-instance-title'>
<div class="overview-title">
<i class="fa fa-desktop"></i><span>Instances Status Overview</span>
<i class="fa fa-desktop"></i><span>Software Instances List</span>
</div>
<div class="commands">
</div>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.7643.51909.61422</string> </value>
<value> <string>951.27817.37423.50688</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>1462957858.82</float>
<float>1464168027.07</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -205,7 +205,7 @@
}*/
return RSVP.all([
row_list,
[{title: 'Status'}, {title: 'Instance'}, {title: 'Root Instance'}]
[{title: 'Status'}, {title: 'Instance'}, {title: 'Hosting Subscription'}]
]);
})
.push(function (result_list) {
......@@ -320,7 +320,7 @@
return gadget.property_dict.graph.render(
data,
{
ylabel: '<span class="graph-label"><i class="fa fa-bar-chart"></i> Promises Result</span>',
xlabel: '<span class="graph-label"><i class="fa fa-bar-chart"></i> Promises Success/Failure Result</span>',
legend: 'always',
labelsDivStyles: { 'textAlign': 'right' }
},
......@@ -366,7 +366,8 @@
}
}
promise_content = promise_list_template({
promise_list: promise_list
promise_list: promise_list,
date: current_document.date
});
$(element.querySelector('td:first-child > a')).addClass('selected');
gadget.property_dict.element.querySelector(".overview-details")
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.10827.14939.1501</string> </value>
<value> <string>951.26805.9745.42530</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1463501917.46</float>
<float>1464168098.17</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -416,7 +416,7 @@
</item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'none\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' mail.tiolive.com data: *.host.vifib.net; script-src \'self\' \'unsafe-eval\'; font-src netdna.bootstrapcdn.com; style-src \'self\' netdna.bootstrapcdn.com \'unsafe-inline\' data:; frame-src \'self\' data:</string> </value>
<value> <string>default-src \'none\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' mail.tiolive.com data: *; script-src \'self\' \'unsafe-eval\'; font-src netdna.bootstrapcdn.com; style-src \'self\' netdna.bootstrapcdn.com \'unsafe-inline\' data:; frame-src \'self\' data:</string> </value>
</item>
<item>
<key> <string>configuration_default_view_action_reference</string> </key>
......@@ -755,7 +755,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.28816.4646.59630</string> </value>
<value> <string>950.63263.62080.55091</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -773,7 +773,7 @@
</tuple>
<state>
<tuple>
<float>1460382495.34</float>
<float>1464081494.16</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -4,6 +4,7 @@ web_site_module/monitoring_render_js/**
web_page_module/gadget_erp5_graph_*
web_page_module/jio_dev_rssfeed_storage_js
web_page_module/chart_min_js
web_page_module/Notify_min_js
web_page_module/jquery.magnific-popup.min.js
web_page_module/magnific-popup.css
web_page_module/jsen_json_validator_js
......
......@@ -4,6 +4,7 @@ web_site_module/monitoring_render_js/**
web_page_module/gadget_erp5_graph_*
web_page_module/jio_dev_rssfeed_storage_js
web_page_module/chart_min_js
web_page_module/Notify_min_js
web_page_module/jquery.magnific-popup.min.js
web_page_module/magnific-popup.css
web_page_module/jsen_json_validator_js
......
web_page_module/Notify_min_js
web_page_module/chart_min_js
web_page_module/gadget_erp5_graph_*
web_page_module/gadget_monitoring_*
......
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