From d7b19c6aa0c9502585a5b97bccc8dd312095e3db Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Tue, 8 Mar 2022 16:52:11 +0100 Subject: Remove common css classes from pills status update Some css classes are common to all pills statuses, so we do not need to add or delete those classes on status change. It also remove "badge-info" class because is never used. --- ogcp/static/js/ogcp.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'ogcp/static') diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index 7cfa59d..00b451c 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -105,23 +105,20 @@ function updateScopeState() { } function updatePillStatus(state, pill) { - const pillCls = ['badge', 'badge-pill', 'badge-info', - 'badge-danger', 'badge-success', 'badge-warning', + const pillCls = ['badge-danger', 'badge-success', 'badge-warning', 'badge-wol', 'badge-light']; pill.classList.remove(...pillCls); - let newPillCls = []; if (state === 'OPG') { - newPillCls.push('badge', 'badge-pill', 'badge-warning'); + pill.classList.add('badge-warning'); } else if (state === 'BSY') { - newPillCls.push('badge', 'badge-pill', 'badge-danger'); + pill.classList.add('badge-danger'); } else if (state === 'VDI') { - newPillCls.push('badge', 'badge-pill', 'badge-success'); + pill.classList.add('badge-success'); } else if (state === 'WOL_SENT') { - newPillCls.push('badge', 'badge-pill', 'badge-wol'); + pill.classList.add('badge-wol'); } else { - newPillCls.push('badge', 'badge-pill', 'badge-light'); + pill.classList.add('badge-light'); } - pill.classList.add(...newPillCls); } function updateScopes(scopes) { -- cgit v1.2.3-18-g5258