RIFT-16840: VNF config-primitive job does not contain details
[osm/UI.git] / skyquake / plugins / launchpad / src / launchpad_card / jobListCard.jsx
index 2a66540..8253f0a 100644 (file)
@@ -18,6 +18,7 @@
 
 import React from 'react';
 import './jobListCard.scss'
+import TreeView from 'react-treeview';
 import Uptime from 'widgets/uptime/uptime.jsx';
 import Modal from 'react-awesome-modal';
 
@@ -56,17 +57,31 @@ class JobListCard extends React.Component {
     }
     getJobDetails(job) {
         let jobDetails = null;
-        if (job['job-status-details']) {
+        if (job['job-status-details'] || job['execution-error-details']) {
+            let jobDetailsArray = [];
+            if (job['job-status-details']) {
+                jobDetailsArray = job['job-status-details'].split(/\\n/);
+            } else if (job['execution-error-details']) {
+                jobDetailsArray = job['execution-error-details'].split(/\\n/);
+            }
+            let jobDetailsText = [];
+            jobDetailsArray && jobDetailsArray.map((jobDetail) => {
+                jobDetailsText.push(jobDetail);
+                jobDetailsText.push(<br/>);
+            });
             jobDetails = (
                 <section className='jobListCard--details'>
                     <h4 onClick={this.openModal.bind(this)}>Job Details</h4>
                     <Modal
+                        className='jobListCard--details--modal'
                         visible={this.state.modalVisible}
                         width="600"
                         height="400"
                         effect="fadeInUp">
-                        <div>
-                            <div className='jobListCard--details--content'>{job['job-status-details']}</div>
+                        <div className='jobListCard--details--tree'>
+                            <TreeView nodeLabel={<span>Job Details</span>} key={'job-details'} defaultCollapsed={false}>
+                                <p>{jobDetailsText}</p>
+                            </TreeView>
                             <h4 className='jobListCard--details--close' onClick={this.closeModal.bind(this)}>Close</h4>
                         </div>
                     </Modal>
@@ -130,6 +145,7 @@ class JobListCard extends React.Component {
         let self = this;
         let jobListStatus = this.getStatusColor(props['execution-status'] );
         let hideParameters = this.state.hideParameters;
+        let jobDetailsHTML = this.getJobDetails(this.props);
         return (
             <div className="jobListCard">
                 <div className="jobListCard--header">
@@ -159,6 +175,7 @@ class JobListCard extends React.Component {
                         </div>
                     </div>
                 </div>
+                {jobDetailsHTML}
             </div>
         )
     }