Commit a23b5ca0 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Update status gadget CSS/HTML

   Now we only have a single div (status) rather them two.
parent a9a7524e
......@@ -16,12 +16,8 @@
clear: left;
}
.ui-block-50 {
width: 50% !important;
}
.ui-btn-hide {
display: none !important;
.ui-block {
width: 100%
}
.ui-bar {
......
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1001.40386.24679.24320</string> </value>
<value> <string>1009.35848.48037.15820</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1658172898.38</float>
<float>1688482381.84</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -14,15 +14,10 @@
</head>
<body>
<div class="ui-block-a ui-block-50 main-status">
<div class="ui-block-a ui-block main-status">
<div class="ui-bar ui-corner-all first-child ui-btn-no-data">
<a class="ui-btn ui-btn-icon-left ui-icon-spinner ui-btn-color-white"> Node </a>
</div>
</div>
<div class="ui-block-c ui-block-50 sub-status">
<div class="ui-bar ui-corner-all first-child ui-btn-no-data">
<a class="ui-btn ui-btn-icon-left ui-icon-spinner ui-btn-color-white"> Partitions </a>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -282,7 +282,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1001.26171.19762.42854</string> </value>
<value> <string>1009.35843.10522.38024</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -302,7 +302,7 @@
</tuple>
<state>
<tuple>
<float>1657906237.75</float>
<float>1688481140.05</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -128,32 +128,25 @@
}
function getStatus(gadget, result) {
var i, status_class = 'ui-btn-no-data',
right_class = 'ui-btn-no-data',
var status_class = 'ui-btn-no-data',
main_status_div = gadget.element.querySelector(".main-status"),
sub_status_div = gadget.element.querySelector(".sub-status"),
monitor_url = '',
main_link_configuration_dict = {
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) {
monitor_url = result.monitor_url
monitor_url = result.monitor_url;
}
if (result && result.portal_type && result.portal_type === "Compute Node") {
main_link_configuration_dict.text = 'Node';
main_link_configuration_dict.class = "ui-btn ui-btn-icon-left";
right_class = "ui-btn-hide";
status_class = getComputeNodeStatus(result);
} else if (result && result.portal_type &&
result.portal_type === "Software Installation") {
status_class = getSoftwareInstallationStatus(result);
main_link_configuration_dict.text = "Installation";
right_class = "ui-btn-hide";
if (status_class === "ui-btn-is-building") {
main_link_configuration_dict.text = "Building";
status_class = "ui-btn-no-data";
......@@ -168,7 +161,6 @@
result.portal_type === "Slave Instance"
)) {
status_class = getInstanceStatus(result);
right_class = "ui-btn-hide";
if (status_class === 'ui-btn-is-slave') {
status_class = 'ui-btn-color-white';
main_link_configuration_dict.text = 'Slave';
......@@ -190,7 +182,6 @@
result.portal_type === "Instance Tree") {
status_class = getInstanceTreeStatus(result);
// it should verify if the monitor-base-url is ready.
right_class = "ui-btn-hide";
if (status_class === 'ui-btn-is-slave') {
status_class = 'ui-btn-color-white';
main_link_configuration_dict.text = 'Slave Only';
......@@ -211,28 +202,16 @@
} else {
main_link_configuration_dict.text = 'Node';
main_link_configuration_dict.class = "ui-btn ui-btn-icon-left";
right_class = "ui-btn-hide";
status_class = getComputeNodeStatusList(result);
}
main_link_configuration_dict.text = ' ' + main_link_configuration_dict.text;
sub_link_configuration_dict.text = ' ' + sub_link_configuration_dict.text;
domsugar(main_status_div.querySelector('div'),
{
class: "ui-bar ui-corner-all first-child " + status_class
}, [
domsugar("a", main_link_configuration_dict)
]);
domsugar(sub_status_div.querySelector('div'),
{
class: "ui-bar ui-corner-all last-child " + right_class
}, [
domsugar("a", 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";
}
return gadget;
}
......@@ -244,7 +223,8 @@
.onLoop(function () {
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)
.push(function (result) {
var state_dict = result.news || {};
......
......@@ -278,7 +278,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1009.34679.51690.7697</string> </value>
<value> <string>1009.34688.1170.33860</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -298,7 +298,7 @@
</tuple>
<state>
<tuple>
<float>1688411520.86</float>
<float>1688481138.46</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