RIFT-15032: launchpad UI - RIFT.ware DEB install - Viewport - icons for nsr (this... 95/695/1
authorKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Tue, 22 Nov 2016 00:20:05 +0000 (19:20 -0500)
committerKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Tue, 22 Nov 2016 00:20:05 +0000 (19:20 -0500)
Signed-off-by: KIRAN KASHALKAR <kiran.kashalkar@riftio.com>
skyquake/plugins/launchpad/src/recordViewer/recordNavigator.jsx
skyquake/plugins/launchpad/src/recordViewer/recordViewStore.js

index 92bb81f..95107ca 100644 (file)
@@ -43,16 +43,6 @@ export default class RecordNavigator extends React.Component{
       return null;
   }
 
-  getDescriptorIdFromRecord = (record) => {
-      if (record.type && record.type == 'nsr') {
-          return record.nsd && record.nsd.id;
-      } else if (record.type && record.type == 'vnfr') {
-          return record.vnfd && record.vnfd.id;
-      }
-
-      return null;
-  }
-
   render(){
     let navClass = 'catalogItems';
 
@@ -81,7 +71,7 @@ export default class RecordNavigator extends React.Component{
             <div key={'id' + k + '-' + vnfr.id}  onClick={self.props.loadRecord.bind(self,vnfr)} className={iClassName}>
               <img
                   onError={self.handleImageError}
-                  src={Utils.cleanImageDataURI(vnfr.logo, self.getDescriptorTypeFromRecordType(vnfr.type), getDescriptorIdFromRecord(vnfr))}
+                  src={Utils.cleanImageDataURI(vnfr.logo, self.getDescriptorTypeFromRecordType(vnfr.type), vnfr.logoId)}
               />
               <section id={vnfr.id}>
               <h1 title={vnfr.name}>{vnfr.name}</h1>
@@ -98,7 +88,7 @@ export default class RecordNavigator extends React.Component{
           <div key={'id' + k + '-' + n.id}  onClick={self.props.loadRecord.bind(self,n)} className={itemClassName}>
             <img
                 onError={self.handleImageError}
-                src={Utils.cleanImageDataURI(n.logo, self.getDescriptorTypeFromRecordType(n.type), self.getDescriptorIdFromRecord(n))}
+                src={Utils.cleanImageDataURI(n.logo, self.getDescriptorTypeFromRecordType(n.type), n.logoId)}
             />
             <section id={n.id}>
             <h1 title={n.name}>{n.name}</h1>
index 3c44676..b9f7499 100644 (file)
@@ -408,7 +408,8 @@ function connectionManager(type, connection) {
                 id: nsrs.id,
                 nsd_name: nsrs.nsd_name,
                 type: 'nsr',
-                logo: nsrs.nsd && nsrs.nsd.logo
+                logo: nsrs.nsd && nsrs.nsd.logo,
+                logoId: nsrs.nsd && nsrs.nsd && nsrs.nsd.id
             });
 
             // Scaled VNFRs
@@ -430,7 +431,8 @@ function connectionManager(type, connection) {
                             name: vnfrObj['short-name'],
                             id: vnfr,
                             type: 'vnfr',
-                            logo: vnfrObj['vnfd'] && vnfrObj['vnfd']['logo']
+                            logo: vnfrObj['vnfd'] && vnfrObj['vnfd']['logo'],
+                            logoId: vnfrObj['vnfd'] && vnfrObj['vnfd']['id']
                         });
                     });
                     nav.push(scaledVnfNav);
@@ -444,7 +446,8 @@ function connectionManager(type, connection) {
                         name: vnfr["short-name"],
                         id: vnfr.id,
                         type: 'vnfr',
-                        logo: vnfr['vnfd'] && vnfr['vnfd']['logo']
+                        logo: vnfr['vnfd'] && vnfr['vnfd']['logo'],
+                        logoId: vnfr['vnfd'] && vnfr['vnfd']['id']
                     });
                 }
             });