Commit e43eca1f authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Alain Takoudjou

[officejs_monitoring] Some performances improvement, speed up hosting...

[officejs_monitoring] Some performances improvement, speed up hosting subscription list page rendering

Speed up display of hosting subscription list by reducing the amount of queries.
If a document is not synced (due to an error) change the status of that document to WARNING so that monitor will
tell when instances/servers are offline.
parent 1ecc8cca
......@@ -328,7 +328,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.22192.23748.64392</string> </value>
<value> <string>961.46782.15224.10001</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -346,7 +346,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1502462901.33</float>
<float>1503935899.97</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -83,6 +83,9 @@ html.ui-mobile .ui-grid-container.ui-responsive > ul > li, html.ui-mobile .ui-gr
.ui-text{
padding: 0 10px;
}
.ui-text-pre {
white-space: pre-wrap;
}
.ui-text-left {text-align: left;}
.ui-text-right {text-align: right;}
.ui-text-center {
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21883.33309.38348</string> </value>
<value> <string>961.46334.51033.4727</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502455104.39</float>
<float>1504086678.92</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -14,6 +14,17 @@
<script id="login-toltip-template" type="text/x-handlebars-template">
</script>
<script id="monitor-parameters-template" type="text/x-handlebars-template">
{{#each parameter_list}}
<span class="label-text">{{title}}:</span>
{{#if key}}
<input type="text" name="{{key}}" placeholder="{{title}}" value="{{value}}" data-mini="true">
{{else}}
<input type="text" name="{{key}}" placeholder="{{title}}" value="{{value}}" data-mini="true" disabled="disabled">
{{/if}}
{{/each}}
</script>
<!-- magnific-popup -->
<script src="jquery.magnific-popup.min.js" type="text/javascript"></script>
<!-- custom script -->
......@@ -22,7 +33,6 @@
</head>
<body>
<div data-gadget-url="gadget_monitoring_jio.html" data-gadget-scope="jio_gadget" data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_monitoring_login_widget.html" data-gadget-scope="login_gadget" data-gadget-sandbox="public"></div>
<div class="white-popup mfp-hide">
<div class="ui-promise-title"><h2 style="font-size: 1.1em;"></h2></div>
<form>
......
......@@ -237,7 +237,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>949.48450.25809.9642</string> </value>
<value> <string>961.40703.61920.55040</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -255,7 +255,7 @@
</tuple>
<state>
<tuple>
<float>1457629718.71</float>
<float>1503583997.49</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,26 +5,9 @@
var gadget_klass = rJS(window),
templater = gadget_klass.__template_element,
hashCode = new Rusha().digestFromString;
/*function getHtmlFromJson(parameter_list) {
var i,
html_content = '';
for (i = 0; i < parameter_list.length; i += 1) {
html_content += '<span class="label-text">' + parameter_list[i].title + ':</span>\n';
if (parameter_list[i].key) {
html_content += '<input type="text" name="' + parameter_list[i].key +
'" placeholder="' + parameter_list[i].title + '" value="' +
parameter_list[i].value +'" data-mini="true">\n';
} else {
html_content += '<input type="text" name="' + parameter_list[i].key +
'" placeholder="' + parameter_list[i].title + '" value="'+
parameter_list[i].value +'" data-mini="true" disabled="disabled">\n';
}
}
return html_content;
}
parameters_widget_template = Handlebars.compile(
templater.getElementById("monitor-parameters-template").innerHTML
);
function getFormDataList(formElement, parameter_list) {
var i,
......@@ -34,47 +17,24 @@
if (parameter_list[i].key) {
// Editable fields
if (formElement.querySelector('input[name="' + parameter_list[i].key + '"]').value !== undefined) {
formData_list[i].value = formElement.querySelector('input[name="' + parameter_list[i].key + '"]').value;
formData_list[i].value = formElement.querySelector('input[name="' +
parameter_list[i].key + '"]').value;
}
}
}
return formData_list;
}
function saveDocument(gadget, jio_document) {
function saveDocument(gadget, document_id, jio_document) {
// Authenticate before save
return gadget.props.login_gadget.getUrlInfo(
hashCode(gadget.props.options.url)
)
.push(function (cred) {
var url = gadget.props.options.url;
if (gadget.props.options.path) {
url += (url.endsWith('/') ? '':'/') + gadget.props.options.path;
}
if (cred === undefined) {
cred = {};
}
gadget.props.jio_gadget.createJio({
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: url,
basic_login: cred.hash
}
}
}, false);
return gadget.props.jio_gadget.put(gadget.props.options.key, jio_document);
})
return gadget.props.jio_gadget.put(document_id, jio_document)
.push(function (result) {
return {status: 'OK'};
}, function (error) {
console.log(error);
return {status: 'ERROR', code: error.target.status};
});
}*/
}
gadget_klass
.ready(function (g) {
......@@ -91,34 +51,40 @@
gadget.props.jio_gadget = jio_gadget;
});
})
.ready(function (gadget) {
return gadget.getDeclaredGadget("login_gadget")
.push(function (login_gadget) {
gadget.props.login_gadget = login_gadget;
});
})
.declareMethod("render", function (options) {
var gadget = this;
return new RSVP.Queue()
.push(function () {
gadget.props.jio_gadget.createJio({
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: options.url,
basic_login: options.basic_login
}
}
});
gadget.props.options = options;
return gadget.props.deferred.resolve();
});
})
.declareMethod("popupEdit", function (options, updateMethod) {
var gadget = this,
title = 'Edit ' + (options.title || 'Monitoring Parameters'),
title = 'Edit - ' + options.title,
html_form = '';
gadget.props.options = options;
/*html_form = getHtmlFromJson(options.parameters || []);
html_form = parameters_widget_template({
parameter_list: options.parameters || []
});
gadget.props.element.querySelector('.form-controlgroup')
.innerHTML = html_form;
gadget.props.element.querySelector('.ui-promise-title h2')
.innerHTML = title;*/
.textContent = title;
return new RSVP.Queue()
/*.push(function () {
.push(function () {
return $.magnificPopup.open({
items: {
src: '.white-popup',
......@@ -147,23 +113,32 @@
'click',
false,
function (evt) {
var data = getFormDataList(document.querySelector('.mfp-content form'), options.parameters);
var data = getFormDataList(
document.querySelector('.mfp-content form'),
options.parameters);
return new RSVP.Queue()
.push(function () {
$(document.querySelector('.mfp-content spinner')).toggleClass('ui-content-hidden');
return RSVP.all([saveDocument(gadget, data)]);
$(document.querySelector('.mfp-content spinner'))
.toggleClass('ui-content-hidden');
return RSVP.all([saveDocument(
gadget,
options.document_id,
data
)]);
})
.push(function (result) {
if (result[0].status === 'ERROR') {
document.querySelector('.mfp-content .ui-text-error')
.innerHTML = 'ERROR ' + result[0].code + ': Failed to save your document! ' +
.innerHTML = 'ERROR ' + result[0].code +
': Failed to save your document! ' +
"Parameters cannot be saved in Offline mode.";
} else {
$.magnificPopup.close();
return updateMethod(data);}
})
.push(function () {
$(document.querySelector('.mfp-content spinner')).toggleClass('ui-content-hidden');
$(document.querySelector('.mfp-content spinner'))
.toggleClass('ui-content-hidden');
});
}
));
......@@ -176,7 +151,7 @@
}
}
});
})*/
})
.push(function () {
return gadget.props.deferred.resolve();
});
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21935.10239.63812</string> </value>
<value> <string>961.40921.12598.30395</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502457634.68</float>
<float>1503585066.29</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, Handlebars, Rusha */
/*global window, rJS, Handlebars */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, Handlebars, Rusha) {
(function (window, rJS, Handlebars) {
"use strict";
var gadget_klass = rJS(window),
......@@ -8,65 +8,80 @@
hosting_widget_template = Handlebars.compile(
templater.getElementById("template-hostings-list").innerHTML
),
rusha = new Rusha();
);
function generateHash(str) {
return rusha.digestFromString(str);
}
function getHostingStatus(gadget, id) {
function getHostingData(gadget) {
// optimized way to fetch hosting subscription list
var hosting_dict = {},
instance_dict = {};
return gadget.jio_allDocs({
query: '(portal_type:"opml-outline") AND (parent_id:"' + id + '")'
})
.push(function (ouline_list) {
var j,
promise_list = [];
for (j = 0; j < ouline_list.data.total_rows; j += 1) {
// fetch all instance info to build hosting status
promise_list.push(
gadget.jio_allDocs({
select_list: ["status", "date"],
query: '(portal_type:"global") AND (parent_id:"' +
ouline_list.data.rows[j].id + '")'
})
);
select_list: ["basic_login", "url", "title"],
query: '(portal_type:"opml") AND (active:true)',
sort_on: [["title", "descending"]]
})
.push(function (result) {
var i;
for (i = 0; i < result.data.total_rows; i += 1) {
hosting_dict[result.data.rows[i].id] = {
url: result.data.rows[i].value.url,
basic_login: result.data.rows[i].value.basic_login,
status: "WARNING",
date: 'Not Synchronized',
title: result.data.rows[i].value.title,
amount: 0
};
}
return RSVP.all(promise_list);
return gadget.jio_allDocs({
query: '(portal_type:"opml-outline")',
select_list: [
"parent_url"
]
});
})
.push(function (result_list) {
var i,
j,
status = "OK",
warning = "",
date = 'Not Synchronized';
for (i = 0; i < result_list.length; i += 1) {
for (j = 0; j < result_list[i].data.total_rows; j += 1) {
if (warning !== "" &&
result_list[i].data.rows[j].value.status === "WARNING") {
warning = "WARNING";
}
if (status !== "ERROR" && status !== "WARNING" &&
result_list[i].data.rows[j].value.status === "ERROR") {
// continue and only change the status if we found Warning === state inconsistent
status = result_list[i].data.rows[j].value.status;
date = result_list[i].data.rows[j].value.date;
} else {
date = result_list[i].data.rows[j].value.date;
}
.push(function (result) {
var i;
for (i = 0; i <result.data.total_rows; i += 1) {
if (hosting_dict.hasOwnProperty(result.data.rows[i].value.parent_url)) {
instance_dict[result.data.rows[i].id] = {
parent_id: result.data.rows[i].value.parent_url
};
}
}
return gadget.jio_allDocs({
query: '(portal_type:"global")',
select_list: [
"status",
"parent_id",
"date"
]
});
})
.push(function (result) {
var i;
for (i = 0; i < result.data.total_rows; i += 1) {
if (instance_dict.hasOwnProperty(result.data.rows[i].value.parent_id)) {
instance_dict[result.data.rows[i].value.parent_id].date =
result.data.rows[i].value.date;
instance_dict[result.data.rows[i].value.parent_id].status =
result.data.rows[i].value.status;
}
}
if (date === 'Not Synchronized') {
status = "WARNING";
})
.push(function () {
//build hosting subscription data
var key,
item;
for (key in instance_dict) {
if (instance_dict.hasOwnProperty(key)) {
item = hosting_dict[instance_dict[key].parent_id];
item.amount += 1;
if (item.status !== "ERROR") {
item.status = instance_dict[key].status;
}
item.date = instance_dict[key].date;
}
}
return {
id: id,
status: warning || status,
amount: result_list.length,
date: date
};
return gadget.changeState({opml_dict: hosting_dict});
});
}
......@@ -92,42 +107,7 @@
title: 'Monitoring Hosting Subscriptions'
})
.push(function () {
return gadget.jio_allDocs({
select_list: ["basic_login", "url", "title"],
query: '(portal_type:"opml") AND (active:true)',
sort_on: [["title", "descending"]]
});
})
.push(function (opml_result) {
var i,
opml_dict = {},
promise_list = [],
id;
for (i = 0; i < opml_result.data.total_rows; i += 1) {
id = generateHash(opml_result.data.rows[i].value.url);
opml_dict[id] = {
url: opml_result.data.rows[i].value.url,
basic_login: opml_result.data.rows[i].value.basic_login,
status: "WARNING",
date: 'Not Synchronized',
title: opml_result.data.rows[i].value.title,
amount: 0
};
promise_list.push(getHostingStatus(gadget, id));
}
return new RSVP.Queue()
.push(function () {
return RSVP.all(promise_list);
})
.push(function (status_list) {
var i;
for (i = 0; i < status_list.length; i += 1) {
opml_dict[status_list[i].id].status = status_list[i].status;
opml_dict[status_list[i].id].date = status_list[i].date;
opml_dict[status_list[i].id].amount = status_list[i].amount;
}
return gadget.changeState({opml_dict: opml_dict});
});
return getHostingData(gadget);
})
.push(function () {
var content,
......@@ -203,4 +183,4 @@
});
}(window, rJS, Handlebars, Rusha));
\ No newline at end of file
}(window, rJS, Handlebars));
\ No newline at end of file
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21883.33309.38348</string> </value>
<value> <string>961.36732.50199.26692</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502445069.07</float>
<float>1503333754.52</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -113,9 +113,7 @@
{{/if}}
<td class="ui-text-center">
{{#if key}}
<!--<a rel="{{../index}}" class="prop-edit" title='Edit this value'><i class="fa fa-pencil"></i></a>-->
<!-- disable edit for now -->
<a><span class="ui-text-desabled" title='Edit this value'><i class="fa fa-pencil"></i></span></a>
<a rel="{{../index}}" class="prop-edit" title='Edit this value'><i class="fa fa-pencil"></i></a>
{{else}}
<a><span class="ui-text-desabled" title='Edit this value'><i class="fa fa-pencil"></i></span></a>
{{/if}}
......@@ -125,7 +123,7 @@
</table>
{{/if}}
{{/each}}
<div class="alert alert-info ui-content-hidden">Your Changes can take a few minutes to appear in this screen!</div>
<div class="alert alert-info ui-content-hidden">Your changes will be persistent in this screen after the next sync!</div>
{{else}}
<h2>No parameters.</h2>
{{/if}}
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.20822.44689.64102</string> </value>
<value> <string>961.40879.58115.22357</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1502430987.78</float>
<float>1503583096.3</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -19,10 +19,20 @@
}
function getInstanceDict(gadget, monitor_dict) {
var private_url = monitor_dict._links.private_url.href.replace("jio_private", "private"),
public_url = monitor_dict._links.public_url.href.replace("jio_public", "public"),
var private_url = monitor_dict._links.private_url.href
.replace("jio_private", "private"),
public_url = monitor_dict._links.public_url.href
.replace("jio_public", "public"),
pass_url = "https://" + atob(gadget.state.opml.basic_login) +
"@" + private_url.split("//")[1];
"@" + private_url.split("//")[1],
i;
for (i = 0; i < monitor_dict.parameters.length; i += 1) {
if (monitor_dict.parameters[i].key === "monitor-password") {
// disabled edit of monitor password from here!!
monitor_dict.parameters[i].key = "";
}
}
return {
key: monitor_dict.reference,
......@@ -103,6 +113,7 @@
instance_list = [],
parameter_list = [],
status_url = '',
instance_dict,
i,
instance_content;
......@@ -112,13 +123,15 @@
for (i = 0; i < document_list.length; i += 1) {
// Only one instance per opml-outline
if (document_list[i].data.total_rows === 1) {
instance_list.push(
getInstanceDict(gadget, document_list[i].data.rows[0].value)
instance_dict = getInstanceDict(
gadget,
document_list[i].data.rows[0].value
);
instance_list.push(instance_dict);
if (document_list[i].data.rows[0].value.hasOwnProperty('parameters')) {
parameter_list.push({
title: document_list[i].data.rows[0].value.title,
parameters: document_list[i].data.rows[0].value.parameters,
parameters: instance_dict.parameters,
base_url: document_list[i].data.rows[0].value
._links.private_url.href || '',
index: i
......@@ -172,9 +185,8 @@
function updateParameterBox(parameter_list, title) {
var element = gadget.element.querySelector('table[title="' + title + '"]'),
tmp,
i;
if (!element) {
return;
}
......@@ -182,7 +194,8 @@
if (!parameter_list[i].key) {
continue;
}
element.querySelector('.v-' + parameter_list[i].key).textContent = parameter_list[i].value;
element.querySelector('.v-' + parameter_list[i].key)
.textContent = parameter_list[i].value;
}
}
......@@ -213,34 +226,22 @@
})
.push(function (config_gadget) {
gadget.props.config_gadget = config_gadget;
return gadget.props.config_gadget.render({
url: gadget.state.instance_list[index].private_url +
'/config',
basic_login: gadget.state.opml.basic_login
});
})
.push(function () {
return gadget.props.config_gadget.popupEdit({
url: gadget.state.instance_list._links.private_url.href,
parameters: gadget.state.instance_list[index].parameters,
title: gadget.state.instance_list[index].title,
root_title: gadget.state.instance_list[index]['hosting-title'],
page_options: gadget.props.options,
path: 'config',
key: 'config.tmp'
parameters: gadget.state.instance_list[index].parameters,
document_id: 'config.tmp'
}, function (data) {
var update_promise = [],
i,
monitor_user = '',
monitor_password = '';
// Try to save monitor credential if they are pres
for (i = 0; i < data.length; i += 1) {
if (data[i].key === 'monitor-password') {
monitor_password = data[i].value;
}
if ((data[i].key || data[i].title) === 'monitor-user') {
monitor_user = data[i].value;
}
}
gadget.state.instance_list[index].parameters = data;
updateParameterBox(data, gadget.props.document_list[index].title);
updateParameterBox(data, gadget.state.instance_list[index].title);
$(gadget.element.querySelector('.alert-info'))
.removeClass('ui-content-hidden');
return RSVP.all(update_promise);
});
});
}
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21935.10239.63812</string> </value>
<value> <string>961.40930.22839.30634</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1502452997.2</float>
<float>1503585188.82</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -16,6 +16,8 @@
} else {
this.props.jio_storage = jIO.createJIO({
type: "replicatedopml",
remote_storage_unreachable_status: "WARNING",
remote_opml_check_time_interval: 86400000,
local_sub_storage: {
type: "query",
sub_storage: {
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21883.33309.38348</string> </value>
<value> <string>961.37911.38494.42700</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502445069.09</float>
<float>1503418549.74</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -41,7 +41,7 @@
<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>
<p class="ui-text ui-text-pre"><strong>{{status}}</strong>: {{message}}</p>
{{else}}
<p><strong>No output message!</strong></p>
{{/if}}
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.20815.19432.23961</string> </value>
<value> <string>961.21883.33309.38348</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>1502378039.46</float>
<float>1504086738.54</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.17644.54835.1433</string> </value>
<value> <string>961.47920.32703.17493</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>1502188014.54</float>
<float>1504086069.06</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21935.10239.63812</string> </value>
<value> <string>961.22271.22355.17766</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502465240.41</float>
<float>1504086036.21</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -73,9 +73,9 @@
<input type="password" name="password" required value=""/>
</div>
</div>
<!--<label class="configure-auth">
<input type="checkbox" name="configure-newpwd">Show/hide change password form
</label>-->
<label class="configure-auth">
<input type="checkbox" name="configure-newpwd">Show/hide update password form
</label>
<div class="new-password" style="display: none">
<div class="ui-form">
<div class="ui-field-contain">
......
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502455270.08</float>
<float>1503497281.04</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.22290.30770.8345</string> </value>
<value> <string>961.40699.48372.17271</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502466440.16</float>
<float>1503651680.71</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -19,7 +19,7 @@
.declareMethod('render', function (options) {
var gadget = this,
header = {
"title": 'Monitoring Promise Status'
"title": 'Monitoring Promises Status'
},
listbox_configuration = {
search_page: 'status_list',
......@@ -50,7 +50,7 @@
}],
filter_column: {select: "category", "title": "Status"},
query: {
"limit": [0, 600],
"limit": [0, 400],
select_list: ['source', 'channel_item', 'channel', 'category',
'date', 'comments', 'link', 'lastBuildDate', 'parent_id'],
query: '(portal_type:"promise") AND (active:true)',
......@@ -95,8 +95,8 @@
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("renderApplication", "renderApplication")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("renderApplication", "renderApplication")
.declareService(function () {
var gadget = this,
current_sync_date;
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21935.10239.63812</string> </value>
<value> <string>961.42463.34618.20070</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502455678.21</float>
<float>1503676888.75</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -252,6 +252,7 @@
}
// Default sync interval to 5 minutes
gadget.props.default_sync_interval = 300000;
gadget.props.has_sync_interval = false;
return new RSVP.Queue()
.push(function () {
return gadget.getSetting('sync_data_interval');
......@@ -260,9 +261,9 @@
if (timer_interval === undefined) {
// quickly sync because this is the first run!
gadget.props.timer_interval = 10000;
gadget.props.has_sync_interval = false;
} else {
gadget.props.timer_interval = timer_interval;
gadget.props.has_sync_interval = true;
}
return gadget.getSetting('latest_sync_time');
})
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21883.33309.38348</string> </value>
<value> <string>961.40574.58268.18875</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1502445069.16</float>
<float>1503563500.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.21883.33309.38348</string> </value>
<value> <string>961.39289.49107.2628</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1502445069.19</float>
<float>1503487925.99</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