Commit 8052d98e authored by Romain Courteaud's avatar Romain Courteaud

slapos_jio: gadget_slapos_compute_node_status cleanup

parent 6129df7d
...@@ -19,21 +19,8 @@ ...@@ -19,21 +19,8 @@
<a class="ui-btn ui-btn-icon-left ui-icon-desktop" href="{{monitor_url}}" target=_blank> {{right_title}} </a></div></div> <a class="ui-btn ui-btn-icon-left ui-icon-desktop" href="{{monitor_url}}" target=_blank> {{right_title}} </a></div></div>
</script> </script>
<script id="loading-template" type="text/x-handlebars-template">
<button data-i18n="loading" type="submit" class="responsive ui-btn ui-icon-spinner ui-icon-spin ui-btn-icon-center ui-disabled" style="border:none;">loading</button>
</script>
</head> </head>
<body> <body>
<div class="ui-block-a" style="width:50%">
<div class="ui-bar ui-corner-all first-child ui-btn-no-data">
<a class="ui-btn ui-btn-icon-left ui-icon-spinner" style="color: white !important;"> Compute Node </a>
</div>
</div>
<div class="ui-block-c" style="width:50%">
<div class="ui-bar ui-corner-all first-child ui-btn-no-data">
<a class="ui-btn ui-btn-icon-left ui-icon-spinner" style="color: white !important;"> Partitions </a>
</div>
</div>
</body> </body>
</html> </html>
\ No newline at end of file
/*globals console, window, rJS, RSVP, loopEventListener, i18n, Handlebars, $*/ /*globals window, rJS, Handlebars*/
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, RSVP, Handlebars) { (function (window, rJS, Handlebars) {
"use strict"; "use strict";
var gadget_klass = rJS(window), var gadget_klass = rJS(window),
inline_status_source = gadget_klass.__template_element inline_status_source = gadget_klass.__template_element
...@@ -105,39 +105,22 @@ ...@@ -105,39 +105,22 @@
return gadget; return gadget;
} }
function getStatusLoop(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
return getStatus(gadget, result);
});
}
gadget_klass gadget_klass
.ready(function (gadget) {
gadget.props = {};
return gadget.getSetting("hateoas_url")
.push(function (url) {
gadget.props.hateoas_url = url;
});
})
.declareAcquiredMethod("jio_get", "jio_get") .declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareMethod("getContent", function () { .declareMethod("getContent", function () {
return {}; return {};
}) })
.declareJob("getStatus", function (result) { .declareJob("getStatus", function (result) {
var gadget = this; return getStatus(this, {news: result});
return getStatus(gadget, {news: result});
}) })
.onLoop(function () { .onLoop(function () {
var gadget = this; var gadget = this;
return getStatusLoop(gadget); return gadget.jio_get(gadget.options.value.jio_key)
.push(function (result) {
return getStatus(gadget, result);
});
}, 300000) }, 300000)
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
...@@ -146,4 +129,4 @@ ...@@ -146,4 +129,4 @@
gadget.flag = options.value.jio_key; gadget.flag = options.value.jio_key;
return gadget.getStatus(options.value.result); return gadget.getStatus(options.value.result);
}); });
}(window, rJS, RSVP, Handlebars)); }(window, rJS, Handlebars));
\ No newline at end of file \ 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