summaryrefslogtreecommitdiffstats
path: root/ogcp/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp/static/js')
-rw-r--r--ogcp/static/js/ogcp.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js
index 83fe52d..872f03c 100644
--- a/ogcp/static/js/ogcp.js
+++ b/ogcp/static/js/ogcp.js
@@ -258,9 +258,12 @@ function updatePillStatus(scope, pill) {
}
function updateScopes(scopes) {
+ let hasLiveChildren = false;
+
scopes.forEach((scope) => {
+ const scopeName = `${scope.name}`.replaceAll(/[.]|[ ]/g, '_');
if (scope.state) {
- const scopeId = `${scope.name}_${scope.id}`.replaceAll(/[.]|[ ]/g, '_');
+ const scopeId = `${scopeName}_${scope.id}`;
const iconEl = document.querySelector(`#${scopeId} .nav-icon`);
const iconCls = ['fas', 'far', 'fa-circle', 'fa-check-circle',
'fa-times-circle', 'fa-user-circle', 'text-danger',
@@ -269,6 +272,7 @@ function updateScopes(scopes) {
iconEl.classList.remove(...iconCls);
let newIconCls = [];
if (scope.state === 'OPG') {
+ hasLiveChildren = true;
newIconCls.push('fas', 'text-warning');
if (scope.last_cmd.result === 'failure')
newIconCls.push('fa-times-circle');
@@ -283,6 +287,7 @@ function updateScopes(scopes) {
} else if (scope.state === 'WINS') {
newIconCls.push('fas', 'fa-user-circle', 'text-windows');
} else if (scope.state === 'BSY') {
+ hasLiveChildren = true;
newIconCls.push('fas', 'fa-circle', 'text-danger');
} else if (scope.state === 'VDI') {
newIconCls.push('fas', 'fa-circle', 'text-success');
@@ -300,9 +305,23 @@ function updateScopes(scopes) {
}
if (scope.scope) {
// This is a level so we should update all childs
- updateScopes(scope.scope);
+ let hasLocalLiveChildren = updateScopes(scope.scope);
+ if (hasLocalLiveChildren) {
+ hasLiveChildren = true;
+ }
+
+ const disclosureWidgetId = scope.id ?
+ `${scope.type}-${scope.id}` : `${scope.type}-${scopeName}`;
+ const disclosureWidget = document.querySelector(`#${disclosureWidgetId}`);
+
+ disclosureWidget.classList.remove('live-report');
+
+ if (hasLocalLiveChildren) {
+ disclosureWidget.classList.add('live-report');
+ }
}
});
+ return hasLiveChildren;
}
function unfoldAll() {