From 15d3aaffb163b916f30d6320d17765f5f132395c Mon Sep 17 00:00:00 2001 From: Muthukrishnanmatriot <76949556+muthukrishnanmatriot@users.noreply.github.com> Date: Wed, 7 Apr 2021 22:33:21 +0530 Subject: [PATCH] Updated the code for review comments --- SAS/TMSS/frontend/tmss_webapp/.vscode/launch.json | 15 +++++++++++++++ .../tmss_webapp/src/components/ViewTable.js | 2 +- .../frontend/tmss_webapp/src/routes/Task/view.js | 2 +- .../src/routes/Timeline/reservation.create.js | 15 +++++++++------ .../src/routes/Timeline/reservation.edit.js | 15 +++++++++++---- .../src/routes/Timeline/reservation.view.js | 12 ++++++------ SAS/TMSS/frontend/tmss_webapp/src/routes/index.js | 4 ++-- 7 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 SAS/TMSS/frontend/tmss_webapp/.vscode/launch.json diff --git a/SAS/TMSS/frontend/tmss_webapp/.vscode/launch.json b/SAS/TMSS/frontend/tmss_webapp/.vscode/launch.json new file mode 100644 index 00000000000..562cc640775 --- /dev/null +++ b/SAS/TMSS/frontend/tmss_webapp/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:3000", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js index 12520b372ca..fd303672460 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/ViewTable.js @@ -963,7 +963,7 @@ function ViewTable(props) { }, disableFilters: true, disableSortBy: true, - isVisible: defaultdataheader.includes(props.keyaccessor), + isVisible: true, }); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js index 8a5fe8ea36c..bde2f9d803f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Task/view.js @@ -253,7 +253,7 @@ export class TaskView extends Component { } </div> </div> */} - <PageHeader location={this.props.location} title={'Task - View'} + <PageHeader location={this.props.location} title={'Task - Details'} actions={actions}/> { this.state.isLoading? <AppLoader /> : this.state.task && <React.Fragment> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.create.js index c59daa3c9e9..9e8b62e630b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.create.js @@ -3,20 +3,19 @@ import { Redirect } from 'react-router-dom'; import _ from 'lodash'; import moment from 'moment'; import { Growl } from 'primereact/components/growl/Growl'; -import AppLoader from '../../layout/components/AppLoader'; -import PageHeader from '../../layout/components/PageHeader'; -import UIConstants from '../../utils/ui.constants'; -import Flatpickr from "react-flatpickr"; -import { InputMask } from 'primereact/inputmask'; import { Dropdown } from 'primereact/dropdown'; import {InputText } from 'primereact/inputtext'; import { InputTextarea } from 'primereact/inputtextarea'; import { Button } from 'primereact/button'; import { Dialog } from 'primereact/components/dialog/Dialog'; +import Flatpickr from "react-flatpickr"; + +import AppLoader from '../../layout/components/AppLoader'; +import PageHeader from '../../layout/components/PageHeader'; +import UIConstants from '../../utils/ui.constants'; import { CustomDialog } from '../../layout/components/CustomDialog'; import ProjectService from '../../services/project.service'; import ReservationService from '../../services/reservation.service'; -import UnitService from '../../utils/unit.converter'; import Jeditor from '../../components/JSONEditor/JEditor'; import UtilService from '../../services/util.service'; @@ -317,6 +316,10 @@ export class ReservationCreate extends Component { let jeditor = null; if (schema) { + if (this.state.reservation.specifications_doc) { + delete this.state.reservation.specifications_doc.$id; + delete this.state.reservation.specifications_doc.$schema; + } jeditor = React.createElement(Jeditor, {title: "Reservation Parameters", schema: schema, initValue: this.state.paramsOutput, diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.edit.js index bb668b5e2a3..9c0329023f5 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.edit.js @@ -70,11 +70,13 @@ export class ReservationEdit extends Component { const promises = [ ProjectService.getProjectList(), ReservationService.getReservationTemplates(), + UtilService.getUTC() ]; let emptyProjects = [{url: null, name: "Select Project"}]; Promise.all(promises).then(responses => { this.projects = emptyProjects.concat(responses[0]); this.reservationTemplates = responses[1]; + let systemTime = moment.utc(responses[2]); let schema = { properties: {} }; @@ -84,6 +86,7 @@ export class ReservationEdit extends Component { this.setState({ paramsSchema: schema, isLoading: false, + systemTime: systemTime }); this.getReservationDetails(reserId); }); @@ -320,7 +323,7 @@ export class ReservationEdit extends Component { delete this.state.reservation.specifications_doc.$id; delete this.state.reservation.specifications_doc.$schema; } - jeditor = React.createElement(Jeditor, {title: "Specification", + jeditor = React.createElement(Jeditor, {title: "Reservation Parameters", schema: this.state.reservationTemplate.schema, initValue: this.state.reservation.specifications_doc, disabled: false, @@ -377,7 +380,9 @@ export class ReservationEdit extends Component { "time_24hr": true, "minuteIncrement": 1, "allowInput": true, - + "defaultDate": this.state.systemTime.format(UIConstants.CALENDAR_DEFAULTDATE_FORMAT), + "defaultHour": this.state.systemTime.hours(), + "defaultMinute": this.state.systemTime.minutes() }} title="Start of this reservation" value={this.state.reservation.start_time} @@ -403,8 +408,10 @@ export class ReservationEdit extends Component { "time_24hr": true, "minuteIncrement": 1, "allowInput": true, - "minDate": this.state.reservation.start_time?this.state.reservation.start_time.toDate:'', - + "minDate": this.state.reservation.stop_time?this.state.reservation.stop_time.toDate:'', + "defaultDate": this.state.systemTime.format(UIConstants.CALENDAR_DEFAULTDATE_FORMAT), + "defaultHour": this.state.systemTime.hours(), + "defaultMinute": this.state.systemTime.minutes() }} title="End of this reservation. If empty, then this reservation is indefinite." value={this.state.reservation.stop_time} diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.view.js index 8ad8e6f17c7..1b7d7bfd83f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/reservation.view.js @@ -50,7 +50,7 @@ export class ReservationView extends Component { /** - * To get the task details from the backend using the service + * To get the Reservation details from the backend using the service * @param {number} Reservation Id */ getReservationDetails(id) { @@ -91,7 +91,7 @@ export class ReservationView extends Component { } /** - * Prepare Task details to show on confirmation dialog + * Prepare Reservation details to show on confirmation dialog */ getDialogContent() { let reservation = this.state.reservation; @@ -145,7 +145,7 @@ export class ReservationView extends Component { delete this.state.reservation.specifications_doc.$id; delete this.state.reservation.specifications_doc.$schema; } - jeditor = React.createElement(Jeditor, {title: "Specification", + jeditor = React.createElement(Jeditor, {title: "Reservation Parameters", schema: this.state.reservationTemplate.schema, initValue: this.state.reservation.specifications_doc, disabled: true, @@ -153,14 +153,14 @@ export class ReservationView extends Component { } let actions = [ ]; - actions.push({ icon: 'fa-edit', title:'Click to Edit Task', props : { pathname:`/su/timelineview/reservation/edit/${this.state.reservation?this.state.reservation.id:null}`}}); - actions.push({ icon: 'fa fa-trash',title:'Delete Reservation', + actions.push({ icon: 'fa-edit', title:'Click to Edit Reservation', props : { pathname:`/su/timelineview/reservation/edit/${this.state.reservation?this.state.reservation.id:null}`}}); + actions.push({ icon: 'fa fa-trash',title:'Click to Delete Reservation', type: 'button', actOn: 'click', props:{ callback: this.showConfirmation}}); actions.push({ icon: 'fa-window-close', link: this.props.history.goBack, title:'Click to Close Reservation', props : { pathname:'/su/timelineview/reservation/list' }}); return ( <React.Fragment> - <PageHeader location={this.props.location} title={'Reservation - View'} actions={actions}/> + <PageHeader location={this.props.location} title={'Reservation – Details'} actions={actions}/> { this.state.isLoading? <AppLoader /> : this.state.reservation && <React.Fragment> <div className="main-content"> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/index.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/index.js index ff63e5147e1..51d16425402 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/index.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/index.js @@ -53,8 +53,8 @@ export const routes = [ },{ path: "/task/view/:type/:id", component: TaskView, - name: 'Task Details', - title: 'Task Details' + name: 'Task View', + title: 'Task - View' },{ path: "/task/edit", component: TaskEdit, -- GitLab