Commit 593941ee authored by Romain Courteaud's avatar Romain Courteaud

slapos_jio:

* status gadget portal _type is provided by the python script
* do not mess with cursor used by browser
  it only confuses users
* do not display links without href
* 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
* reintroduce all stuff from slapos_jio_before_deletion
  my branch is not ready to drop everything
parent 8e9524e4
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <unicode>zope</unicode> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1001.40386.24679.24320</string> </value> <value> <string>1010.14961.23101.61474</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>1658172898.38</float> <float>1691746548.56</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -128,13 +128,15 @@ ...@@ -128,13 +128,15 @@
} }
function getStatus(gadget, result) { function getStatus(gadget, result) {
var status_class = 'ui-btn-no-data',
var i, status_class = 'ui-btn-no-data',
right_class = 'ui-btn-no-data', right_class = 'ui-btn-no-data',
main_status_div = gadget.element.querySelector(".main-status"), main_status_div = gadget.element.querySelector(".main-status"),
monitor_url = '', monitor_url = '',
main_link_configuration_dict = { main_link_configuration_dict = {
"class": "ui-btn ui-btn-icon-left ui-icon-desktop" "class": "ui-btn ui-btn-icon-left ui-icon-desktop"
},
sub_link_configuration_dict = {
"class": "ui-btn ui-btn-icon-left ui-icon-desktop"
}; };
if (result && result.monitor_url) { if (result && result.monitor_url) {
...@@ -215,6 +217,20 @@ ...@@ -215,6 +217,20 @@
domsugar(main_link_configuration_dict.href ? "a" : "span", domsugar(main_link_configuration_dict.href ? "a" : "span",
main_link_configuration_dict) main_link_configuration_dict)
]); ]);
<<<<<<< HEAD
=======
domsugar(sub_status_div.querySelector('div'),
{
"class": "ui-bar ui-corner-all last-child " + right_class
}, [
domsugar(sub_link_configuration_dict.href ? "a" : "span",
sub_link_configuration_dict)
]);
if (right_class === 'ui-btn-hide') {
// expand main button to use the space
main_status_div.className = "ui-block-a ui-block main-status";
}
>>>>>>> c588db144 (slapos_jio: jslint)
return gadget; return gadget;
} }
...@@ -225,15 +241,18 @@ ...@@ -225,15 +241,18 @@
}) })
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
=======
======= =======
/* XXX disabled for now. Gadget parameters must provide
the url to query again to fetch updated data
>>>>>>> 9d616e9df (slapos_jio: disable gadget status onLoop)
.onLoop(function () { .onLoop(function () {
console.log('status onloop');
var gadget = this; var gadget = this;
if (typeof gadget.state.jio_key === 'string' && gadget.state.jio_key !== '') { if (typeof gadget.state.jio_key === 'string' &&
gadget.state.jio_key !== '') {
return gadget.jio_get(gadget.state.jio_key) return gadget.jio_get(gadget.state.jio_key)
.push(function (result) { .push(function (result) {
console.log('status after get', result);
var state_dict = result.news || {}; var state_dict = result.news || {};
state_dict.jio_key = gadget.state.jio_key; state_dict.jio_key = gadget.state.jio_key;
return gadget.changeState(state_dict); return gadget.changeState(state_dict);
...@@ -244,14 +263,15 @@ ...@@ -244,14 +263,15 @@
JSON.stringify(gadget.state.jio_key) JSON.stringify(gadget.state.jio_key)
); );
}, 300000) }, 300000)
*/
>>>>>>> 671d73395 (slapos_jio/panel: restore status gadget first rendering) >>>>>>> 671d73395 (slapos_jio/panel: restore status gadget first rendering)
.onStateChange(function () { .onStateChange(function () {
console.log('status getStatus');
return getStatus(this, this.state); return getStatus(this, this.state);
}) })
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
<<<<<<< HEAD
<<<<<<< HEAD <<<<<<< HEAD
// crash as soon as possible to detect wrong configuration // crash as soon as possible to detect wrong configuration
if (!(options.hasOwnProperty('jio_key') && if (!(options.hasOwnProperty('jio_key') &&
...@@ -262,13 +282,14 @@ ...@@ -262,13 +282,14 @@
} }
======= =======
console.log('status render', options); console.log('status render', options);
=======
>>>>>>> 9d616e9df (slapos_jio: disable gadget status onLoop)
// crash as soon as possible to detect wrong configuration // crash as soon as possible to detect wrong configuration
if (!(options.hasOwnProperty('jio_key') && if (!(options.hasOwnProperty('jio_key') &&
options.hasOwnProperty('portal_type') &&
options.hasOwnProperty('result'))) { options.hasOwnProperty('result'))) {
throw new Error( throw new Error(
'status gadget did not receive jio_key, portal_type and result values' 'status gadget did not receive jio_key, portal_type and result values'
); );
} }
...@@ -277,9 +298,11 @@ ...@@ -277,9 +298,11 @@
// result is empty. // result is empty.
var state_dict = options.result || {}; var state_dict = options.result || {};
state_dict.jio_key = options.jio_key; state_dict.jio_key = options.jio_key;
state_dict.portal_type = options.portal_type;
return this.changeState(state_dict); return this.changeState(state_dict);
}); });
<<<<<<< HEAD
=======
>>>>>>> 9d616e9df (slapos_jio: disable gadget status onLoop)
}(window, rJS, domsugar)); }(window, rJS, domsugar));
\ No newline at end of file
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1010.24667.53982.38792</string> </value> <value> <string>1010.24775.45627.23261</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1691742501.46</float> <float>1691748972.83</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
erp5_web_renderjs_ui erp5_web_renderjs_ui
\ No newline at end of file slapos_jio_before_deletion
\ No newline at end of file
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