summaryrefslogtreecommitdiffstats
path: root/ogcp/static/js/ogcp.js
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2021-07-16 12:22:22 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-07-20 11:22:41 +0200
commit4b4edf4aeeed5d6177c1d78812a497e7ad1a206d (patch)
tree5205bf115a478919abc1e2a165338068884b9e6e /ogcp/static/js/ogcp.js
parent4e519590af6484cc05a91f102a0a3765408b5e72 (diff)
Add and restyle clients states
This patch adds new states: OPG for clients in ogLive, BSY for busy clients, VDI for clients in OpenGnsys VDI and WOL_SENT for booting clients. It also removes state ON because do not exists. ogCP currently uses the following colors: * OPG -> Solid yellow * BSY -> Solid red * VDI -> Solid green * WOL_SENT -> Solid brown * OFF -> Hollow grey
Diffstat (limited to 'ogcp/static/js/ogcp.js')
-rw-r--r--ogcp/static/js/ogcp.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js
index ab06dfc..f9c8e56 100644
--- a/ogcp/static/js/ogcp.js
+++ b/ogcp/static/js/ogcp.js
@@ -25,20 +25,21 @@ function updateScopes(scopes) {
scopes.forEach((scope) => {
if (scope.state) {
const scopeId = `${scope.name}_${scope.id}`;
- const scopeEl = document.querySelector(`#${scopeId}`);
- const stateCls = ['state--on', 'state--off'];
- scopeEl.classList.remove(...stateCls);
- const stateClass = `state--${scope.state}`;
- scopeEl.classList.add(stateClass);
-
const iconEl = document.querySelector(`#${scopeId} .nav-icon`);
- const iconCls = ['fas', 'far', 'text-danger', 'text-success'];
+ const iconCls = ['fas', 'far', 'text-danger', 'text-success',
+ 'text-warning', 'text-wol'];
iconEl.classList.remove(...iconCls);
let newIconCls = [];
- if (scope.state === 'on') {
+ if (scope.state === 'OPG') {
+ newIconCls.push('fas', 'text-warning');
+ } else if (scope.state === 'BSY') {
+ newIconCls.push('fas', 'text-danger');
+ } else if (scope.state === 'VDI') {
newIconCls.push('fas', 'text-success');
+ } else if (scope.state === 'WOL_SENT') {
+ newIconCls.push('fas', 'text-wol');
} else {
- newIconCls.push('far', 'text-danger');
+ newIconCls.push('far');
}
iconEl.classList.add(...newIconCls);
}