From: KIRAN KASHALKAR Date: Tue, 18 Apr 2017 21:24:22 +0000 (-0400) Subject: NOTICKET: Adding checks to code where necessary X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=267d43e391d633c26d45db31125612355665f193;p=osm%2FUI.git NOTICKET: Adding checks to code where necessary Signed-off-by: KIRAN KASHALKAR --- 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 );