Commit 9d616e9d authored by Romain Courteaud's avatar Romain Courteaud

slapos_jio: disable gadget status onLoop

Instead of jio.get, the paramers must provide the url to query,
otherwise, it is not possible to use this gadget in the full ERP5JS
parent 9195232f
/*globals console, window, rJS, domsugar, JSON */
/*globals console, window, rJS, domsugar */
/*jslint indent: 2, nomen: true, maxlen: 80 */
(function (window, rJS, domsugar, JSON) {
(function (window, rJS, domsugar) {
"use strict";
var gadget_klass = rJS(window);
......@@ -198,8 +198,6 @@
}
function getStatus(gadget, result) {
console.log('status getStatus', result);
var status_class = 'ui-btn-no-data',
right_class = 'ui-btn-no-data',
main_status_div = gadget.element.querySelector(".main-status"),
......@@ -340,15 +338,14 @@
return {};
})
/* XXX disabled for now. Gadget parameters must provide
the url to query again to fetch updated data
.onLoop(function () {
console.log('status onloop');
var gadget = this;
if (typeof gadget.state.jio_key === 'string' &&
gadget.state.jio_key !== '') {
return gadget.jio_get(gadget.state.jio_key)
.push(function (result) {
console.log('status after get', result);
var state_dict = result.news || {};
state_dict.jio_key = gadget.state.jio_key;
return gadget.changeState(state_dict);
......@@ -359,14 +356,13 @@
JSON.stringify(gadget.state.jio_key)
);
}, 300000)
*/
.onStateChange(function () {
console.log('status getStatus');
return getStatus(this, this.state);
})
.declareMethod("render", function (options) {
console.log('status render', options);
// crash as soon as possible to detect wrong configuration
if (!(options.hasOwnProperty('jio_key') &&
......@@ -383,4 +379,4 @@
return this.changeState(state_dict);
});
}(window, rJS, domsugar, JSON));
\ No newline at end of file
}(window, rJS, domsugar));
\ No newline at end of file
......@@ -278,7 +278,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1010.24757.23775.49783</string> </value>
<value> <string>1010.24775.45627.23261</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -298,7 +298,7 @@
</tuple>
<state>
<tuple>
<float>1691747920.75</float>
<float>1691748972.83</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