From c65d33acee808925bf2a7e01c2ee17b939fbd24d Mon Sep 17 00:00:00 2001 From: KIRAN KASHALKAR Date: Thu, 10 Nov 2016 00:09:44 -0500 Subject: [PATCH] RIFT-14751: Provide a network service total count in the Launchpad Dashboard Signed-off-by: KIRAN KASHALKAR --- skyquake/plugins/launchpad/src/launchpad.scss | 8 ++++ .../launchpad/src/nsListPanel/nsListPanel.jsx | 39 ++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/skyquake/plugins/launchpad/src/launchpad.scss b/skyquake/plugins/launchpad/src/launchpad.scss index 927727a31..b871f5111 100644 --- a/skyquake/plugins/launchpad/src/launchpad.scss +++ b/skyquake/plugins/launchpad/src/launchpad.scss @@ -133,6 +133,14 @@ -ms-flex-flow: col wrap; flex-flow: col wrap; } + + .nsrSummary { + font-size: 50%; + padding-top: 1rem; + .nsrSummaryItem { + padding-right: 0.5rem; + } + } } .nsListPanelToggle { diff --git a/skyquake/plugins/launchpad/src/nsListPanel/nsListPanel.jsx b/skyquake/plugins/launchpad/src/nsListPanel/nsListPanel.jsx index c8c841239..c39139294 100644 --- a/skyquake/plugins/launchpad/src/nsListPanel/nsListPanel.jsx +++ b/skyquake/plugins/launchpad/src/nsListPanel/nsListPanel.jsx @@ -326,10 +326,47 @@ export default class NsListPanel extends React.Component { const {nsrs, openedNsrIDs, emptyRows, isVisible, ...props} = this.props; const fieldKeys = FIELD_KEYS; let glyphValue = (isVisible) ? "chevron-left" : "chevron-right"; + + let totalNSRs = nsrs && nsrs.length; + let runningNSRs = 0; + let failedNSRs = 0; + let scalingOutNSRs = 0; + let scalingInNSRs = 0; + let initializingNSRs = 0; + + nsrs && nsrs.map((nsr) => { + nsr['operational-status'] == 'running' && runningNSRs++; + nsr['operational-status'] == 'failed' && failedNSRs++; + nsr['operational-status'] == 'scaling-out' && scalingOutNSRs++; + nsr['operational-status'] == 'scaling-in' && scalingInNSRs++; + ( + nsr['operational-status'] == 'init' || + nsr['operational-status'] == 'vl-init-phase' || + nsr['operational-status'] == 'vnf-init-phase' + ) && initializingNSRs++; + }); + + if (isVisible) { + + let title = ( +
+ NETWORK SERVICES +
+ Total: {totalNSRs} + Running: {runningNSRs} + Failed: {failedNSRs} + Scaling Out: {scalingOutNSRs} + Scaling In: {scalingInNSRs} + Initializing: {initializingNSRs} +
+
+ ); + + return ( + title={title}> {this.panelToolbar()} -- 2.25.1