Commit c128b195 authored by Romain Courteaud's avatar Romain Courteaud 🐙

slapos_jio: status wip

parent 3dc7875f
......@@ -37,7 +37,7 @@
.ui-btn-ok:hover a {
color: white !important;
background: green !important;
cursor: default;
/*cursor: default;*/
text-align: center;
}
......@@ -64,7 +64,7 @@
cursor: default;
text-align: center;
}
/*
.ui-btn-no-data,
.ui-btn-no-data:active,
.ui-btn-no-data:hover,
......@@ -76,7 +76,7 @@
cursor: default;
text-align: center;
}
*/
.ui-btn-white,
.ui-btn-white:active,
......
......@@ -71,7 +71,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -240,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>992.39464.63395.50176</string> </value>
<value> <string>995.21673.23359.59187</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1623147492.18</float>
<float>1633703813.2</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -9,6 +9,7 @@
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script src="domsugar.js"></script>
<script src="gadget_slapos_status.js"></script>
<link href="gadget_slapos_compute_node_status.css" rel="stylesheet" type="text/css"/>
......
......@@ -277,7 +277,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>995.21559.35817.38024</string> </value>
<value> <string>995.21642.57886.17339</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -295,7 +295,7 @@
</tuple>
<state>
<tuple>
<float>1633696788.56</float>
<float>1633701789.47</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -66,7 +66,7 @@
return partition_class;
}
function getStatus(gadget, result) {
function renderStatusxxx(result) {
var monitor_url,
status_class = 'ui-btn-no-data',
status_title = 'Compute Node',
......@@ -93,7 +93,7 @@
'?page=ojsm_dispatch&query=portal_type%3A%22Software%20Instance%22%20' +
'AND%20aggregate_reference%3A%22' + result.reference + '%22';
gadget.element.innerHTML = inline_status_template({
return {html: inline_status_template({
monitor_url: monitor_url,
status_class: status_class,
status_title: status_title,
......@@ -101,8 +101,24 @@
right_class: right_class,
right_title: right_title,
right_style: right_style
});
return gadget;
})};
}
function renderStatus(status_dict) {
console.log(status_dict);
/*
if (status_dict.compute_node) {
status_class = checkComputeNodeStatus({news: status_dict.compute_node});
// Check if we have info related to the partition
}
*/
// By default, display the full parameters,
// as it means the gadget does not support the configuration
// but the parameters may contain usefull stuff for the user
return [
'Unsupported',
domsugar('pre', {text: JSON.stringify(status_dict)})
];
}
gadget_klass
......@@ -112,25 +128,35 @@
return {};
})
.declareJob("getStatus", function (result) {
return getStatus(this, {news: result});
})
.onLoop(function () {
var gadget = this;
if (gadget.state.jio_key) {
return gadget.jio_get(gadget.state.jio_key)
.push(function (result) {
return gadget.changeState(result);
console.log('STATUS.onLoop', result);
return gadget.changeState({
compute_node: JSON.stringify(result.news.compute_node),
partition: JSON.stringify(result.news.partition)
});
});
}
}, 300000)
.declareMethod("render", function (options) {
var state_dict = options.value.result;
state_dict.jio_key = options.value.jio_key;
return this.changeState(state_dict);
console.log('STATUS.render', options);
return this.changeState({
compute_node: JSON.stringify(options.compute_node),
partition: JSON.stringify(options.partition),
jio_key: options.value,
reference: options.reference
});
})
.onStateChange(function () {
return getStatus(this, this.state);
.onStateChange(function (modification_dict) {
console.log('STATUS.onStateChange', modification_dict);
domsugar(this.element, renderStatus({
compute_node: JSON.parse(this.state.compute_node),
partition: JSON.parse(this.state.partition),
}));
});
}(window, rJS, Handlebars));
\ No newline at end of file
......@@ -273,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>995.21560.19951.23398</string> </value>
<value> <string>995.21748.56330.51234</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1633696832.02</float>
<float>1633708139.98</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