From 267d43e391d633c26d45db31125612355665f193 Mon Sep 17 00:00:00 2001 From: KIRAN KASHALKAR Date: Tue, 18 Apr 2017 17:24:22 -0400 Subject: [PATCH] NOTICKET: Adding checks to code where necessary Signed-off-by: KIRAN KASHALKAR --- skyquake/plugins/launchpad/api/launchpad.js | 6 +++--- .../plugins/launchpad/src/launchpad_card/launchpadCard.jsx | 4 +++- .../src/launchpad_card/launchpadCardCloudAccount.jsx | 2 +- .../launchpad/src/launchpad_card/nsrScalingGroups.jsx | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/skyquake/plugins/launchpad/api/launchpad.js b/skyquake/plugins/launchpad/api/launchpad.js index 17a9154c7..d1ba61409 100644 --- a/skyquake/plugins/launchpad/api/launchpad.js +++ b/skyquake/plugins/launchpad/api/launchpad.js @@ -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 diff --git a/skyquake/plugins/launchpad/src/launchpad_card/launchpadCard.jsx b/skyquake/plugins/launchpad/src/launchpad_card/launchpadCard.jsx index 81540463a..b4ebb8163 100644 --- a/skyquake/plugins/launchpad/src/launchpad_card/launchpadCard.jsx +++ b/skyquake/plugins/launchpad/src/launchpad_card/launchpadCard.jsx @@ -98,7 +98,9 @@ class LaunchpadCard extends React.Component { ); - if (this.props.hasAccess) closebutton = null; + if (this.props.hasAccess) { + closeButton = null; + } html = ( diff --git a/skyquake/plugins/launchpad/src/launchpad_card/launchpadCardCloudAccount.jsx b/skyquake/plugins/launchpad/src/launchpad_card/launchpadCardCloudAccount.jsx index 1856dda78..79a587b56 100644 --- a/skyquake/plugins/launchpad/src/launchpad_card/launchpadCardCloudAccount.jsx +++ b/skyquake/plugins/launchpad/src/launchpad_card/launchpadCardCloudAccount.jsx @@ -36,7 +36,7 @@ export default class LaunchpadCardCloudAccount extends React.Component { (
  • NSR: {this.props.nsr['cloud-account']}

  • ) ) } - 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( (
  • VNFR {v['short-name']}: {v['cloud-account']}

  • ) diff --git a/skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx b/skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx index b6abf5c81..ac54e7f98 100644 --- a/skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx +++ b/skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx @@ -69,7 +69,7 @@ export default class NsrScalingGroups extends React.Component { ); } }) : trows.push( - + No network services scaled in this group ); -- 2.25.1