RIFT-14751: Provide a network service total count in the Launchpad Dashboard 53/653/1
authorKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Thu, 10 Nov 2016 05:09:44 +0000 (00:09 -0500)
committerKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Thu, 10 Nov 2016 05:09:44 +0000 (00:09 -0500)
Signed-off-by: KIRAN KASHALKAR <kiran.kashalkar@riftio.com>
skyquake/plugins/launchpad/src/launchpad.scss
skyquake/plugins/launchpad/src/nsListPanel/nsListPanel.jsx

index 927727a..b871f51 100644 (file)
       -ms-flex-flow: col wrap;
           flex-flow: col wrap;
     }
+
+    .nsrSummary {
+      font-size: 50%;
+      padding-top: 1rem;
+      .nsrSummaryItem {
+        padding-right: 0.5rem;
+      }
+    }
   }
 
   .nsListPanelToggle {
index c8c8412..c391392 100644 (file)
@@ -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 = (
+                <div>
+                    NETWORK SERVICES
+                    <div className='nsrSummary'>
+                        <span className='nsrSummaryItem'>Total: {totalNSRs}</span>
+                        <span className='nsrSummaryItem'>Running: {runningNSRs}</span>
+                        <span className='nsrSummaryItem'>Failed: {failedNSRs}</span>
+                        <span className='nsrSummaryItem'>Scaling Out: {scalingOutNSRs}</span>
+                        <span className='nsrSummaryItem'>Scaling In: {scalingInNSRs}</span>
+                        <span className='nsrSummaryItem'>Initializing: {initializingNSRs}</span>
+                    </div>
+                </div>
+            );
+
+
             return (
                 <DashboardCard className="nsListPanel" showHeader={true}
-                    title="NETWORK SERVICES">
+                    title={title}>
                     {this.panelToolbar()}
                     <a onClick={this.handleShowHideToggle(!isVisible)}
                         className={"nsListPanelToggle"}>