Commit 881a4d0d authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_monitoring: fix default sync time interval, sort hosting subscription...

slapos_monitoring: fix default sync time interval, sort hosting subscription and instance list by title
parent 9c706148
......@@ -107,7 +107,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Fri, 01 July 2016 11:47:33 +0000\n
# generated on Fri, 22 July 2016 11:47:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -143,7 +143,6 @@ magnific-popup.css\n
notify.min.js\n
renderjs.js\n
rsvp.js\n
# gadget_officejs_page_sync.html\n
gadget_monitoring_application_panel.html\n
gadget_monitoring_chart.html\n
gadget_monitoring_document_edit.html\n
......@@ -152,9 +151,11 @@ gadget_monitoring_hosting_subscription_list.html\n
gadget_monitoring_hosting_subscription_view.html\n
gadget_monitoring_import_export.html\n
gadget_monitoring_jio.html\n
gadget_monitoring_log_widget.html\n
gadget_monitoring_login.html\n
gadget_monitoring_login_widget.html\n
gadget_monitoring_main.html\n
gadget_monitoring_message_log.html\n
gadget_monitoring_process_view.html\n
gadget_monitoring_promise_interface.html\n
gadget_monitoring_resource_view.html\n
......@@ -178,9 +179,11 @@ gadget_monitoring_hosting_subscription_list.js\n
gadget_monitoring_hosting_subscription_view.js\n
gadget_monitoring_import_export.js\n
gadget_monitoring_jio.js\n
gadget_monitoring_log_widget.js\n
gadget_monitoring_login.js\n
gadget_monitoring_login_widget.js\n
gadget_monitoring_main.js\n
gadget_monitoring_message_log.js\n
gadget_monitoring_process_view.js\n
gadget_monitoring_promise_interface.js\n
gadget_monitoring_resource_view.js\n
......@@ -340,7 +343,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.17042.64069.1194</string> </value>
<value> <string>952.47296.53851.40738</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -358,7 +361,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1467366906.34</float>
<float>1469182145.68</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -196,6 +196,11 @@
}
gadget.props.hosting_list.push(hosting_dict);
}
gadget.props.hosting_list.sort(function(a, b){
if(a.title < b.title) return -1;
if(a.title > b.title) return 1;
return 0;
});
content = hosting_widget_template({
hosting_list: gadget.props.hosting_list
});
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.25666.33076.8482</string> </value>
<value> <string>952.44518.58996.28689</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1467981701.32</float>
<float>1469016261.62</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -180,12 +180,12 @@
<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, sync data now!
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_overview">Access Hosting Subscriptions</a>
<a href="#page=hosting_subscription_list">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>952.43196.63563.46984</string> </value>
<value> <string>952.47292.33739.26555</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1468936547.51</float>
<float>1469181889.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -32,8 +32,7 @@
.declareMethod("startSync", function (options) {
var gadget = this,
monitor_cred_dict = {},
sync_error;
monitor_cred_dict = {};
function formatDate(d){
function addZero(n){
......@@ -324,7 +323,7 @@
})
.push(function (timer_interval) {
if (timer_interval === undefined) {
timer_interval = 300000;
timer_interval = gadget.props.default_sync_interval;
}
gadget.props.timer_interval = timer_interval;
return syncDataTimer();
......@@ -347,6 +346,8 @@
if (options.now) {
return syncAllStorage();
}
// Default sync interval to 5 minutes
gadget.props.default_sync_interval = 300000;
return new RSVP.Queue()
.push(function () {
return gadget.getSetting('sync_data_interval');
......@@ -354,9 +355,11 @@
.push(function (timer_interval) {
if (timer_interval === undefined) {
// quickly sync because this is the first run!
timer_interval = 10000;
gadget.props.timer_interval = 10000;
gadget.props.has_sync_interval = false;
} else {
gadget.props.timer_interval = timer_interval;
}
gadget.props.timer_interval = timer_interval;
return gadget.getSetting('latest_sync_time');
})
.push(function (latest_sync_time) {
......@@ -371,6 +374,12 @@
gadget.props.timer_interval = gadget.props.timer_interval - time_diff;
}
}
if (!gadget.props.has_sync_interval) {
return gadget.setSetting('sync_data_interval',
gadget.props.default_sync_interval);
}
})
.push(function () {
return syncDataTimer();
});
});
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.31612.10711.16298</string> </value>
<value> <string>952.44569.39820.59136</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1468600685.94</float>
<float>1469018537.19</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -63,8 +63,6 @@
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("redirect", "redirect")
......@@ -163,6 +161,11 @@
var promise_list = [],
i_len,
i;
all_document_list.sort(function(a, b){
if(a['hosting-title'] < b['hosting-title']) return -1;
if(a['hosting-title'] > b['hosting-title']) return 1;
return 0;
});
gadget.property_dict.document_list = all_document_list;
for (i = 0, i_len = all_document_list.length; i < i_len; i += 1) {
promise_list.push(gadget.getUrlFor({
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.2632.39409.25770</string> </value>
<value> <string>952.44539.57216.52360</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1467982701.05</float>
<float>1469016720.58</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