NOTICKET: Adding checks to code where necessary
authorKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Tue, 18 Apr 2017 21:24:22 +0000 (17:24 -0400)
committerKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Tue, 18 Apr 2017 21:24:22 +0000 (17:24 -0400)
Signed-off-by: KIRAN KASHALKAR <kiran.kashalkar@riftio.com>
skyquake/plugins/launchpad/api/launchpad.js
skyquake/plugins/launchpad/src/launchpad_card/launchpadCard.jsx
skyquake/plugins/launchpad/src/launchpad_card/launchpadCardCloudAccount.jsx
skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx

index 17a9154..d1ba614 100644 (file)
@@ -1281,10 +1281,10 @@ VNFR.get = function(req) {
         }, function(error, response, body) {
             if (utils.validateResponse('VNFR.get', error, response, body, resolve, reject)) {
                 var data = JSON.parse(response.body);
-                var returnData = id ? [data["vnfr:vnfr"]] : data.collection["vnfr:vnfr"];
+                var returnData = id ? (data["vnfr:vnfr"] ? [data["vnfr:vnfr"]] : []) : data.collection["vnfr:vnfr"];
                 returnData.forEach(function(vnfr) {
-                    vnfr['nfvi-metrics'] = buildNfviGraphs(vnfr.vdur);
-                    vnfr['epa-params'] = epa_aggregator(vnfr.vdur);
+                    vnfr['nfvi-metrics'] = vnfr.vdur ? buildNfviGraphs(vnfr.vdur) : [];
+                    vnfr['epa-params'] = vnfr.vdur ? epa_aggregator(vnfr.vdur) : [];
                     vnfr['service-primitives-present'] = (vnfr['vnf-configuration'] && vnfr['vnf-configuration']['service-primitive'] && vnfr['vnf-configuration']['service-primitive'].length > 0) ? true : false;
                     vnfr['vdur'] && vnfr['vdur'].map(function(vdur, vdurIndex) {
                         // This console-url is what front-end will hit to generate a real console-url
index 8154046..b4ebb81 100644 (file)
@@ -98,7 +98,9 @@ class LaunchpadCard extends React.Component {
               <img src={circleXImage} title="Close card" />
               </a>
       );
-      if (this.props.hasAccess) closebutton = null;
+      if (this.props.hasAccess) {
+        closeButton = null;
+      }
       html = (
         <DashboardCard className={'launchpadCard'} closeCard={closeButton}>
           <LaunchpadHeader nsr={this.props.nsr} name={this.props.name} isActive={this.props.isActive} id={this.props.id}/>
index 1856dda..79a587b 100644 (file)
@@ -36,7 +36,7 @@ export default class LaunchpadCardCloudAccount extends React.Component {
         (<li key="nsr"><h3>NSR: {this.props.nsr['cloud-account']}</h3></li>)
       )
     }
-    this.props.nsr['vnfrs'].map(function(v,i) {
+    this.props.nsr && this.props.nsr['vnfrs'] && this.props.nsr['vnfrs'].map(function(v,i) {
       if(v.hasOwnProperty('cloud-account')) {
         status.push(
           (<li key={i}><h3>VNFR {v['short-name']}: {v['cloud-account']}</h3></li>)
index b6abf5c..ac54e7f 100644 (file)
@@ -69,7 +69,7 @@ export default class NsrScalingGroups extends React.Component {
                                        );
                                }
                        }) : trows.push(
-                               <tr key={sgrInstanceIndex}>
+                               <tr key={sgri}>
                                        <td colSpan="5" style={{textAlign: 'center'}}>No network services scaled in this group</td>
                                </tr>
                        );