From f07c8447b59c6fb520dca8e83c514f55116c8d5e Mon Sep 17 00:00:00 2001 From: KIRAN KASHALKAR Date: Tue, 15 Nov 2016 17:58:11 -0500 Subject: [PATCH] RIFT-15032: launchpad UI - Viewport - icons for nsr Signed-off-by: KIRAN KASHALKAR --- skyquake/framework/utils/utils.js | 16 ++++++++++++++ .../launchpad/src/instantiate/catalogCard.jsx | 21 +++---------------- .../src/recordViewer/recordNavigator.jsx | 17 ++++++++++++--- .../src/recordViewer/recordViewStore.js | 12 +++++++---- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/skyquake/framework/utils/utils.js b/skyquake/framework/utils/utils.js index 744202731..8a54ff338 100644 --- a/skyquake/framework/utils/utils.js +++ b/skyquake/framework/utils/utils.js @@ -295,4 +295,20 @@ Utils.arrayIntersperse = (arr, sep) => { }, [arr[0]]); } +Utils.cleanImageDataURI = (imageString, type, id) => { + if (/\bbase64\b/g.test(imageString)) { + return imageString; + } else if (/<\?xml\b/g.test(imageString)) { + const imgStr = imageString.substring(imageString.indexOf(' {v['name']} @@ -125,7 +126,7 @@ export default class CatalogCard extends Component { className = "CatalogCard " + buildClass(this.props); return (
- +
@@ -178,19 +179,3 @@ function cardHandler(element) { '' } } - -function cleanDataURI(imageString, type, id) { - if (/\bbase64\b/g.test(imageString)) { - return imageString; - } else if (/<\?xml\b/g.test(imageString)) { - const imgStr = imageString.substring(imageString.indexOf(' { + console.log('Bad logo path, using default'); + e.target.src = require('style/img/catalog-default.svg'); + } render(){ let navClass = 'catalogItems'; @@ -53,7 +58,10 @@ export default class RecordNavigator extends React.Component{ } navObj.push(
- +

{vnfr.name}

{vnfr.type}

@@ -67,7 +75,10 @@ export default class RecordNavigator extends React.Component{ } navObj.push(
- +

{n.name}

{n.type}

diff --git a/skyquake/plugins/launchpad/src/recordViewer/recordViewStore.js b/skyquake/plugins/launchpad/src/recordViewer/recordViewStore.js index b9fded547..3c446760f 100644 --- a/skyquake/plugins/launchpad/src/recordViewer/recordViewStore.js +++ b/skyquake/plugins/launchpad/src/recordViewer/recordViewStore.js @@ -407,7 +407,8 @@ function connectionManager(type, connection) { name: nsrs.name, id: nsrs.id, nsd_name: nsrs.nsd_name, - type: 'nsr' + type: 'nsr', + logo: nsrs.nsd && nsrs.nsd.logo }); // Scaled VNFRs @@ -424,10 +425,12 @@ function connectionManager(type, connection) { sgInstance['vnfrs'] && sgInstance['vnfrs'].map((vnfr, vnfrIndex) => { scaledVnfrs.push(vnfr); + let vnfrObj = _.findWhere(nsrs.vnfrs, {id: vnfr}); scaledVnfNav.vnfr.push({ - name: _.findWhere(nsrs.vnfrs, {id: vnfr})['short-name'], + name: vnfrObj['short-name'], id: vnfr, - type: 'vnfr' + type: 'vnfr', + logo: vnfrObj['vnfd'] && vnfrObj['vnfd']['logo'] }); }); nav.push(scaledVnfNav); @@ -440,7 +443,8 @@ function connectionManager(type, connection) { nav.push({ name: vnfr["short-name"], id: vnfr.id, - type: 'vnfr' + type: 'vnfr', + logo: vnfr['vnfd'] && vnfr['vnfd']['logo'] }); } }); -- 2.17.1