From 1d133dd53f7fa2fde5fb35c117aaa9349ddafd97 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 27 May 2022 12:02:28 +0200 Subject: Show link speed in Gb/s If link speed is greater than 1000 Mb/s, show it in Gb/s to improve readability. --- ogcp/static/js/ogcp.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index f9785e1..eaae467 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -143,7 +143,8 @@ function updateScopeState() { function updatePillStatus(scope, pill) { const state = scope.state - const link = scope.link + let link = scope.link + let units = 'Mb/s' const pillCls = ['badge-danger', 'badge-success', 'badge-warning', 'badge-wol', 'badge-light']; pill.classList.remove(...pillCls); @@ -160,8 +161,13 @@ function updatePillStatus(scope, pill) { } $('[name="link"]', pill).remove() - if (link) - $(pill).append('
' + link + ' Mb/s'+ '
'); + if (link) { + if (link >= 1000) { + link = link / 1000 + units = 'Gb/s' + } + $(pill).append('
' + link + ' ' + units + '
'); + } } function updateScopes(scopes) { -- cgit v1.2.3-18-g5258