diff --git a/SAS/TMSS/frontend/tmss_webapp/package.json b/SAS/TMSS/frontend/tmss_webapp/package.json index 8230388bc6f2c1f16805cf9a25ba4f05f6b6b000..705a5183e8801882a780f93350b30333e5bd3582 100644 --- a/SAS/TMSS/frontend/tmss_webapp/package.json +++ b/SAS/TMSS/frontend/tmss_webapp/package.json @@ -37,6 +37,7 @@ "react-calendar-timeline": "^0.27.0", "react-dom": "^16.13.1", "react-frame-component": "^4.1.2", + "react-json-to-table": "^0.1.7", "react-json-view": "^1.19.1", "react-loader-spinner": "^3.1.14", "react-router-dom": "^5.2.0", diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js index e9c0b245f5eaeeaf5bd579a4c42c6b67e46eae44..1a4f0d4290cde1e5be6ce84333dad9622678693a 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js @@ -173,15 +173,15 @@ function Jeditor(props) { } editor = new JSONEditor(element, editorOptions); // editor.getEditor('root').disable(); - if (props.disabled) { - editor.on('ready',() => { - editor.disable(); - }); - } - if (props.parentFunction) { - props.parentFunction(editorFunction); - } editorRef.current = editor; + editor.on('ready',() => { + if (props.disabled) { + editor.disable(); + } + if (props.parentFunction) { + props.parentFunction(editorFunction); + } + }); editor.on('change', () => {setEditorOutput()}); }; @@ -208,8 +208,13 @@ function Jeditor(props) { /** * Function called by the parent component to perform certain action ib JEditor */ - function editorFunction() { - editorRef.current.destroy(); + function editorFunction(name, params) { + if (name === "setValue") { + const newValue = updateInput(_.cloneDeep(params[0])); + editorRef.current.setValue(newValue); + } else { + editorRef.current.destroy(); + } } /** diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_suSummary.scss b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_suSummary.scss index c2fb7b46ab00ed3721db70e61b834f5c9d17b412..76b02736fb1959096ef3067f75b67f2ad1a72336 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_suSummary.scss +++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_suSummary.scss @@ -1,5 +1,5 @@ .constraints-summary>div { - overflow: scroll; + overflow-y: scroll; max-height: 500px; margin-bottom: 10px; } @@ -24,4 +24,25 @@ .task-summary #block_container { margin-top: 0px; -} \ No newline at end of file +} + +/* + * STYLE 3 + */ + + .json-to-table::-webkit-scrollbar-track + { + -webkit-box-shadow: inset 0 0 6px rgba(248, 245, 245, 0.3); + background-color: #F5F5F5; + } + + .json-to-table::-webkit-scrollbar + { + width: 6px; + background-color: #F5F5F5; + } + + .json-to-table::-webkit-scrollbar-thumb + { + background-color: #0000007c; + } \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js index 5de435d85b1f8e16a09f7e43c85ffaffd3da6227..1bcbcefcbd4a7cd6a5bbb2c2cf96eb7c4b7c2800 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; import moment from 'moment'; +import _ from 'lodash'; import Jeditor from '../../components/JSONEditor/JEditor'; import UnitConversion from '../../utils/unit.converter'; /* eslint-disable react-hooks/exhaustive-deps */ @@ -138,7 +139,7 @@ export default (props) => { }; const modifyInitiValue = () => { - const initValue = { ...props.initValue } + const initValue = _.cloneDeep(props.initValue); // For DateTime for (let key in initValue.time) { if (typeof initValue.time[key] === 'string') { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js index f70b3eb5b38d6797bc9b578dd2e660c9a8379b54..4dba59e7cc582d9ff47663d3130e2dd9efdea3ab 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -396,7 +396,6 @@ export class SchedulingUnitCreate extends Component { }, projectDisabled: (this.props.match.params.project? true:false), observStrategy: {}, - selectedStations:{}, paramsOutput: null, validEditor: false, validFields: {}, diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js index 7263fc7b3441386d301f4bba6e5e1e82aedd368c..4b2ef70081a130dd75f9567e8c1ec2616b186c90 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom/cjs/react-router-dom.min'; import moment from 'moment'; import _ from 'lodash'; import ViewTable from '../../components/ViewTable'; -import { JSONToHTMLTable } from '@kevincobain2000/json-to-html-table' +import { JsonToTable } from "react-json-to-table"; import SchedulingConstraints from './Scheduling.Constraints'; /** @@ -42,7 +42,7 @@ export class SchedulingUnitSummary extends Component { /* Format the object to remove empty values*/ const constraint = this.getFormattedConstraint(constraintsDoc[constraintKey]); if (constraint) { - orderedConstraints[constraintKey] = constraint; + orderedConstraints[constraintKey.replace('_',' ')] = constraint; } } return orderedConstraints; @@ -66,7 +66,7 @@ export class SchedulingUnitSummary extends Component { break; } case "boolean": { - constraint = constraint?constraint:null; + constraint = constraint?'Yes':null; break; } case "object": { @@ -88,7 +88,7 @@ export class SchedulingUnitSummary extends Component { for (const objectKey of _.keys(constraint)) { let object = this.getFormattedConstraint(constraint[objectKey]); if (object) { - newObject[objectKey] = object; + newObject[objectKey.replace(/_/g, ' ')] = object; } } constraint = (!_.isEmpty(newObject))? newObject:null; @@ -143,10 +143,12 @@ export class SchedulingUnitSummary extends Component { </div> {/* Scheduling Constraint Display in table format */} {constraintsDoc && + <> <div className="col-12 constraints-summary"> <label>Constraints:</label> - <JSONToHTMLTable data={constraintsDoc} tableClassName="table table-sm"/> + <JsonToTable json={constraintsDoc} /> </div> + </> } </> } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js index 5163e587a816aaf00e65e9d034a4558c6c3064c2..2fd2e272fc587b7ed335de24b48ed3a6c31a4352 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js @@ -121,9 +121,6 @@ export class TimelineView extends Component { * @param {Object} suBlueprint */ getTimelineItem(suBlueprint) { - // Temporary for testing - const diffOfCurrAndStart = moment().diff(moment(suBlueprint.stop_time), 'seconds'); - // suBlueprint.status = diffOfCurrAndStart>=0?"FINISHED":"DEFINED"; let item = { id: suBlueprint.id, group: suBlueprint.suDraft.id, title: `${suBlueprint.project} - ${suBlueprint.suDraft.name} - ${(suBlueprint.durationInSec/3600).toFixed(2)}Hrs`,