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
.ui-text-OK, .ui-text-ok {
color: green;
}
.ui-text-WARNING, .ui-text-warning {
color: #cea813;
text-shadow: 1px 0px 0px rgb(224, 224, 116);
}
.ui-text-desabled {
color: rgba(128, 128, 128, 0.66);
......@@ -293,7 +297,7 @@ html head + body .ui-panel-overview > h2 {
background: #DC4343;
}
.ui-status-warning:before, .ui-status-WARNING:before {
background: #faebcc;
background: #f0ad4e;
}
.status-text-ok:before, .status-text-OK:before {
color: green;
......@@ -302,7 +306,7 @@ html head + body .ui-panel-overview > h2 {
color: #DC4343;
}
.status-text-warning:before, .status-text-WARNING:before {
color: #faebcc;
color: #f0ad4e;
}
.label-warning, .label-WARNING {
......@@ -507,7 +511,7 @@ html .custom-grid-wrap table thead tr th {
font-weight: normal;
}
.hosting-block {
.hosting-block, .content-medium {
width: 80%;
}
......@@ -916,7 +920,7 @@ html body div.loadbox .loadwait > a {
.graph-full {
margin: 0 10px;
}
.hosting-block {
.hosting-block, .content-medium {
width: 100%;
}
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 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.27190.36100.52957</string> </value>
<value> <string>952.63103.15334.28893</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1467987759.33</float>
<float>1470133968.93</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -84,6 +84,7 @@
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("renderApplication", "renderApplication")
.declareMethod("render", function (options) {
var gadget = this,
opml_tmp_key_list,
......@@ -213,7 +214,39 @@
.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 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.44518.58996.28689</string> </value>
<value> <string>952.63323.60264.39816</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1469016261.62</float>
<float>1470144009.09</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -83,6 +83,9 @@
</tr>
{{/with}}
</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>
</div>
</li>
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.2622.43851.41915</string> </value>
<value> <string>952.63310.6946.47035</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1466588186.09</float>
<float>1470143285.47</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -80,7 +80,8 @@
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
process_url: tmp_process_url,
warning: (monitor_dict.status.toUpperCase() === "WARNING") ? true : false
};
return instance_dict;
}
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.2606.28566.7014</string> </value>
<value> <string>952.12669.21894.52428</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1467190880.03</float>
<float>1470143020.16</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -235,7 +235,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.27460.59642.13687</string> </value>
<value> <string>952.63450.59087.19609</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -253,7 +253,7 @@
</tuple>
<state>
<tuple>
<float>1467993818.78</float>
<float>1470151746.42</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -15,6 +15,9 @@
<script id="promise-widget-template" type="text/x-handlebars-template">
{{#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">
<tr>
<th><i class="fa fa-tachometer"></i> Status</th>
......@@ -48,7 +51,7 @@
</script>
<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">
<fieldset data-role="controlgroup" data-type="horizontal">
{{#if resource_url }}
......@@ -59,18 +62,18 @@
{{/if}}
</fieldset>
</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">
<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>
<th><i class="fa fa-cube"></i> Instance Name</th>
<td title="Software Instance title">{{title}}</td>
</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>
</tr>
<tr>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.41717.43788.11008</string> </value>
<value> <string>952.63137.49260.64000</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>1468847455.64</float>
<float>1470132847.51</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -124,7 +124,8 @@
instance: feed.siteTitle,
public_url: feed.sourceUrl,
message: feed.comments,
type: 'status'
type: 'status',
warning: (feed.category === "WARNING") ? true : false
};
gadget.property_dict.promise_dict = element;
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.41708.59200.61013</string> </value>
<value> <string>952.63405.63756.16076</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1468846875.97</float>
<float>1470148845.94</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -124,75 +124,72 @@
</article>
</div>
<div id="config-manage">
<div class="ui-grid-a ui-responsive custom-listbox">
<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-link"></i><span>Monitoring OPML List</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 opml-tablelinks">
<thead class="ui-bar-inherit">
<tr>
<th class="padding-10"><input type="checkbox" name="opml-all" value="all"></th>
<th>OPML URL</th>
<th>Title</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="ui-bar-inherit"></tfoot>
</table>
<div class="ui-responsive content-medium">
<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-link"></i><span>Monitoring OPML List</span>
</div>
<div class="padding-10 msgtext-box"></div>
<div class="">
<a href="#" class="ui-btn ui-corner-all ui-btn-inline opml-delete"><i class="fa fa-trash"></i> Delete Selection</a>
<a href="#" class="ui-btn ui-corner-all ui-btn-inline opml-test"><i class="fa fa-check-square-o"></i> Availability Test</a>
<span class="ui-content-hidden padding-10 loadspinner">
<i class="fa fa-spinner fa-2x fa-spin"></i>
</span>
</div>
<div class="padding-5">
<fieldset class="sync-interval-controlgroup" data-role="controlgroup" data-type="horizontal">
<legend><strong>Auto Sync Interval:</strong></legend>
<input type="radio" name="sync-data-timer" id="sync-data-5m" value="300000" checked="checked">
<label for="sync-data-5m">5 min</label>
<input type="radio" name="sync-data-timer" id="sync-data-10m" value="600000">
<label for="sync-data-10m">10 min</label>
<input type="radio" name="sync-data-timer" id="sync-data-20m" value="1200000">
<label for="sync-data-20m">20 min</label>
<input type="radio" name="sync-data-timer" id="sync-data-30m" value="1800000">
<label for="sync-data-30m">30 min</label>
<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>
<h2><strong>Manual Sync:</strong></h2>
<button class="ui-btn ui-corner-all ui-btn-inline sync-all"><i class="fa fa-download"></i> Sync Data Now</button>
<p style="margin: 0; font-style: italic;" class="ui-text-ERROR">
<i class="fa fa-info" aria-hidden="true"></i>
If you just registered a new monitor, you can sync data now!
</p>
</div>
<div class="padding-5">
<h2><strong>Access links:</strong></h2>
<a href="#page=hosting_subscription_list">Access Hosting Subscriptions</a>
<a href="#page=import_export">Export Settings</a>
<div class="commands">
</div>
</div>
</div>
</div>
<div class="ui-block-b">
<div class="overview-content">
<div class="ui-listview-container">
<table class="ui-responsive ui-body-c ui-table-inset opml-tablelinks">
<thead class="ui-bar-inherit">
<tr>
<th class="padding-10"><input type="checkbox" name="opml-all" value="all"></th>
<th>OPML URL</th>
<th>Hosting Subscription Name</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot class="ui-bar-inherit"></tfoot>
</table>
</div>
<div class="padding-10 msgtext-box"></div>
<div class="">
<a href="#" class="ui-btn ui-corner-all ui-btn-inline opml-delete"><i class="fa fa-trash"></i> Delete Selection</a>
<a href="#" class="ui-btn ui-corner-all ui-btn-inline opml-test"><i class="fa fa-check-square-o"></i> Availability Test</a>
<span class="ui-content-hidden padding-10 loadspinner">
<i class="fa fa-spinner fa-2x fa-spin"></i>
</span>
</div>
<div class="padding-5">
<fieldset class="sync-interval-controlgroup" data-role="controlgroup" data-type="horizontal">
<legend><strong>Auto Sync Interval:</strong></legend>
<input type="radio" name="sync-data-timer" id="sync-data-5m" value="300000" checked="checked">
<label for="sync-data-5m">5 min</label>
<input type="radio" name="sync-data-timer" id="sync-data-10m" value="600000">
<label for="sync-data-10m">10 min</label>
<input type="radio" name="sync-data-timer" id="sync-data-20m" value="1200000">
<label for="sync-data-20m">20 min</label>
<input type="radio" name="sync-data-timer" id="sync-data-30m" value="1800000">
<label for="sync-data-30m">30 min</label>
<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>
<h2><strong>Manual Sync:</strong></h2>
<button class="ui-btn ui-corner-all ui-btn-inline sync-all"><i class="fa fa-download"></i> Sync Data Now</button>
<p style="margin: 0; font-style: italic;" class="ui-text-ERROR">
<i class="fa fa-info" aria-hidden="true"></i>
If you just registered a new monitor, you can sync data now!
</p>
</div>
<div class="padding-5">
<h2><strong>Access links:</strong></h2>
<a href="#page=hosting_subscription_list" class="ui-btn ui-corner-all ui-btn-inline ui-mini" title="Access Hosting Subscriptions">
<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>
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.47292.33739.26555</string> </value>
<value> <string>953.429.29685.31488</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1469181889.59</float>
<float>1470386058.3</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -48,12 +48,52 @@
}
};
gadget.property_dict.options = options;
return gadget.updateHeader(header)
.push(function () {
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, $));
\ No newline at end of file
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.29297.41836.68</string> </value>
<value> <string>952.63337.55665.62668</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1464256864.93</float>
<float>1470144630.71</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -55,6 +55,9 @@
</div>
<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}}
<div class="ui-block-a">
<table data-role="table" data-mode="columntoggle" class="table-stroke">
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.2645.30987.35874</string> </value>
<value> <string>952.63149.38315.18602</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1467987678.83</float>
<float>1470133520.45</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -135,7 +135,8 @@
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
process_url: tmp_process_url,
warning: (current_document.status.toUpperCase() === "WARNING") ? true : false
});
if (current_document._embedded.promises !== undefined) {
......@@ -144,6 +145,9 @@
promise_list[i].href = "#page=view&jio_key=false&jio_name=" +
promise_list[i].title + "&jio_for=" +
current_document._links.rss_url.href;
if (current_document.status === "WARNING") {
promise_list[i].status = current_document.status;
}
}
}
promise_content = promise_list_template({
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.27413.56408.50005</string> </value>
<value> <string>952.63151.36187.19404</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1467989745.98</float>
<float>1470385950.65</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -37,7 +37,7 @@
title: 'Promise',
select: 'source'
}, {
title: 'Instance',
title: 'Software Instance',
select: 'siteTitle'
}, {
title: 'Hosting Subscription',
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.27207.37497.31300</string> </value>
<value> <string>952.61937.37298.23210</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1467976809.38</float>
<float>1470144737.52</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -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) {
var base_url,
base_url_hash,
......@@ -118,6 +167,7 @@
// put Monitor instance name, usefull to track error
feed_config.title = feed_url_list[i].title;
feed_config.hosting = feed_url_list[i].opml_title;
feed_config.storage_type = "rss";
monitor_storage_list.push({
storage: feed_config,
......@@ -137,13 +187,14 @@
if (monitor_cred_dict.hasOwnProperty(base_url_hash)) {
dav_config.sub_storage.sub_storage.basic_login = monitor_cred_dict[base_url_hash].hash;
} else {
console.log("skipping " + dav_config.sub_storage.sub_storage.url + " ...");
console.log("NotFound: skipping " + dav_config.sub_storage.sub_storage.url + " ...");
continue;
}
}
// put Monitor instance name, usefull to track error
dav_config.title = feed_url_list[i].title;
dav_config.hosting = feed_url_list[i].opml_title;
dav_config.storage_type = "webdav";
monitor_storage_list.push({
storage: dav_config,
......@@ -267,7 +318,7 @@
message = log_title + "\nYou can retry with manual sync.";
}
$(".notifyjs-wrapper").remove();
return new RSVP.all([$.notify(
return RSVP.all([$.notify(
message,
{
position:"bottom right",
......@@ -283,6 +334,19 @@
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 () {
return $.notify(
"Last Sync: " + formatDate(new Date(last_sync_time)),
......@@ -295,7 +359,7 @@
);
});
}
function syncDataTimer() {
if (gadget.props.timer) {
clearTimeout(gadget.props.timer);
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.44569.39820.59136</string> </value>
<value> <string>952.63467.50835.57446</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1469018537.19</float>
<float>1470152500.12</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.47458.38099.21964</string> </value>
<value> <string>952.61801.40672.26333</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>1453808948.37</float>
<float>1470385580.67</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -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
/////////////////////////////////////////////////////////////////
......@@ -201,15 +211,6 @@
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.getSeconds());
}
gadget.property_dict.data_result = [];
// build handlebars object
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.28152.13474.61457</string> </value>
<value> <string>953.1817.61265.49698</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1468600739.56</float>
<float>1470386082.24</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.44539.57216.52360</string> </value>
<value> <string>952.44540.700.10871</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1469016720.58</float>
<float>1470065840.68</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment