Commit 0aef70a5 authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_monitoring: Change status of instance to WARNING if cannot sync data

parent b2b8c1e9
...@@ -93,6 +93,10 @@ html.ui-mobile .ui-grid-container.ui-responsive > ul > li, html.ui-mobile .ui-gr ...@@ -93,6 +93,10 @@ html.ui-mobile .ui-grid-container.ui-responsive > ul > li, html.ui-mobile .ui-gr
.ui-text-OK, .ui-text-ok { .ui-text-OK, .ui-text-ok {
color: green; color: green;
} }
.ui-text-WARNING, .ui-text-warning {
color: #cea813;
text-shadow: 1px 0px 0px rgb(224, 224, 116);
}
.ui-text-desabled { .ui-text-desabled {
color: rgba(128, 128, 128, 0.66); color: rgba(128, 128, 128, 0.66);
...@@ -293,7 +297,7 @@ html head + body .ui-panel-overview > h2 { ...@@ -293,7 +297,7 @@ html head + body .ui-panel-overview > h2 {
background: #DC4343; background: #DC4343;
} }
.ui-status-warning:before, .ui-status-WARNING:before { .ui-status-warning:before, .ui-status-WARNING:before {
background: #faebcc; background: #f0ad4e;
} }
.status-text-ok:before, .status-text-OK:before { .status-text-ok:before, .status-text-OK:before {
color: green; color: green;
...@@ -302,7 +306,7 @@ html head + body .ui-panel-overview > h2 { ...@@ -302,7 +306,7 @@ html head + body .ui-panel-overview > h2 {
color: #DC4343; color: #DC4343;
} }
.status-text-warning:before, .status-text-WARNING:before { .status-text-warning:before, .status-text-WARNING:before {
color: #faebcc; color: #f0ad4e;
} }
.label-warning, .label-WARNING { .label-warning, .label-WARNING {
...@@ -507,7 +511,7 @@ html .custom-grid-wrap table thead tr th { ...@@ -507,7 +511,7 @@ html .custom-grid-wrap table thead tr th {
font-weight: normal; font-weight: normal;
} }
.hosting-block { .hosting-block, .content-medium {
width: 80%; width: 80%;
} }
...@@ -916,7 +920,7 @@ html body div.loadbox .loadwait > a { ...@@ -916,7 +920,7 @@ html body div.loadbox .loadwait > a {
.graph-full { .graph-full {
margin: 0 10px; margin: 0 10px;
} }
.hosting-block { .hosting-block, .content-medium {
width: 100%; 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 {
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.27190.36100.52957</string> </value> <value> <string>952.63103.15334.28893</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>1467987759.33</float> <float>1470133968.93</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
.declareAcquiredMethod("getSetting", "getSetting") .declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting") .declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("renderApplication", "renderApplication")
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this, var gadget = this,
opml_tmp_key_list, opml_tmp_key_list,
...@@ -213,7 +214,39 @@ ...@@ -213,7 +214,39 @@
.declareService(function () { .declareService(function () {
var gadget = this; var gadget = this,
current_sync_date;
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) {
var new_timer_id;
if (timer_id) {
clearInterval(timer_id);
}
new_timer_id = setInterval(function(){
var hash = window.location.toString().split('#')[1],
scroll_position,
doc = document.documentElement;
if (hash.indexOf('page=hosting_subscription_list') >= 0) {
return gadget.getSetting('latest_sync_time')
.push(function (sync_time) {
if (sync_time > current_sync_date) {
scroll_position = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
current_sync_date = sync_time;
return gadget.renderApplication({args: gadget.props.options})
.push(function () {
$(document).scrollTop(scroll_position);
});
}
});
}
}, 60000);
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>952.44518.58996.28689</string> </value> <value> <string>952.63323.60264.39816</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>1469016261.62</float> <float>1470144009.09</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -83,6 +83,9 @@ ...@@ -83,6 +83,9 @@
</tr> </tr>
{{/with}} {{/with}}
</table> </table>
{{#if warning}}
<p class="ui-text-error"><i class="fa fa-info-circle" aria-hidden="true"></i> Status was changed to WARNING as last sync of this instance failed.</p>
{{/if}}
</fieldset> </fieldset>
</div> </div>
</li> </li>
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.2622.43851.41915</string> </value> <value> <string>952.63310.6946.47035</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1466588186.09</float> <float>1470143285.47</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -80,7 +80,8 @@ ...@@ -80,7 +80,8 @@
private_url: monitor_dict._links.hasOwnProperty('private_url') ? monitor_dict._links.private_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 : '', rss_url: monitor_dict._links.hasOwnProperty('rss_url') ? monitor_dict._links.rss_url.href : '',
resource_url: tmp_url, resource_url: tmp_url,
process_url: tmp_process_url process_url: tmp_process_url,
warning: (monitor_dict.status.toUpperCase() === "WARNING") ? true : false
}; };
return instance_dict; return instance_dict;
} }
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.2606.28566.7014</string> </value> <value> <string>952.12669.21894.52428</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1467190880.03</float> <float>1470143020.16</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.27460.59642.13687</string> </value> <value> <string>952.63450.59087.19609</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -253,7 +253,7 @@ ...@@ -253,7 +253,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1467993818.78</float> <float>1470151746.42</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
<script id="promise-widget-template" type="text/x-handlebars-template"> <script id="promise-widget-template" type="text/x-handlebars-template">
{{#with element}} {{#with element}}
{{#if warning}}
<p class="ui-text-error"><i class="fa fa-info-circle" aria-hidden="true"></i> Status was changed to WARNING as last sync of this instance failed.</p>
{{/if}}
<table data-role="table" data-mode="columntoggle" class="table-stroke"> <table data-role="table" data-mode="columntoggle" class="table-stroke">
<tr> <tr>
<th><i class="fa fa-tachometer"></i> Status</th> <th><i class="fa fa-tachometer"></i> Status</th>
...@@ -48,7 +51,7 @@ ...@@ -48,7 +51,7 @@
</script> </script>
<script id="pinstance-widget-template" type="text/x-handlebars-template"> <script id="pinstance-widget-template" type="text/x-handlebars-template">
<h2><i class="fa fa-cubes"></i><strong> Software Instance Overview</strong></h2> <h2><i class="fa fa-area-chart" aria-hidden="true"></i><strong> Resources Usage</strong></h2>
<div class="ui-field-contain"> <div class="ui-field-contain">
<fieldset data-role="controlgroup" data-type="horizontal"> <fieldset data-role="controlgroup" data-type="horizontal">
{{#if resource_url }} {{#if resource_url }}
...@@ -59,18 +62,18 @@ ...@@ -59,18 +62,18 @@
{{/if}} {{/if}}
</fieldset> </fieldset>
</div> </div>
<h2>Software Instance status</h2> <h2><i class="fa fa-cubes"></i><strong> Software Instance Overview</strong></h2>
<table data-role="table" data-mode="columntoggle" class="table-stroke"> <table data-role="table" data-mode="columntoggle" class="table-stroke">
<tr title="Hosting Subscription"> <tr title="Hosting Subscription">
<th><i class="fa fa-puzzle-piece"></i> H. Subscription</th> <th><i class="fa fa-puzzle-piece"></i> H. Subscription</th>
<td title="Hosting Subscription title">{{root_title}}</td> <td title="Hosting Subscription title">{{root_title}}</td>
</tr> </tr>
<tr> <tr>
<th><i class="fa fa-cube"></i> Instance</th> <th><i class="fa fa-cube"></i> Instance Name</th>
<td title="Software Instance title">{{title}}</td> <td title="Software Instance title">{{title}}</td>
</tr> </tr>
<tr> <tr>
<th><i class="fa fa-tachometer"></i> Status</th> <th><i class="fa fa-tachometer"></i> Instance Status</th>
<td><span class="label label-{{status}}">{{status}}</span></td> <td><span class="label label-{{status}}">{{status}}</span></td>
</tr> </tr>
<tr> <tr>
......
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.41717.43788.11008</string> </value> <value> <string>952.63137.49260.64000</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>1468847455.64</float> <float>1470132847.51</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -124,7 +124,8 @@ ...@@ -124,7 +124,8 @@
instance: feed.siteTitle, instance: feed.siteTitle,
public_url: feed.sourceUrl, public_url: feed.sourceUrl,
message: feed.comments, message: feed.comments,
type: 'status' type: 'status',
warning: (feed.category === "WARNING") ? true : false
}; };
gadget.property_dict.promise_dict = element; gadget.property_dict.promise_dict = element;
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.41708.59200.61013</string> </value> <value> <string>952.63405.63756.16076</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>1468846875.97</float> <float>1470148845.94</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -124,8 +124,7 @@ ...@@ -124,8 +124,7 @@
</article> </article>
</div> </div>
<div id="config-manage"> <div id="config-manage">
<div class="ui-grid-a ui-responsive custom-listbox"> <div class="ui-responsive content-medium">
<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'>
...@@ -144,7 +143,7 @@ ...@@ -144,7 +143,7 @@
<tr> <tr>
<th class="padding-10"><input type="checkbox" name="opml-all" value="all"></th> <th class="padding-10"><input type="checkbox" name="opml-all" value="all"></th>
<th>OPML URL</th> <th>OPML URL</th>
<th>Title</th> <th>Hosting Subscription Name</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -185,16 +184,14 @@ ...@@ -185,16 +184,14 @@
</div> </div>
<div class="padding-5"> <div class="padding-5">
<h2><strong>Access links:</strong></h2> <h2><strong>Access links:</strong></h2>
<a href="#page=hosting_subscription_list">Access Hosting Subscriptions</a> <a href="#page=hosting_subscription_list" class="ui-btn ui-corner-all ui-btn-inline ui-mini" title="Access Hosting Subscriptions">
<a href="#page=import_export">Export Settings</a> <i class="fa fa-tachometer" aria-hidden="true"></i> Applications Monitoring</a>
<a href="#page=import_export" class="ui-btn ui-corner-all ui-btn-inline ui-mini" title="Export Settings">
<i class="fa fa-location-arrow" aria-hidden="true"></i> Export Settings</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="ui-block-b">
</div>
</div>
</div> </div>
</div> </div>
</body> </body>
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.47292.33739.26555</string> </value> <value> <string>953.429.29685.31488</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>1469181889.59</float> <float>1470386058.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -48,12 +48,52 @@ ...@@ -48,12 +48,52 @@
} }
}; };
gadget.property_dict.options = options;
return gadget.updateHeader(header) return gadget.updateHeader(header)
.push(function () { .push(function () {
return gadget.property_dict.listview.render(listview_options); return gadget.property_dict.listview.render(listview_options);
}); });
}) })
.declareAcquiredMethod("updateHeader", "updateHeader"); .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("renderApplication", "renderApplication")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareService(function () {
var gadget = this,
current_sync_date;
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) {
var new_timer_id;
if (timer_id) {
clearInterval(timer_id);
}
new_timer_id = setInterval(function(){
var hash = window.location.toString().split('#')[1],
scroll_position,
doc = document.documentElement;
if (hash.indexOf('page=software_instance_list') >= 0) {
return gadget.getSetting('latest_sync_time')
.push(function (sync_time) {
if (sync_time > current_sync_date) {
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);
});
}
});
}
}, 60000);
return gadget.setSetting('status_list_refresh_id', new_timer_id);
});
});
}(window, rJS, $)); }(window, rJS, $));
\ No newline at end of file
...@@ -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.29297.41836.68</string> </value> <value> <string>952.63337.55665.62668</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>1464256864.93</float> <float>1470144630.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -55,6 +55,9 @@ ...@@ -55,6 +55,9 @@
</div> </div>
<div class="ui-grid-a ui-responsive"> <div class="ui-grid-a ui-responsive">
{{#if warning}}
<p class="ui-text-error"><i class="fa fa-info-circle" aria-hidden="true"></i> Status was changed to WARNING as last sync of this instance failed.</p>
{{/if}}
{{#with instance}} {{#with instance}}
<div class="ui-block-a"> <div class="ui-block-a">
<table data-role="table" data-mode="columntoggle" class="table-stroke"> <table data-role="table" data-mode="columntoggle" class="table-stroke">
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.2645.30987.35874</string> </value> <value> <string>952.63149.38315.18602</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1467987678.83</float> <float>1470133520.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -135,7 +135,8 @@ ...@@ -135,7 +135,8 @@
private_url: current_document._links.hasOwnProperty('private_url') ? current_document._links.private_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 : '', rss_url: current_document._links.hasOwnProperty('rss_url') ? current_document._links.rss_url.href : '',
resource_url: tmp_url, resource_url: tmp_url,
process_url: tmp_process_url process_url: tmp_process_url,
warning: (current_document.status.toUpperCase() === "WARNING") ? true : false
}); });
if (current_document._embedded.promises !== undefined) { if (current_document._embedded.promises !== undefined) {
...@@ -144,6 +145,9 @@ ...@@ -144,6 +145,9 @@
promise_list[i].href = "#page=view&jio_key=false&jio_name=" + promise_list[i].href = "#page=view&jio_key=false&jio_name=" +
promise_list[i].title + "&jio_for=" + promise_list[i].title + "&jio_for=" +
current_document._links.rss_url.href; current_document._links.rss_url.href;
if (current_document.status === "WARNING") {
promise_list[i].status = current_document.status;
}
} }
} }
promise_content = promise_list_template({ promise_content = promise_list_template({
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.27413.56408.50005</string> </value> <value> <string>952.63151.36187.19404</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1467989745.98</float> <float>1470385950.65</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
title: 'Promise', title: 'Promise',
select: 'source' select: 'source'
}, { }, {
title: 'Instance', title: 'Software Instance',
select: 'siteTitle' select: 'siteTitle'
}, { }, {
title: 'Hosting Subscription', title: 'Hosting Subscription',
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.27207.37497.31300</string> </value> <value> <string>952.61937.37298.23210</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>1467976809.38</float> <float>1470144737.52</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -79,6 +79,55 @@ ...@@ -79,6 +79,55 @@
}); });
} }
function updateStatus(gadget, storage_dict, status) {
var promise_list = [],
jio_gadget,
i;
return gadget.declareGadget("gadget_monitoring_jio.html")
.push(function (jio_declared_gadget) {
jio_gadget = jio_declared_gadget;
jio_gadget.createJio(storage_dict);
return jio_gadget.allDocs({include_docs: true});
})
.push(undefined, function (error) {
console.log(error);
return {
data: {
total_rows: 0
}
};
})
.push(function (jio_docs) {
var tmp;
for (i = 0; i < jio_docs.data.total_rows; i += 1) {
if (jio_docs.data.rows[i].id.startsWith('_replicate_')) {
continue;
}
tmp = jio_docs.data.rows[i].doc;
if (storage_dict.storage_type === "rss") {
if (tmp.category === "WARNING") {
continue;
}
tmp.category = "WARNING";
} else if (storage_dict.storage_type === "webdav") {
if (tmp.status === "WARNING") {
continue;
}
tmp.status = "WARNING";
}
promise_list.push(jio_gadget.put(
jio_docs.data.rows[i].id,
tmp
));
}
return RSVP.all(promise_list);
})
.push(undefined, function (error) {
console.log("ERROR: update status to WARNING");
console.log(error);
});
}
function getMonitoringStorageList (feed_url_list) { function getMonitoringStorageList (feed_url_list) {
var base_url, var base_url,
base_url_hash, base_url_hash,
...@@ -118,6 +167,7 @@ ...@@ -118,6 +167,7 @@
// put Monitor instance name, usefull to track error // put Monitor instance name, usefull to track error
feed_config.title = feed_url_list[i].title; feed_config.title = feed_url_list[i].title;
feed_config.hosting = feed_url_list[i].opml_title; feed_config.hosting = feed_url_list[i].opml_title;
feed_config.storage_type = "rss";
monitor_storage_list.push({ monitor_storage_list.push({
storage: feed_config, storage: feed_config,
...@@ -137,13 +187,14 @@ ...@@ -137,13 +187,14 @@
if (monitor_cred_dict.hasOwnProperty(base_url_hash)) { if (monitor_cred_dict.hasOwnProperty(base_url_hash)) {
dav_config.sub_storage.sub_storage.basic_login = monitor_cred_dict[base_url_hash].hash; dav_config.sub_storage.sub_storage.basic_login = monitor_cred_dict[base_url_hash].hash;
} else { } else {
console.log("skipping " + dav_config.sub_storage.sub_storage.url + " ..."); console.log("NotFound: skipping " + dav_config.sub_storage.sub_storage.url + " ...");
continue; continue;
} }
} }
// put Monitor instance name, usefull to track error // put Monitor instance name, usefull to track error
dav_config.title = feed_url_list[i].title; dav_config.title = feed_url_list[i].title;
dav_config.hosting = feed_url_list[i].opml_title; dav_config.hosting = feed_url_list[i].opml_title;
dav_config.storage_type = "webdav";
monitor_storage_list.push({ monitor_storage_list.push({
storage: dav_config, storage: dav_config,
...@@ -267,7 +318,7 @@ ...@@ -267,7 +318,7 @@
message = log_title + "\nYou can retry with manual sync."; message = log_title + "\nYou can retry with manual sync.";
} }
$(".notifyjs-wrapper").remove(); $(".notifyjs-wrapper").remove();
return new RSVP.all([$.notify( return RSVP.all([$.notify(
message, message,
{ {
position:"bottom right", position:"bottom right",
...@@ -283,6 +334,19 @@ ...@@ -283,6 +334,19 @@
method: 'Monitoring Sync' method: 'Monitoring Sync'
})]); })]);
}) })
.push(function () {
var promise_list = [],
i;
// Update all failures monitoring status to Warning
for (i = 0; i < gadget.props.error_list.length; i += 1) {
promise_list.push(updateStatus(
gadget,
gadget.props.error_list[i].storage_dict,
'WARNING'
));
}
return RSVP.all(promise_list);
})
.push(function () { .push(function () {
return $.notify( return $.notify(
"Last Sync: " + formatDate(new Date(last_sync_time)), "Last Sync: " + formatDate(new Date(last_sync_time)),
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.44569.39820.59136</string> </value> <value> <string>952.63467.50835.57446</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1469018537.19</float> <float>1470152500.12</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -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.47458.38099.21964</string> </value> <value> <string>952.61801.40672.26333</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>1453808948.37</float> <float>1470385580.67</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -33,6 +33,16 @@ ...@@ -33,6 +33,16 @@
}); });
} }
var formatDate = function(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.getSeconds());
};
gadget_klass gadget_klass
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -201,15 +211,6 @@ ...@@ -201,15 +211,6 @@
j, j,
k; 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.getSeconds());
}
gadget.property_dict.data_result = []; gadget.property_dict.data_result = [];
// build handlebars object // build handlebars object
......
...@@ -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.28152.13474.61457</string> </value> <value> <string>953.1817.61265.49698</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>1468600739.56</float> <float>1470386082.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.44539.57216.52360</string> </value> <value> <string>952.44540.700.10871</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>1469016720.58</float> <float>1470065840.68</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