X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2FrecordViewer%2FrecordCard.jsx;h=0d58f7308b765a4068d9b06889d342b0443716ea;hp=dc092bc9d7da4c454b1c65bcb68320de9f543ad2;hb=cfbe2bba8c107d8d8f32601fe0dcd128bcbfa077;hpb=5887e136dc63a909acba0e529dacf383df9061d7 diff --git a/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx b/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx index dc092bc9d..0d58f7308 100644 --- a/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx +++ b/skyquake/plugins/launchpad/src/recordViewer/recordCard.jsx @@ -1,6 +1,6 @@ /* - * + * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,10 @@ 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'; + export default class RecordCard extends React.Component { constructor(props) { @@ -66,7 +70,8 @@ export default class RecordCard extends React.Component { let displayNSVirtualLinks = false; let nsVirtualLinksProps = {}; let nsVirtualLinksComponent = null; - + let displayVolumesTab = false; + let volumesHTML = []; let tabList = []; let tabPanels = []; @@ -90,16 +95,18 @@ export default class RecordCard extends React.Component {
{ //Sort for recent on top - this.props.jobData.sort(function(a,b){ + this.props.jobData + .sort(function(a,b){ return parseInt(b['job-id']) - parseInt(a['job-id']); - }).map(function(job){ + }) + .map(function(job){ //Return only vnfr configs if(job["triggered-by"] == 'vnf-primitive') { return job.vnfr.map(function(v){ //That match the currently selected job id if(v.id == cardData.id) { return v.primitive.map(function(p, i) { - return + return }) } }) @@ -125,6 +132,43 @@ 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) { + if (!v) { + return null; + } + p.push( +
    +
    {k}
    +
    {(v.constructor.name == 'String' || v.constructor.name == 'Number') ? v : buildProperties(v)}
    +
    + ) + }); + return p; + } + volumesHTML.push( +
    +
    + VOLUME +
    +
    + { + buildProperties(volume) + } +
    +
    + ) + }) + } }); consoleUrlsComponent = (
    @@ -157,16 +201,16 @@ export default class RecordCard extends React.Component {
    {sortedJobs.map(function(job, i){ if(job["triggered-by"] == 'ns-primitive') { - return + return } }) .concat(sortedJobs.map(function(job) { if(!job.hasOwnProperty('job-name') && (job["triggered-by"] == 'ns-primitive')) { - return job.vnfr.map(function(v){ + return job.vnfr.map(function(v, h){ //That match the currently selected job id if(v.id == cardData.id) { return v.primitive.map(function(p, i) { - return + return }) } }) @@ -207,7 +251,7 @@ export default class RecordCard extends React.Component { let nfviMetrics = ; metricsAndParams.push(
    - {components.sort().map(function(c, k) { + {components.map(function(c, k) { return
    {c.title}{c.component}
    })}
    ) @@ -224,7 +268,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,13 +369,13 @@ export default class RecordCard extends React.Component { if (consoleUrlsComponent) { let consoleUrlsTabTitle = ''; consoleUrlsTabTitle = 'VDU Console Links'; - + tabList.push( - {consoleUrlsTabTitle} + {consoleUrlsTabTitle} ); tabPanels.push( - +
    {consoleUrlsComponent}
    @@ -341,6 +385,21 @@ export default class RecordCard extends React.Component { ) } + if (displayVolumesTab) { + + tabList.push( + Volumes + ); + + tabPanels.push( + + {volumesHTML} +
    +
    +
    + ) + } + html = (