From ac7fc7efd28da648dda08075f3029c71b0a54fab Mon Sep 17 00:00:00 2001 From: Muthukrishnan <m.krishnan@redkarma.eu> Date: Thu, 26 Nov 2020 17:19:45 +0530 Subject: [PATCH] TMSS-370 - code changes for SU constraint Implemented the the SU constraint in Excel sheet view --- .../components/Spreadsheet/BetweenEditor.js | 272 +++++------ .../components/Spreadsheet/BetweenRenderer.js | 20 +- .../components/Spreadsheet/CustomDateComp.js | 78 ++++ .../components/Spreadsheet/DateTimePicker.js | 47 -- .../components/Spreadsheet/DegreeInputmask.js | 1 + .../components/Spreadsheet/MultiSelector.js | 26 +- .../Spreadsheet/RenderTimeInputmask.js | 60 --- .../components/Spreadsheet/numericEditor.js | 2 - .../tmss_webapp/src/layout/_overrides.scss | 6 + .../routes/Scheduling/create.scheduleset.js | 431 +++++++++++++----- .../src/services/schedule.service.js | 1 - 11 files changed, 560 insertions(+), 384 deletions(-) create mode 100644 SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComp.js delete mode 100644 SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/DateTimePicker.js delete mode 100644 SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/RenderTimeInputmask.js diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenEditor.js index 7441bb11204..e45be6b4f9b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenEditor.js @@ -1,161 +1,173 @@ import React, { Component } from 'react'; -import ReactDOM from 'react-dom'; -import { AgGridReact } from 'ag-grid-react'; -import DateTimePicker from './DateTimePicker'; -import 'ag-grid-community/dist/styles/ag-grid.css'; -import 'ag-grid-community/dist/styles/ag-theme-alpine.css'; -import CustomDateComponent from '../../components/Spreadsheet/CustomDateComponent'; + +import {Calendar} from 'primereact/calendar'; +import { Dialog } from 'primereact/dialog'; +import { Button } from 'primereact/button'; + import moment from 'moment'; import _ from 'lodash'; -const DATE_TIME_FORMAT = 'DD-MMM-YYYY HH:mm:SS'; +const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; export default class BetweenEditor extends Component { constructor(props) { super(props); - this.gridApi = '' - this.gridColumnApi = '' + this.tmpRowData = []; + this.state = { - columnDefs: [ - {headerName: "From", field: "from",editable: true, cellEditor: 'agDateInput', valueSetter: 'newValueSetter' }, - {headerName: "Until", field: "until",editable: true, cellEditor: 'agDateInput', valueSetter: 'newValueSetter'}, - ], - - frameworkComponents: { - datePicker: DateTimePicker, - agDateInput: CustomDateComponent - }, - context: { componentParent: this }, + showDialog: false, + dialogTitle: '', }; - this.onGridReady = this.onGridReady.bind(this); - this.newValueSetter = this.newValueSetter(this); - this.rowData= [ - {from: "12-Oct-2020 10:10:12", until: "22-Oct-2020 10:10:12"}, - {from: "13-Oct-2020 10:10:12", until: "23-Oct-2020 10:10:12"}, - {from: "14-Oct-2020 10:10:12", until: "24-Oct-2020 10:10:12"}, - {from: "", until: ""} - ]; - } - newValueSetter(params){ - console.log('newValueSetter',params) - return true; + this.copyDateValue = this.copyDateValue.bind(this); } - - getConsolidateDate(){ - let consolidateDateValue = ''; - this.state.rowData.forEach(rowDate =>{ - if(rowDate['from'] !== '' || rowDate['until'] !== '') - consolidateDateValue += moment(rowDate['from']).format(DATE_TIME_FORMAT)+','+moment(rowDate['fruntilom']).format(DATE_TIME_FORMAT)+'|' - }) - return consolidateDateValue; + + isPopup() { + return true; } - async updateTime(rowIndex, field, value){ - console.log('value',value); - value = moment(value).format(DATE_TIME_FORMAT); - let row = this.state.rowData[rowIndex]; - row[field] = value; - let tmpRowData =this.state.rowData; - tmpRowData[rowIndex]= row; - let tmpRow = this.state.rowData[this.state.rowData.length-1]; - if(tmpRow['from'] !== '' || tmpRow['until'] !== '' ){ - let line = {}; - line['from'] = ''; - line['until'] = ''; - tmpRowData.push(line); + /** + * Init the date value if exists + */ + async componentDidMount(){ + let parentRows = this.props.agGridReact.props.rowData[this.props.node.rowIndex]; + let parentCellData = parentRows[this.props.colDef.field]; + this.tmpRowData = []; + if(parentCellData){ + let cellDataArray = _.split(parentCellData, '|'); + await cellDataArray.forEach(dataVal =>{ + let line = {}; + let dataValue = _.split(dataVal, ','); + line['from'] = (dataValue[0])? moment(dataValue[0]).toDate():''; + line['until'] = ( dataValue[1])? moment(dataValue[1]).toDate():''; + this.tmpRowData.push(line); + }); + } + if(this.tmpRowData.length>0){ + let row = this.tmpRowData[this.tmpRowData.length-1]; + if((row['from'] !== '' && row['from'] !== 'undefined') && (row['until'] !== '' && row['until'] !== 'undefined')){ + let line = {'from': '', 'until': ''}; + this.tmpRowData.push(line); + } + }else{ + let line = {'from': '', 'until': ''}; + this.tmpRowData.push(line); } - await this.setState({ - rowData: tmpRowData - }); - - this.state.gridApi.setRowData(this.state.rowData); - this.state.gridApi.redrawRows(); - - let parentRow = this.props.agGridReact.props.rowData[this.props.node.rowIndex]; - parentRow[this.props.colDef.field] = this.getConsolidateDate(); - // this.props.agGridReact.props.rowData[this.props.node.rowIndex] = parentRow; - /* this.props.agGridReact.props.setState({ - rowData: this.props.agGridReact.props.rowData - }) */ + await this.setState({ + rowData: this.tmpRowData, + dialogTitle: (this.props.colDef.field === 'between') ? this.props.colDef.field : 'Not-Between', + showDialog: true, + }); - /* - await this.props.context.componentParent.updateTimeValue( - this.props.node.rowIndex,this.props.colDef.field,this.getConsolidateDate() - ); - */ } + + /*isCancelAfterEnd(){console.log('after') + console.log('called') + this.copyDateValue(); + }*/ + /** + * Call the function on click Esc or Close the dialog + */ +async copyDateValue(){ + let consolidateDates = ''; + this.state.rowData.map(row =>{ + if((row['from'] !== '' && row['from'] !== 'undefined') && (row['until'] !== '' && row['until'] !== 'undefined')){ + consolidateDates += ((row['from'] !== '')?moment(row['from']).format(DATE_TIME_FORMAT):'' )+","+((row['until'] !== '')?moment(row['until']).format(DATE_TIME_FORMAT):'')+"|"; + } + }) + + await this.props.context.componentParent.updateTime( + this.props.node.rowIndex,this.props.colDef.field, consolidateDates + ); + this.setState({ showDialog: false}); + +} - isPopup() { - return true; +/* + Set value in relevant field + */ +updateDateChanges(rowIndex, field, e){ + let tmpRows = this.state.rowData; + let row = tmpRows[rowIndex]; + row[field] = e.value; + tmpRows[rowIndex] = row; + if(this.state.rowData.length === rowIndex+1){ + let line = {'from': '', 'until': ''}; + tmpRows.push(line); } + this.setState({ + rowData: tmpRows + }) +} - componentDidMount(){ - let row = this.props.agGridReact.props.rowData[this.props.node.rowIndex]; - let cellData = row[this.props.colDef.field]; - let rowDataTmp = []; - if(cellData){ - let cellDataArray = _.split(cellData, '|'); - cellDataArray.forEach(dataVal =>{ - let line = {}; - let dataValue = _.split(dataVal, ','); - line['from'] = (dataValue[0])? moment(dataValue[0]).format(DATE_TIME_FORMAT):''; - line['until'] = ( dataValue[1])? moment(dataValue[1]).format(DATE_TIME_FORMAT):''; - rowDataTmp.push(line); - }); - } - let line = {}; - line['from'] = ''; - line['until'] = ''; - rowDataTmp.push(line); - this.setState({ - rowData: rowDataTmp - // rowData: this.rowData - }) - } - async onGridReady (params) { - await this.setState({ - gridApi:params.api, - gridColumnApi:params.columnApi, - }) - this.state.gridApi.hideOverlay(); +/* + Remove the the row from dialog +*/ +removeInput(rowIndex){ + let tmpRows = this.state.rowData; + delete tmpRows[rowIndex]; + this.setState({ + rowData: tmpRows + }) } render() { - return ( - <> - {this.state.rowData && - <div - className="ag-theme-balham" - style={{ height: '200px', width: '430px' }} - > - <AgGridReact - columnDefs={this.state.columnDefs} - frameworkComponents={this.state.frameworkComponents} - rowData={this.state.rowData} - context={this.state.context} - onGridReady={this.onGridReady} - > - </AgGridReact> - </div> + <> + {this.state.rowData && this.state.rowData.length > 0 && + <Dialog header={_.startCase(this.state.dialogTitle)} visible={this.state.showDialog} maximized={false} + onHide={() => {this.copyDateValue()}} inputId="confirm_dialog" + footer={<div> + <Button key="back" label="Close" onClick={() => {this.copyDateValue()}} /> + </div> + } > + <div className="ag-theme-balham" style={{ height: '500px', width: '560px', paddingLeft: '20px' }}> + <div className="p-field p-grid" > + <React.Fragment> + <label key={'labelFrom'} className="col-lg-6 col-md-6 col-sm-12">From</label> + <label key={'labelUntil'} className="col-lg-4 col-md-5 col-sm-12">Until</label> + <label key={'labelRemove'} className="col-lg-2 col-md-2 col-sm-12">Remove</label> + </React.Fragment> + </div> + {this.state.rowData.map((bdate, index) => ( + <React.Fragment key={index}> + <div className="p-field p-grid" > + <Calendar + d dateFormat="dd-M-yy" + value= {this.state.rowData[index].from} + onChange= {e => {this.updateDateChanges(index, 'from', e)}} + // onBlur= {e => {this.updateDateChanges(index, 'from', e)}} + showTime={true} + showSeconds={true} + hourFormat="24" + showIcon={true} + /> + <Calendar + d dateFormat="dd-M-yy" + value= {this.state.rowData[index].until} + onChange= {e => {this.updateDateChanges(index, 'until', e)}} + // onBlur= {e => {this.updateDateChanges(index, 'until', e)}} + showTime={true} + showSeconds={true} + hourFormat="24" + showIcon={true} + style={{marginLeft:'60px'}} + /> + {this.state.rowData.length !== (index+1) && + <button className="p-link" style={{marginLeft: '6vw'}} onClick={(e) => this.removeInput(index)} > + <i className="fa fa-trash pi-error"></i></button> + } + </div> + + </React.Fragment> + ))} + </div> + </Dialog> } </> ); } - - -processRowPostCreate(params){ - console.log('-----------------------------------------') - if (params) { - const eRow = params.eRow; - console.dir(eRow); // no error - console.log(eRow.innerHTML); // innerHTML undefined - } -} -processCellFromClipboard(params){ - console.log('-----------------------------------------') -} + } \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenRenderer.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenRenderer.js index 4f756d6ed3a..a73a976c00c 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenRenderer.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/BetweenRenderer.js @@ -1,27 +1,17 @@ import React, { Component } from 'react'; import moment from 'moment'; - -const DATE_TIME_FORMAT = 'DD-MMM-YYYY HH:mm:SS'; - + export default class BetweenRenderer extends Component { constructor(props) { super(props); } + /** + Show cell value in grid + */ render() { - - let row = this.props.agGridReact.props.rowData[this.props.node.rowIndex]; - // console.log('row',row) - // console.log('CDM:', this.props.node.rowIndex,this.props.colDef.field, row[this.props.colDef.field]); - //console.log('>>', console.log('CDM:', this.props.node.rowIndex,this.props.colDef.field, this.props.agGridReact.props.rowData)) - /** - * Get relevant cell value an set here - */ + let row = this.props.agGridReact.props.rowData[this.props.node.rowIndex]; let datavalue = row[this.props.colDef.field]; - if(datavalue){ - datavalue = moment(datavalue).format(DATE_TIME_FORMAT) - } - //console.log('datavalue ',datavalue) return <> {datavalue && datavalue }</>; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComp.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComp.js new file mode 100644 index 00000000000..9c375937e2d --- /dev/null +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/CustomDateComp.js @@ -0,0 +1,78 @@ +import React, { Component } from 'react'; +import {Calendar} from 'primereact/calendar'; +import moment from 'moment'; + +const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:SS'; + +export default class CustomDateComp extends Component { + constructor(props) { + super(props); + + this.state = { + date: '', + }; + } + + isPopup() { + return true; + } + + isCancelAfterEnd(){ + let date = (this.state.date !== '' && this.state.date !== 'undefined')? moment(this.state.date).format(DATE_TIME_FORMAT) :''; + this.props.context.componentParent.updateTime( + this.props.node.rowIndex,this.props.colDef.field, date + ); + } + + render() { + return ( + <Calendar + d dateFormat="dd-M-yy" + value= {this.state.date} + onChange= {e => {this.updateDateChanges(e)}} + onBlur= {e => {this.updateDateChanges(e)}} + //data-testid="start" + showTime= {true} + showSeconds= {true} + hourFormat= "24" + showIcon= {true} + /> + ); + } + + + updateDateChanges(e){ + if(e.value){ + this.setState({date : e.value}); + } + } + + ondatechange(e){ + this.setState({date : e.value}); + } + + getDate() { + return this.state.date; + } + + setDate(date) { + this.setState({ date }); + this.picker.setDate(date); + } + + updateAndNotifyAgGrid(date) { + this.setState( + { + date, + }, + this.props.onDateChanged + ); + } + + + onDateChanged = (selectedDates) => { + this.props.context.componentParent.updateTime( + this.props.node.rowIndex,this.props.colDef.field,selectedDates[0] + ); + }; +} \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/DateTimePicker.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/DateTimePicker.js deleted file mode 100644 index d760f845bea..00000000000 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/DateTimePicker.js +++ /dev/null @@ -1,47 +0,0 @@ -import React, { Component } from 'react'; -import Flatpickr from 'flatpickr'; -import "flatpickr/dist/flatpickr.css"; -import 'ag-grid-community/dist/styles/ag-grid.css'; -import 'ag-grid-community/dist/styles/ag-theme-alpine.css'; - -export default class BetweenEditor extends Component { - constructor(props) { - super(props); - this.state ={ - date:'', - } - } - - isPopup() { - return true; - } - -render() { - return ( - <div - className="ag-theme-balham" - style={{ height: '300px', width: '300px' }} - > - <Flatpickr - data-enable-time={true} - value={this.state.date} - wrap={true} - showClearButton= {true} - inlineHideInput= {true} - defaultHour= {0} - defaultMinute= {1} - enableSeconds= {true} - defaultSecond= {0} - hourIncrement= {1} - minuteIncrement= {1} - secondIncrement= {5} - time_24hr= {true} - allowInput= {true} - - /> - </div> - ); -} -} - - diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/DegreeInputmask.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/DegreeInputmask.js index 151b9edb3cc..8273e0725eb 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/DegreeInputmask.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/DegreeInputmask.js @@ -2,6 +2,7 @@ import React, { Component } from 'react'; import { InputMask } from 'primereact/inputmask'; import Validator from '../../utils/validator'; + export default class DegreeInputMask extends Component { constructor(props) { super(props); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/MultiSelector.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/MultiSelector.js index e2a98131457..39bef1ccea1 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/MultiSelector.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/MultiSelector.js @@ -5,11 +5,11 @@ import _ from 'lodash'; export default class SkySllector extends Component { constructor(props) { super(props); - + this.dailyOptions= [ - {name: 'Day', code: 'Day'}, - {name: 'Night', code: 'Night'}, - {name: 'Twilight', code: 'Twilight'}, + {name: 'require_day', code: 'require_day'}, + {name: 'require_night', code: 'require_night'}, + {name: 'avoid_twilight', code: 'avoid_twilight'}, ]; this.state= { daily: '', @@ -19,6 +19,20 @@ export default class SkySllector extends Component { this.callbackUpdateDailyCell = this.callbackUpdateDailyCell.bind(this); } + async componentDidMount(){ + let selectedValues = this.props.data['daily']; + if(selectedValues){ + + } + console.log('this.props.props',this.props.data['daily']) + + // this.props.props. + /* console.log('---',this.props.data['daily']) + await this.setState({ + daily: this.props.data['daily'] + })*/ + } + async callbackUpdateDailyCell(e) { let isValid = false; this.setState({ @@ -27,11 +41,11 @@ export default class SkySllector extends Component { let dailyValue = ''; let selectedValues = e.value; await selectedValues.forEach( key =>{ - dailyValue += key.name+", "; + dailyValue += key.name+","; }) dailyValue = _.trim(dailyValue) dailyValue = dailyValue.replace(/,([^,]*)$/, '' + '$1') - console.log('dailyValue',dailyValue) + this.props.context.componentParent.updateDailyCell( this.props.node.rowIndex,this.props.colDef.field,dailyValue ); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/RenderTimeInputmask.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/RenderTimeInputmask.js deleted file mode 100644 index c11bfe84597..00000000000 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/RenderTimeInputmask.js +++ /dev/null @@ -1,60 +0,0 @@ -import React, { Component } from 'react'; -import { InputMask } from 'primereact/inputmask'; -import Validator from '../../utils/validator'; - -export default class RenderTimeInputmask extends Component{ - constructor(props) { - super(props); - this.callbackUpdateAngle = this.callbackUpdateAngle.bind(this); - } - - callbackUpdateAngle(e) { - let isValid = false; - if(Validator.validateTime(e.value)){ - e.originalEvent.target.style.backgroundColor = ''; - isValid = true; - }else{ - e.originalEvent.target.style.backgroundColor = 'orange'; - } - - this.props.context.componentParent.updateAngle( - this.props.node.rowIndex,this.props.colDef.field,e.value,false,isValid - ); - - } - - /* - isPopup(){} - isCancelBeforeStart(){} - - focusIn(){} - focusOut(){} - destroy(){} - */ - - isCancelAfterEnd(){ - // console.log('params', this.props); - - // return false; - } - afterGuiAttached(){ - //this.input.input.focus(); - } - - - getValue(){ - // console.log(this.input.value) - } - render() { - return ( - <InputMask - value={this.props.value} - mask="99:99:99" - placeholder="HH:mm:ss" - className="inputmask" - onComplete={this.callbackUpdateAngle} - ref={input =>{this.input = input}} - /> - ); - } -} \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/numericEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/numericEditor.js index e759fd958dd..1662daa58c0 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/numericEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/numericEditor.js @@ -12,9 +12,7 @@ export default class NumericEditor extends Component { this.cancelBeforeStart = this.props.charPress && '1234567890'.indexOf(this.props.charPress) < 0; - this.state = this.createInitialState(props); - this.onKeyDown = this.onKeyDown.bind(this); this.handleChange = this.handleChange.bind(this); } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss b/SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss index 330a00a4d75..9e883c4cbbe 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss +++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss @@ -22,6 +22,12 @@ border-top: none; } } +.ag-root-wrapper{ + /* + calendar is overlaped by AG-grid table, so table props update to show calendar + */ + overflow: inherit; +} .tmss-table { overflow:auto; // since calendar getting inserted to table, because of above overflow, not getting visible diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.scheduleset.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.scheduleset.js index b8ec03f7deb..cb7f625de35 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.scheduleset.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.scheduleset.js @@ -1,32 +1,41 @@ import React, {Component} from 'react'; -import { Link, Redirect } from 'react-router-dom'; -import _ from 'lodash'; +import { Redirect } from 'react-router-dom'; import {Dropdown} from 'primereact/dropdown'; import { Button } from 'primereact/button'; import {Dialog} from 'primereact/components/dialog/Dialog'; import {Growl} from 'primereact/components/growl/Growl'; -import AppLoader from '../../layout/components/AppLoader'; -import ProjectService from '../../services/project.service'; -import ScheduleService from '../../services/schedule.service'; -import TaskService from '../../services/task.service'; -import UIConstants from '../../utils/ui.constants'; +import { AgGridReact } from 'ag-grid-react'; +import { AllCommunityModules } from '@ag-grid-community/all-modules'; import $RefParser from "@apidevtools/json-schema-ref-parser"; + import TimeInputmask from './../../components/Spreadsheet/TimeInputmask' import DegreeInputmask from './../../components/Spreadsheet/DegreeInputmask' import NumericEditor from '../../components/Spreadsheet/numericEditor'; import BetweenEditor from '../../components/Spreadsheet/BetweenEditor'; import BetweenRenderer from '../../components/Spreadsheet/BetweenRenderer'; -import { MultiSelect } from 'primereact/multiselect'; import MultiSelector from '../../components/Spreadsheet/MultiSelector'; -import CustomDateComponent from '../../components/Spreadsheet/CustomDateComponent'; -import { AgGridReact } from 'ag-grid-react'; -import { AllCommunityModules } from '@ag-grid-community/all-modules'; +import AppLoader from '../../layout/components/AppLoader'; + +import PageHeader from '../../layout/components/PageHeader'; +import ProjectService from '../../services/project.service'; +import ScheduleService from '../../services/schedule.service'; +import TaskService from '../../services/task.service'; +import CustomDateComp from '../../components/Spreadsheet/CustomDateComp'; + +import Validator from '../../utils/validator'; +import UnitConverter from '../../utils/unit.converter' +import UIConstants from '../../utils/ui.constants'; +import UnitConversion from '../../utils/unit.converter'; + +import moment from 'moment'; +import _ from 'lodash'; + import 'ag-grid-community/dist/styles/ag-grid.css'; import 'ag-grid-community/dist/styles/ag-theme-alpine.css'; -import UnitConverter from '../../utils/unit.converter' -import Validator from '../../utils/validator'; -import PageHeader from '../../layout/components/PageHeader'; + +const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:SS'; + /** * Component to create / update Scheduling Unit Drafts using Spreadsheet */ @@ -37,11 +46,11 @@ export class SchedulingSetCreate extends Component { this.gridColumnApi = '' this.rowData = []; this.tmpRowData = []; + this.defaultCellValues = []; + this.daily = []; - this.dailyOption= ['Day', 'Night', 'Twilight']; this.state = { - daily: '', - + dailyOption: [], projectDisabled: (props.match?(props.match.params.project? true:false):false), isLoading: true, // Flag for loading spinner dialog: { header: '', detail: ''}, // Dialog properties @@ -71,7 +80,7 @@ export class SchedulingSetCreate extends Component { betweenRenderer: BetweenRenderer, betweenEditor: BetweenEditor, multiselector: MultiSelector, - agDateInput: CustomDateComponent + agDateInput: CustomDateComp }, columnTypes: { numberValueColumn: { @@ -107,8 +116,6 @@ export class SchedulingSetCreate extends Component { this.cancelCreate = this.cancelCreate.bind(this); this.clipboardEvent = this.clipboardEvent.bind(this); this.reset = this.reset.bind(this); - this.multiselector = this.multiselector.bind(this); - this.projects = []; // All projects to load project dropdown this.schedulingSets = []; // All scheduling sets to be filtered for project @@ -121,12 +128,6 @@ export class SchedulingSetCreate extends Component { scheduling_set_id: {required: true, message: "Select the Scheduling Set"}, }; } - - multiselector(){ - console.log('multi selector called') - let dailydata = ''; - return <MultiSelect value={dailydata} options={this.dailyOption} onChange={(e) => dailydata= e.value} /> - } componentDidMount() { const promises = [ ProjectService.getProjectList(), @@ -263,8 +264,7 @@ export class SchedulingSetCreate extends Component { } async getConstraintSchema(scheduleUnit){ - let constraintSchema = ScheduleService.getSchedulingConstraintTemplatesById(scheduleUnit.scheduling_constraints_template_id); - console.log('constraintSchema',constraintSchema); + let constraintSchema = await ScheduleService.getSchedulingConstraintTemplatesById(scheduleUnit.scheduling_constraints_template_id); return constraintSchema; } /** @@ -274,43 +274,48 @@ export class SchedulingSetCreate extends Component { async createGridColumns(scheduleUnit){ let schema = await this.getTaskSchema(scheduleUnit); schema = await this.resolveSchema(schema); - let constraintSchema = await this.getConstraintSchema(scheduleUnit); constraintSchema = await this.resolveSchema(constraintSchema); + // AG Grid Cell Specific Properties - + let dailyOption= []; + let dailyProps = Object.keys( constraintSchema.schema.properties.daily.properties); + this.daily = []; + dailyProps.forEach(prop => { + dailyOption.push({'Name':prop, 'Code':prop}); + this.daily.push(prop); + }) + + this.setState({ + dailyOption: this.dailyOption, + schedulingConstraintsDoc: scheduleUnit.scheduling_constraints_doc, + constraintUrl: scheduleUnit.scheduling_constraints_template, + constraintId: scheduleUnit.scheduling_constraints_template_id, + daily: this.daily, + }); + let cellProps =[]; - cellProps['angle1'] = {type:'numberValueColumn', cellRenderer: 'timeInputMask',cellEditor: 'timeInputMask', valueSetter: 'valueSetter' }; - cellProps['angle2'] = {type:'numberValueColumn', cellRenderer: 'degreeInputMask',cellEditor: 'degreeInputMask', valueSetter: 'valueSetter' }; - cellProps['angle3'] = {cellEditor: 'numericEditor',}; - cellProps['direction_type'] = {cellEditor: 'agSelectCellEditor',default: schema.definitions.pointing.properties.direction_type.default, + cellProps['angle1'] = {isgroup: true, type:'numberValueColumn', cellRenderer: 'timeInputMask',cellEditor: 'timeInputMask', valueSetter: 'valueSetter' }; + cellProps['angle2'] = {isgroup: true, type:'numberValueColumn', cellRenderer: 'degreeInputMask',cellEditor: 'degreeInputMask', valueSetter: 'valueSetter' }; + cellProps['angle3'] = {isgroup: true, cellEditor: 'numericEditor',}; + cellProps['direction_type'] = {isgroup: true, cellEditor: 'agSelectCellEditor',default: schema.definitions.pointing.properties.direction_type.default, cellEditorParams: { values: schema.definitions.pointing.properties.direction_type.enum, }, }; - //Constraint - /* cellProps['scheduler'] = {cellEditor: 'agSelectCellEditor',default: schema.properties.scheduler.default, - cellEditorParams: { - values: constraintSchema.properties.scheduler.enum, - }, - };*/ - cellProps['at'] = {cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter' ,}; - cellProps['after'] = {cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter' ,}; - cellProps['before'] = {cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter' ,}; - cellProps['daily'] = {cellEditor: 'multiselector', - cellEditorParams: { - values: ["Day","Night","Twilight"] - }, - }; + //Ag-grid Colums definition // Column order to use clipboard copy let colKeyOrder = []; + colKeyOrder.push("suname"); + colKeyOrder.push("sudesc"); + let columnMap = []; let colProperty = {}; let columnDefs = [ { // Row Index - headerName: '', + headerName: '#', editable: false, maxWidth: 60, cellRenderer: 'rowIdRenderer', @@ -325,43 +330,56 @@ export class SchedulingSetCreate extends Component { {headerName: 'Description',field: 'sudesc'} ], }, - { headerName: 'Time', - children: [ - // { headerName: 'At ', field:'timeat', editable: true, cellEditor: 'agDateInput'}, - { headerName: 'At ', field:'timeat', editable: true, cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter'}, - { headerName: 'After ', field:'timeafter', editable: true, cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter'}, - { headerName: 'Before ', field:'timebefore', editable: true, cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter'}, - ],}, - {headerName: 'Between',field: 'between',cellRenderer: 'betweenRenderer',cellEditor: 'betweenEditor',}, - {headerName: 'Not-Between',field: 'notbetween',cellRenderer: 'betweenRenderer',cellEditor: 'betweenEditor',}, - - {headerName: 'Daily',field: 'daily',cellEditor: 'multiselector', valueSetter: 'valueSetter'}, - { - headerName: 'Sky', - children: [ - {headerName: 'Min Target Elevation',field: 'min_target_elevation', }, - {headerName: 'Min Calibrator Elevation',field: 'min_calibrator_elevation', }, - {headerName: 'Offset Window From',field: 'offset_from', }, - {headerName: 'Offset Window To',field: 'offset_to', }, - ], - }, - { - headerName: 'Min_distance', + {headerName: 'Scheduler',field: 'scheduler',cellEditor: 'agSelectCellEditor',default: constraintSchema.schema.properties.scheduler.default, + cellEditorParams: { + values: constraintSchema.schema.properties.scheduler.enum, + }, + }, + { headerName: 'Time', children: [ - {headerName: 'Sun',field: 'md_sun', }, - {headerName: 'Moon',field: 'md_moon', }, - {headerName: 'Jupiter',field: 'md_jupiter', }, - ], - }, + { headerName: 'At', field:'timeat', editable: true, cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter'}, + { headerName: 'After', field:'timeafter', editable: true, cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter'}, + { headerName: 'Before', field:'timebefore', editable: true, cellRenderer: 'betweenRenderer',cellEditor: 'agDateInput', valueSetter: 'newValueSetter'}, + ], + }, + {headerName: 'Between',field: 'between',cellRenderer: 'betweenRenderer',cellEditor: 'betweenEditor',valueSetter: 'newValueSetter'}, + {headerName: 'Not Between',field: 'notbetween',cellRenderer: 'betweenRenderer',cellEditor: 'betweenEditor',valueSetter: 'newValueSetter'}, + {headerName: 'Daily',field: 'daily',cellEditor: 'multiselector', valueSetter: 'valueSetter'}, + { + headerName: 'Sky', + children: [ + {headerName: 'Min Target Elevation',field: 'min_target_elevation', }, + {headerName: 'Min Calibrator Elevation',field: 'min_calibrator_elevation', }, + {headerName: 'Offset Window From',field: 'offset_from', }, + {headerName: 'Offset Window To',field: 'offset_to', }, + ], + }, + { + headerName: 'Min_distance', + children: [ + {headerName: 'Sun',field: 'md_sun', }, + {headerName: 'Moon',field: 'md_moon', }, + {headerName: 'Jupiter',field: 'md_jupiter', }, + ], + }, ]; - colKeyOrder.push("suname"); - colKeyOrder.push("sudesc"); - colKeyOrder.push("bfrom"); - colKeyOrder.push("buntil"); + colKeyOrder.push('scheduler'); + colKeyOrder.push('timeat'); + colKeyOrder.push('timeafter'); + colKeyOrder.push('timebefore'); + colKeyOrder.push('between'); + colKeyOrder.push('notbetween'); + colKeyOrder.push('daily'); + colKeyOrder.push('min_target_elevation'); + colKeyOrder.push('min_calibrator_elevation'); + colKeyOrder.push('offset_from'); + colKeyOrder.push('offset_to'); + colKeyOrder.push('md_sun'); + colKeyOrder.push('md_moon'); + colKeyOrder.push('md_jupiter'); colProperty ={'ID':'id', 'Name':'suname', 'Description':'sudesc'}; columnMap['Scheduling Unit'] = colProperty; - let definitions = schema.definitions.pointing.properties; let properties = schema.properties; @@ -467,7 +485,6 @@ export class SchedulingSetCreate extends Component { * CallBack Function : update time value in master grid */ async updateTime(rowIndex, field, value){ - console.log('updateTime => value:',value) let row = this.state.rowData[rowIndex]; row[field] = value; let tmpRowData =this.state.rowData; @@ -475,29 +492,17 @@ export class SchedulingSetCreate extends Component { await this.setState({ rowData: tmpRowData }); - this.state.gridApi.setRowData(this.state.rowData); this.state.gridApi.redrawRows(); } - async updateTimeValue(rowIndex, field, value){ - console.log('updateTime => value:',value) - let row = this.state.rowData[rowIndex]; - row[field] = value; - let tmpRowData =this.state.rowData; - tmpRowData[rowIndex]= row; - await this.setState({ - rowData: tmpRowData - }); - - this.state.gridApi.setRowData(this.state.rowData); - this.state.gridApi.redrawRows(); - return ''; - } - + /** + * Update the Daily column value from external component + * @param {*} rowIndex + * @param {*} field + * @param {*} value + */ async updateDailyCell(rowIndex, field, value){ - console.log('updateDailyCell => value:',rowIndex, field, value) - let row = this.state.rowData[rowIndex]; row[field] = value; let tmpRowData =this.state.rowData; @@ -506,13 +511,10 @@ export class SchedulingSetCreate extends Component { rowData: tmpRowData }); - this.state.gridApi.setRowData(this.state.rowData); - this.state.gridApi.redrawRows(); - } - - cellEditingStarted(){ - console.log('cellEditingStarted') + // this.state.gridApi.setRowData(this.state.rowData); + // this.state.gridApi.redrawRows(); } + /** * Function to prepare ag-grid row data. */ @@ -522,7 +524,6 @@ export class SchedulingSetCreate extends Component { } this.tmpRowData = []; let totalSU = this.state.noOfSU; - let paramsOutput = {}; //refresh column header await this.createGridColumns(this.state.schedulingUnitList[0]); let observationPropsList = []; @@ -537,8 +538,8 @@ export class SchedulingSetCreate extends Component { let parameters = scheduleunit['requirements_doc'].parameters; for(const parameter of parameters){ - let rurl = parameter['refs']; - let valueItem = (await $RefParser.resolve( scheduleunit['requirements_doc'])).get(rurl[0]); + let refUrl = parameter['refs']; + let valueItem = (await $RefParser.resolve( scheduleunit['requirements_doc'])).get(refUrl[0]); let excelColumns = this.state.columnMap[parameter.name]; let excelColumnsKeys = Object.keys(excelColumns); for(const eColKey of excelColumnsKeys){ @@ -553,6 +554,38 @@ export class SchedulingSetCreate extends Component { } } } + + let constraint = scheduleunit.scheduling_constraints_doc; + if(constraint){ + if(constraint.scheduler){ + observationProps['scheduler'] = constraint.scheduler; + } + observationProps['timeat'] = moment.utc(constraint.time.at).format(DATE_TIME_FORMAT); + observationProps['timeafter'] = moment.utc(constraint.time.after).format(DATE_TIME_FORMAT); + observationProps['timebefore'] = moment.utc(constraint.time.before).format(DATE_TIME_FORMAT); + if(constraint.time.between){ + observationProps['between'] = this.getBetweenStringValue(constraint.time.between); + } + if(constraint.time.between){ + observationProps['notbetween'] = this.getBetweenStringValue(constraint.time.not_between); + } + + observationProps['daily'] = this.fetchDailyFieldValue(constraint.daily); + UnitConversion.radiansToDegree(constraint.sky); + observationProps['min_target_elevation'] = constraint.sky.min_target_elevation; + observationProps['min_calibrator_elevation'] = constraint.sky.min_calibrator_elevation; + if( constraint.sky.transit_offset ){ + observationProps['offset_from'] = (constraint.sky.transit_offset.from)?constraint.sky.transit_offset.from:''; + observationProps['offset_to'] = (constraint.sky.transit_offset.to)?constraint.sky.transit_offset.to:''; + } + + if(constraint.sky.min_distance){ + observationProps['md_sun'] = (constraint.sky.min_distance.sun)?constraint.sky.min_distance.sun:''; + observationProps['md_moon'] = (constraint.sky.min_distance.moon)?constraint.sky.min_distance.moon:''; + observationProps['md_jupiter'] = (constraint.sky.min_distance.jupiter)?constraint.sky.min_distance.jupiter:''; + } + + } observationPropsList.push(observationProps); } @@ -586,6 +619,24 @@ export class SchedulingSetCreate extends Component { }); } + /** + * Get Daily column value + * @param {*} daily + */ + fetchDailyFieldValue(daily){ + let returnValue = []; + if(daily.require_day === true){ + returnValue.push('require_day'); + } + if(daily.require_night === true){ + returnValue.push('require_night'); + } + if(daily.avoid_twilight === true){ + returnValue.push('avoid_twilight'); + } + return returnValue; + } + /** * Function called back from Degree/Time Input Mask to set value in row data. * @@ -602,7 +653,6 @@ export class SchedulingSetCreate extends Component { await this.setState({ rowData: tmpRowData }); - } /** @@ -611,7 +661,7 @@ export class SchedulingSetCreate extends Component { async readClipBoard(){ try{ const queryOpts = { name: 'clipboard-read', allowWithoutGesture: true }; - const permissionStatus = await navigator.permissions.query(queryOpts); + await navigator.permissions.query(queryOpts); let data = await navigator.clipboard.readText(); return data; }catch(err){ @@ -623,7 +673,7 @@ export class SchedulingSetCreate extends Component { * Check the content is JSON format * @param {*} jsonData */ - async isJsonData(jsonData){ + /* async isJsonData(jsonData){ try{ let jsonObj = JSON.parse(jsonData); return true; @@ -631,16 +681,34 @@ export class SchedulingSetCreate extends Component { console.log("error :",err) return false; } - } + } */ +/* + // to resolve the invalid degree and time + resolveCellData(data){ + console.log('data >',data) + let angleData = _.split(data, ":"); + let returnValue =''; + if(angleData.length === 3){ + console.log('angleData.length',returnValue) + returnValue = (angleData[0].length === 2)?angleData[0] :'0'+angleData[0]+":"; + returnValue += (angleData[1].length === 2)?angleData[1] :'0'+angleData[1]+":"; + returnValue += (angleData[2].length === 2)?angleData[2] :'0'+angleData[2]; + + } + console.log('returnValue',returnValue) + return returnValue; + }*/ + /** * Copy data to/from clipboard * @param {*} e */ async clipboardEvent(e){ +// let angleCellKey = ['tp1angle1','tp1angle2','tp2angle1','tp2angle2','tpangle1','tpangle2']; var key = e.which || e.keyCode; // keyCode detection var ctrl = e.ctrlKey ? e.ctrlKey : ((key === 17) ? true : false); // ctrl detection - if ( key == 86 && ctrl ) { + if ( key === 86 && ctrl ) { // Ctrl+V this.tmpRowData = this.state.rowData; let dataRowCount = this.state.totalCount; @@ -653,6 +721,7 @@ export class SchedulingSetCreate extends Component { console.log("error :",err); } if(clipboardData){ + clipboardData = _.trim(clipboardData); let suGridRowData= this.state.emptyRow; let suRows = clipboardData.split("\n"); suRows.forEach(line =>{ @@ -662,7 +731,11 @@ export class SchedulingSetCreate extends Component { suGridRowData['id']= 0; suGridRowData['isValid']= true; for(const key of this.state.colKeyOrder){ - suGridRowData[key]= suRow[colCount]; + // if(_.includes(angleCellKey, key)){ + // suGridRowData[key]= this.resolveCellData(suRow[colCount]); + // }else{ + suGridRowData[key]= suRow[colCount]; + // } colCount++; } this.tmpRowData[dataRowCount]= (suGridRowData); @@ -692,7 +765,7 @@ export class SchedulingSetCreate extends Component { console.error('Error: ', err); } - } else if ( key == 67 && ctrl ) { + } else if ( key === 67 && ctrl ) { //Ctrl+C var selectedRows = this.state.gridApi.getSelectedRows(); let clipboardData = ''; @@ -705,16 +778,15 @@ export class SchedulingSetCreate extends Component { clipboardData += line + '\r\n'; } clipboardData = _.trim(clipboardData); + const queryOpts = { name: 'clipboard-write', allowWithoutGesture: true }; await navigator.permissions.query(queryOpts); await navigator.clipboard.writeText(clipboardData); - - } } - /** + /** * Function to create Scheduling unit */ async saveSchedulingUnit() { @@ -764,10 +836,87 @@ export class SchedulingSetCreate extends Component { observStrategy.template.parameters.forEach(async(param, index) => { $refs.set(observStrategy.template.parameters[index]['refs'][0], paramsOutput['param_' + index]); }); + + let between = this.getBetWeenDateValue(suRow.between); + let notbetween = this.getBetWeenDateValue(suRow.notbetween); + + let isNewConstraint = false; + let newConstraint = {}; + let constraint = null; + if(suRow.id >0){ + newSU = _.find(this.state.schedulingUnitList, {'id': suRow.id}); + constraint = newSU.scheduling_constraints_doc; + } + + if( constraint === null || constraint === 'undefined' || constraint === {}){ + constraint = this.state.schedulingConstraintsDoc; + isNewConstraint = true; + } + + //If No SU Constraint create default ( maintan default struc) + constraint['scheduler'] = suRow.scheduler; + if(suRow.scheduler === 'online'){ + if(!constraint.time.at){ + delete constraint.time.at; + } + if (!constraint.time.after) { + delete constraint.time.after; + } + if (!constraint.time.before) { + delete constraint.time.before; + } + }else{ + constraint.time.at = `${moment(suRow.timeat).format("YYYY-MM-DDTHH:mm:ss.SSSSS", { trim: false })}Z`; + constraint.time.after = `${moment(suRow.timeafter).format("YYYY-MM-DDTHH:mm:ss.SSSSS", { trim: false })}Z`; + constraint.time.before = `${moment(suRow.timebefore).format("YYYY-MM-DDTHH:mm:ss.SSSSS", { trim: false })}Z`; + } + if(between && between.length>0){ + constraint.time.between = between; + } + if(notbetween && notbetween.length>0){ + constraint.time.not_between = notbetween; + } + let dailyValueSelected = _.split(suRow.daily, ","); + this.state.daily.forEach(daily =>{ + if(_.includes(dailyValueSelected, daily)){ + constraint.daily[daily] = true; + }else{ + constraint.daily[daily] = false; + } + }) + let min_distance_res = {}; + min_distance_res['sun'] = suRow.md_sun; + min_distance_res['moon'] = suRow.md_moon; + min_distance_res['jupiter'] = suRow.md_jupiter; + constraint.sky.min_distance = min_distance_res; + + let transit_offset_res = {}; + transit_offset_res['from'] = +suRow.offset_from; + transit_offset_res['to'] = +suRow.offset_to; + if(transit_offset_res){ + constraint.sky.transit_offset= transit_offset_res; + } + + constraint.sky.min_target_elevation = suRow.min_target_elevation; + constraint.sky.min_calibrator_elevation = suRow.min_calibrator_elevation; + + UnitConversion.degreeToRadians(constraint.sky); + if(isNewConstraint){ + newSU.scheduling_constraints_doc = constraint; + } + + if(suRow.id === 0){ + newConstraint['scheduling_constraints_doc'] = constraint; + newConstraint['id'] = this.state.constraintId; + newConstraint['constraint'] = {'url':''}; + newConstraint.constraint.url = this.state.constraintUrl; + } + if(suRow.id >0 && suRow.suname.length>0 && suRow.sudesc.length>0){ newSU = _.find(this.state.schedulingUnitList, {'id': suRow.id}); newSU['name'] = suRow.suname; newSU['description'] = suRow.sudesc; + newSU.requirements_doc.tasks= observStrategy.template.tasks; await ScheduleService.updateSUDraftFromObservStrategy(observStrategy, newSU, this.state.taskDrafts, this.state.tasksToUpdate); existingSUCount++; @@ -776,7 +925,7 @@ export class SchedulingSetCreate extends Component { newSU['id'] = suRow.id; newSU['name'] = suRow.suname; newSU['description'] = suRow.sudesc; - await ScheduleService.saveSUDraftFromObservStrategy(observStrategy, newSU); + await ScheduleService.saveSUDraftFromObservStrategy(observStrategy, newSU, newConstraint); newSUCount++; } } @@ -791,7 +940,44 @@ export class SchedulingSetCreate extends Component { this.growl.show({severity: 'error', summary: 'Error Occured', detail: 'Unable to create/update Scheduling Units'}); } } - + + /** + * Convert the date to string value for Between And Not-Between Columns + * @param {*} dates + */ + getBetweenStringValue(dates){ + let returnDate = ''; + if(dates){ + dates.forEach(utcDateArray =>{ + returnDate +=moment.utc(utcDateArray.from).format(DATE_TIME_FORMAT)+","; + returnDate +=moment.utc(utcDateArray.to).format(DATE_TIME_FORMAT)+"|"; + }) + } + return returnDate; + } + + /** + * convert String to Date value for Between And Not-Between Columns + */ + getBetWeenDateValue(betweenValue){ + let returnDate = []; + if(betweenValue){ + let rowDateArray = _.split(betweenValue, "|"); + rowDateArray.forEach(betweenDates =>{ + let betweendate = _.split(betweenDates, ","); + let dateres = {}; + if(betweendate && betweendate.length === 2){ + dateres['from'] = `${moment(betweendate[0]).format("YYYY-MM-DDTHH:mm:SS.SSSSS", { trim: false })}Z`; + dateres['to'] = `${moment(betweendate[1]).format("YYYY-MM-DDTHH:mm:SS.SSSSS", { trim: false })}Z`; + returnDate.push(dateres); + } + }) + + } + return returnDate; + } + + /** * Refresh the grid with updated data */ @@ -883,7 +1069,6 @@ export class SchedulingSetCreate extends Component { return this.validEditor?true:false; } - render() { if (this.state.redirect) { return <Redirect to={ {pathname: this.state.redirect} }></Redirect> @@ -955,7 +1140,7 @@ export class SchedulingSetCreate extends Component { </div> <> {this.state.observStrategy.id && - <div className="ag-theme-alpine" style={ { height: '500px', marginBottom: '10px' } } onKeyDown={this.clipboardEvent}> + <div className="ag-theme-alpine" style={ {overflowX: 'inherit !importent', height: '500px', marginBottom: '10px' } } onKeyDown={this.clipboardEvent}> <AgGridReact suppressClipboardPaste={false} columnDefs={this.state.columnDefs} diff --git a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js index 1b97778f05f..f4be4e84578 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -281,7 +281,6 @@ const ScheduleService = { }, updateSchedulingUnitDraft: async function(schedulingUnit) { try { - // console.log(schedulingUnit); schedulingUnit.scheduling_constraints_doc = ( schedulingUnit.scheduling_constraints_doc == null)?"": schedulingUnit.scheduling_constraints_doc; const suUpdateResponse = await axios.put(`/api/scheduling_unit_draft/${schedulingUnit.id}/`, schedulingUnit); return suUpdateResponse.data; -- GitLab