Commit a9a7524e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Status gadget should only display one element

    The secondary element is not that useful in reality, since it eventually contains something failing and tickets provides an way better overview of the problem.
parent 7f6a241c
...@@ -77,42 +77,6 @@ ...@@ -77,42 +77,6 @@
return 'ui-btn-error'; return 'ui-btn-error';
} }
function getComputePartitionStatus(options) {
var message,
compute_partition,
partition_class = 'ui-btn-ok',
error_amount = 0,
total_amount = 0;
if (!options) {
return 'ui-btn-no-data';
}
for (compute_partition in options) {
if (options.hasOwnProperty(compute_partition) &&
options[compute_partition].text) {
message = options[compute_partition].text;
if (message.startsWith("#error")) {
partition_class = 'ui-btn-warning';
error_amount += 1;
}
total_amount += 1;
if ((error_amount > 0) && (error_amount < total_amount)) {
// No need to continue the result will be a warnning
return partition_class;
}
}
}
if (!total_amount) {
return 'ui-btn-no-data';
}
if (error_amount === total_amount) {
return 'ui-btn-error';
}
return partition_class;
}
function getSoftwareInstallationStatus(options) { function getSoftwareInstallationStatus(options) {
if ((!options) || (options && !options.text)) { if ((!options) || (options && !options.text)) {
return 'ui-btn-no-data'; return 'ui-btn-no-data';
...@@ -163,40 +127,6 @@ ...@@ -163,40 +127,6 @@
return status; return status;
} }
function getComputePartitionStatusList(options) {
var compute_node_reference,
status = 'ui-btn-no-data',
previous_status = "START";
for (compute_node_reference in options.partition) {
if (options.partition.hasOwnProperty(compute_node_reference)) {
status = getComputePartitionStatus(
options.partition[compute_node_reference]
);
if (previous_status === "START") {
previous_status = status;
}
if (status === 'ui-btn-warning') {
// XXX Drop warning
return status;
}
if (previous_status !== status) {
if ((previous_status === 'ui-btn-error') &&
(status === 'ui-btn-ok')) {
return 'ui-btn-warning';
}
if ((status === 'ui-btn-error') &&
(previous_status === 'ui-btn-ok')) {
return 'ui-btn-warning';
}
if (status === 'ui-btn-no-data') {
status = previous_status;
}
}
}
}
return status;
}
function getStatus(gadget, result) { function getStatus(gadget, result) {
var i, 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',
...@@ -215,24 +145,10 @@ ...@@ -215,24 +145,10 @@
} }
if (result && result.portal_type && result.portal_type === "Compute Node") { if (result && result.portal_type && result.portal_type === "Compute Node") {
main_link_configuration_dict.href = monitor_url;
main_link_configuration_dict.target = "_target";
main_link_configuration_dict.text = 'Node'; main_link_configuration_dict.text = 'Node';
sub_link_configuration_dict.href = monitor_url; main_link_configuration_dict.class = "ui-btn ui-btn-icon-left";
sub_link_configuration_dict.target = "_target"; right_class = "ui-btn-hide";
sub_link_configuration_dict.text = 'Partitions'; status_class = getComputeNodeStatus(result);
if (result && result.compute_node) {
status_class = getComputeNodeStatus(result.compute_node);
}
if ((status_class === 'ui-btn-error') ||
(status_class === 'ui-btn-no-data')) {
right_class = status_class;
} else {
if (result && result.partition) {
right_class = getComputePartitionStatus(result.partition);
}
}
} else if (result && result.portal_type && } else if (result && result.portal_type &&
result.portal_type === "Software Installation") { result.portal_type === "Software Installation") {
status_class = getSoftwareInstallationStatus(result); status_class = getSoftwareInstallationStatus(result);
...@@ -293,20 +209,10 @@ ...@@ -293,20 +209,10 @@
main_link_configuration_dict.text = 'Instance'; main_link_configuration_dict.text = 'Instance';
} }
} else { } else {
main_link_configuration_dict.href = monitor_url;
main_link_configuration_dict.target = "_target";
main_link_configuration_dict.text = 'Node'; main_link_configuration_dict.text = 'Node';
sub_link_configuration_dict.href = monitor_url; main_link_configuration_dict.class = "ui-btn ui-btn-icon-left";
sub_link_configuration_dict.target = "_target"; right_class = "ui-btn-hide";
sub_link_configuration_dict.text = 'Partitions';
status_class = getComputeNodeStatusList(result); status_class = getComputeNodeStatusList(result);
if ((status_class === 'ui-btn-error') ||
(status_class === 'ui-btn-no-data')) {
right_class = status_class;
} else {
right_class = getComputePartitionStatusList(result);
}
} }
main_link_configuration_dict.text = ' ' + main_link_configuration_dict.text; main_link_configuration_dict.text = ' ' + main_link_configuration_dict.text;
......
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1006.58340.40727.23620</string> </value> <value> <string>1009.34679.51690.7697</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>1680031759.77</float> <float>1688411520.86</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -154,12 +154,12 @@ ...@@ -154,12 +154,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -206,12 +206,12 @@ ...@@ -206,12 +206,12 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -227,12 +227,12 @@ ...@@ -227,12 +227,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -224,12 +224,12 @@ ...@@ -224,12 +224,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -245,12 +245,12 @@ ...@@ -245,12 +245,12 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -179,23 +179,23 @@ ...@@ -179,23 +179,23 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -212,34 +212,34 @@ ...@@ -212,34 +212,34 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//div[contains(@class, 'leaflet-pane')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<!-- Check on listbox --> <!-- Check on listbox -->
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(@href, 'COMP-') and contains(text(), 'Node')]</td> <td>//td//div[contains(@class, 'main-status')]//div[contains(@class, 'ui-btn-ok')]//a[contains(text(), 'Node')]</td>
<td></td> <td></td>
</tr> </tr>
......
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