X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2FrecordViewer%2FrecordCard.jsx;h=7b3cb2188f246b60d50b159967e718fcc647177c;hp=c928ffd0c2224605b6326117116678f6186d73d3;hb=8a3927012ae0fc7e136612682a5641b7ba0af567;hpb=e5cb4d01688c97ccca8deea0a56489e213026314 diff --git a/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx b/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx index c928ffd0c..7b3cb2188 100644 --- a/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx +++ b/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx @@ -33,6 +33,14 @@ import JobListCard from '../launchpad_card/jobListCard.jsx'; import NSVirtualLinks from '../virtual_links/nsVirtualLinks.jsx'; import LaunchpadFleetStore from '../launchpadFleetStore.js'; +import Prism from 'prismjs'; +import 'prismjs/themes/prism.css'; + +import {SkyquakeRBAC, isRBACValid} from 'widgets/skyquake_rbac/skyquakeRBAC.jsx'; +import ROLES from 'utils/roleConstants.js'; + +const PROJECT_ROLES = ROLES.PROJECT; + export default class RecordCard extends React.Component { constructor(props) { super(props) @@ -66,12 +74,15 @@ export default class RecordCard extends React.Component { let displayNSVirtualLinks = false; let nsVirtualLinksProps = {}; let nsVirtualLinksComponent = null; - + let displayVolumesTab = false; + let volumesHTML = []; let tabList = []; let tabPanels = []; let notice = null; + let hasAccess = isRBACValid(this.context.userProfile, [PROJECT_ROLES.LCM_ADMIN]); + switch(this.props.type) { case 'vnfr' : cardData = this.props.data[0]; @@ -81,7 +92,7 @@ export default class RecordCard extends React.Component { if (displayConfigPrimitives) { configPrimitiveComponent = (
- + {/* */}
@@ -101,7 +112,7 @@ export default class RecordCard extends React.Component { //That match the currently selected job id if(v.id == cardData.id) { return v.primitive.map(function(p, i) { - return + return }) } }) @@ -127,6 +138,41 @@ export default class RecordCard extends React.Component { ) notice =
  • * If a separate browser window does not open, please check if the popup was blocked and allow it.
  • + if(vdur.hasOwnProperty('volumes') && (vdur.volumes.length > 0)) { + displayVolumesTab = true; + vdur.volumes.map((volume, vi) => { + // let html = Prism.highlight(JSON.stringify(volume), Prism.languages.javascript, 'javascript'); + // volumesHTML.push( + //
    +                //       
    +                //     
    + function buildProperties(obj) { + let p = []; + _.forEach(obj, function(v, k) { + p.push( +
    +
    {k}
    +
    {v.constructor.name != 'Object' ? v : buildProperties(v)}
    +
    + ) + }); + return p; + } + volumesHTML.push( +
    +
    + VOLUME +
    +
    + { + buildProperties(volume) + } +
    +
    + ) + }) + } }); consoleUrlsComponent = (
    @@ -168,7 +214,7 @@ export default class RecordCard extends React.Component { //That match the currently selected job id if(v.id == cardData.id) { return v.primitive.map(function(p, i) { - return + return }) } }) @@ -343,6 +389,21 @@ export default class RecordCard extends React.Component { ) } + if (displayVolumesTab) { + + tabList.push( + Volumes + ); + + tabPanels.push( + + {volumesHTML} +
    +
    +
    + ) + } + html = ( @@ -364,3 +425,7 @@ RecordCard.defaultProps = { isLoading: true, jobData: [] } +RecordCard.contextTypes = { + router: React.PropTypes.object, + userProfile: React.PropTypes.object +};