X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2FrecordViewer%2FrecordCard.jsx;h=06110f766bcc314643063f3a128d3f227281a501;hp=737ef701d7db6d9dde2ea7c0877db2242fc12639;hb=03156e335275de1dafbc2a816e98006afdf249bf;hpb=573c1249edf74aa6cc50af1f92fd38832149d3eb diff --git a/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx b/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx index 737ef701d..06110f766 100644 --- a/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx +++ b/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx @@ -32,12 +32,17 @@ 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 SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx'; + +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 { +class RecordCard extends React.Component { constructor(props) { super(props) } @@ -77,6 +82,8 @@ export default class RecordCard extends React.Component { let notice = null; + let hasAccess = isRBACValid(this.context.userProfile, [PROJECT_ROLES.LCM_ADMIN, PROJECT_ROLES.PROJECT_ADMIN]); + switch(this.props.type) { case 'vnfr' : cardData = this.props.data[0]; @@ -86,7 +93,7 @@ export default class RecordCard extends React.Component { if (displayConfigPrimitives) { configPrimitiveComponent = (
- + {/* */}
@@ -106,7 +113,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 }) } }) @@ -134,31 +141,37 @@ 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.volumer.map((volume, vi) => { + vdur.volumes.map((volume, vi) => { // let html = Prism.highlight(JSON.stringify(volume), Prism.languages.javascript, 'javascript'); // volumesHTML.push( //
                     //       
                     //     
    - let properties = []; - _.forEach(volume, function(v, k) { - properties.push( -
    -
    {k}
    -
    {v}
    + function buildProperties(obj) { + let p = []; + _forEach(obj, function(v, k) { + if (!v) { + return null; + } + p.push( +
    +
    {k}
    +
    {(v.constructor.name == 'String' || v.constructor.name == 'Number') ? v : buildProperties(v)}
    ) - }) + }); + return p; + } volumesHTML.push( -
    +
    - VOLUME + VOLUME ({vdur['name']})
    - +
    { - properties + buildProperties(volume) } +
    ) }) @@ -187,7 +200,7 @@ export default class RecordCard extends React.Component { if (displayConfigPrimitives) { configPrimitiveComponent = (
    - +
    JOB LIST @@ -204,7 +217,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 }) } }) @@ -243,7 +256,7 @@ export default class RecordCard extends React.Component { let metricsAndParams = []; - let nfviMetrics = ; + let nfviMetrics = null //; metricsAndParams.push(
    {components.map(function(c, k) { return
    {c.title}{c.component}
    @@ -262,7 +275,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( @@ -325,7 +338,7 @@ export default class RecordCard extends React.Component { if (this.props.type == 'nsr') { primitivesTabTitle = 'Service Primitive'; } else if (this.props.type == 'vnfr') { - primitivesTabTitle = 'Service Primitive' + primitivesTabTitle = 'Config Primitive' } tabList.push( @@ -365,11 +378,11 @@ export default class RecordCard extends React.Component { consoleUrlsTabTitle = 'VDU Console Links'; tabList.push( - {consoleUrlsTabTitle} + {consoleUrlsTabTitle} ); tabPanels.push( - +
    {consoleUrlsComponent}
    @@ -415,3 +428,9 @@ RecordCard.defaultProps = { isLoading: true, jobData: [] } +RecordCard.contextTypes = { + router: React.PropTypes.object, + userProfile: React.PropTypes.object +}; + +export default SkyquakeComponent(RecordCard);