X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2FrecordViewer%2FrecordCard.jsx;h=69b4bbd98a468e66cc0875aac7fa18d7f965aca1;hb=bea72768204db1ffe569b06277623beb9dd231d6;hp=41f70073d9999eedb9a08bf5cbf0f2e1aa952195;hpb=23b52a272f8520ebac6391e72d5f8576152db8cb;p=osm%2FUI.git diff --git a/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx b/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx index 41f70073d..69b4bbd98 100644 --- a/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx +++ b/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx @@ -32,10 +32,14 @@ import PlacementGroupsInfo from './placementGroupsInfo.jsx'; import JobListCard from '../launchpad_card/jobListCard.jsx'; import NSVirtualLinks from '../virtual_links/nsVirtualLinks.jsx'; import LaunchpadFleetStore from '../launchpadFleetStore.js'; - +import _forEach from 'lodash/forEach'; 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) { @@ -77,6 +81,8 @@ export default class RecordCard extends React.Component { let notice = null; + let hasAccess = isRBACValid(this.context.userProfile, [PROJECT_ROLES.LCM_ADMIN]); + switch(this.props.type) { case 'vnfr' : cardData = this.props.data[0]; @@ -86,7 +92,7 @@ export default class RecordCard extends React.Component { if (displayConfigPrimitives) { configPrimitiveComponent = (
- + {/* */}
@@ -106,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 }) } }) @@ -132,14 +138,38 @@ 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('volumer') && (vdur.volumer.length > 0)) { + if(vdur.hasOwnProperty('volumes') && (vdur.volumes.length > 0)) { displayVolumesTab = true; - vdur.volumer.map((volume, vi) => { - let html = Prism.highlight(JSON.stringify(volume), Prism.languages.javascript, 'javascript'); + 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 == 'String' || v.constructor.name == 'Number') ? v : buildProperties(v)}
    +
    + ) + }); + return p; + } volumesHTML.push( -
    -                      
    -                    
    +
    +
    + VOLUME +
    +
    + { + buildProperties(volume) + } +
    +
    ) }) } @@ -167,7 +197,7 @@ export default class RecordCard extends React.Component { if (displayConfigPrimitives) { configPrimitiveComponent = (
    - +
    JOB LIST @@ -184,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 }) } }) @@ -242,7 +272,7 @@ export default class RecordCard extends React.Component { if(this.props.isLoading) { html = } else { - let glyphValue = (this.props.mmmrecordDetailsToggleValue) ? "chevron-left" : "chevron-right"; + let glyphValue = (!this.props.recordDetailsToggleValue) ? "chevron-left" : "chevron-right"; if (this.props.type == 'nsr') { tabList.push( @@ -395,3 +425,7 @@ RecordCard.defaultProps = { isLoading: true, jobData: [] } +RecordCard.contextTypes = { + router: React.PropTypes.object, + userProfile: React.PropTypes.object +};