diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/StationEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/StationEditor.js index c53a00fa549e61f66f0c9bcdd79c1149dcd3ad97..4932718b6ca1c12dded9e5769cb723570c84a7c2 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/StationEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/Spreadsheet/StationEditor.js @@ -3,12 +3,8 @@ import React, { Component } from 'react'; import { Dialog } from 'primereact/dialog'; import { Button } from 'primereact/button'; import Stations from '../../routes/Scheduling/Stations'; - -import moment from 'moment'; import _ from 'lodash'; -const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; - export default class StationEditor extends Component { constructor(props) { super(props); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js index fbaedad7376b3499142ec76b1baa00a43f9f66a2..d2c7e01c63d7f72528eb66d0791b5f0a51a9f2ca 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js @@ -233,13 +233,7 @@ export default (props) => { setCustomStations(custom_selected_options); updateSchedulingComp(state, selectedStations, missing_StationFieldsErrors, custom_selected_options); }; - - /** - * Funtion required to popup the component in AG-Grid - */ - const isPopup =() =>{ - return true; - } + return ( <div className={`p-field p-grid grouping p-fluid ${props.isSummary && 'p-col-12'}`} style={{height: props.height}}> <fieldset> 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 09a1b306c5784cbc624cf3f1c047c127192126ce..a280d8c6cae49ba60597b2c4041bf93b471246b9 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 @@ -1085,61 +1085,7 @@ export class SchedulingSetCreate extends Component { async clipboardEvent(e){ var key = e.which || e.keyCode; var ctrl = e.ctrlKey ? e.ctrlKey : ((key === 17) ? true : false); - if ( key === 86 && ctrl ) { - // Ctrl+V - this.tmpRowData = this.state.rowData; - let dataRowCount = this.state.totalCount; - try { - let clipboardData = ''; - try{ - //Read Clipboard Data - clipboardData = await this.readClipBoard(); - }catch(err){ - console.log("error :",err); - } - if (clipboardData){ - clipboardData = _.trim(clipboardData); - let suGridRowData= this.state.emptyRow; - clipboardData = _.trim(clipboardData); - let suRows = clipboardData.split("\n"); - suRows.forEach(line =>{ - let colCount = 0; - suGridRowData ={}; - let suRow = line.split("\t"); - suGridRowData['id']= 0; - suGridRowData['isValid']= true; - for(const key of this.state.colKeyOrder){ - suGridRowData[key]= suRow[colCount]; - colCount++; - } - this.tmpRowData[dataRowCount]= (suGridRowData); - dataRowCount++ - }) - } - let emptyRow = this.state.emptyRow; - let tmpNoOfSU= this.state.noOfSU; - if (dataRowCount >= tmpNoOfSU){ - tmpNoOfSU = dataRowCount+5; - //Create additional empty row at the end - for(let i= this.tmpRowData.length; i<=tmpNoOfSU; i++){ - this.tmpRowData.push(emptyRow); - } - } - - await this.setState({ - rowData: this.tmpRowData, - noOfSU: this.tmpRowData.length, - totalCount: dataRowCount, - }) - - this.state.gridApi.setRowData(this.state.rowData); - this.state.gridApi.redrawRows(); - - }catch (err) { - console.error('Error: ', err); - } - - } else if ( key === 67 && ctrl ) { + if ( key === 67 && ctrl ) { //Ctrl+C var columnsName = this.state.gridColumnApi.getAllGridColumns(); var selectedRows = this.state.gridApi.getSelectedRows(); @@ -1168,6 +1114,73 @@ export class SchedulingSetCreate extends Component { const queryOpts = { name: 'clipboard-write', allowWithoutGesture: true }; await navigator.permissions.query(queryOpts); await navigator.clipboard.writeText(clipboardData); + } + else if ( key === 86 && ctrl ) { + // Ctrl+V + try { + var selectedRows = this.state.gridApi.getSelectedNodes(); + this.tmpRowData = this.state.rowData; + let dataRowCount = this.state.totalCount; + //Read Clipboard Data + let clipboardData = await this.readClipBoard(); + let selectedRowIndex = 0; + if (selectedRows){ + await selectedRows.map(selectedRow =>{ + selectedRowIndex = selectedRow.rowIndex; + if (clipboardData){ + clipboardData = _.trim(clipboardData); + let suGridRowData= this.state.emptyRow; + clipboardData = _.trim(clipboardData); + let suRows = clipboardData.split("\n"); + suRows.forEach(line =>{ + suGridRowData ={}; + suGridRowData['id']= 0; + suGridRowData['isValid']= true; + + if ( this.tmpRowData.length <= selectedRowIndex ) { + this.tmpRowData.push(this.state.emptyRow); + } + + let colCount = 0; + let suRow = line.split("\t"); + for(const key of this.state.colKeyOrder){ + suGridRowData[key]= suRow[colCount]; + colCount++; + } + if (this.tmpRowData[selectedRowIndex].id > 0 ) { + suGridRowData['id'] = this.tmpRowData[selectedRowIndex].id; + } + this.tmpRowData[selectedRowIndex]= (suGridRowData); + selectedRowIndex++ + }) + } + }); + dataRowCount = selectedRowIndex; + let emptyRow = this.state.emptyRow; + let tmpNoOfSU= this.state.noOfSU; + if (dataRowCount >= tmpNoOfSU){ + tmpNoOfSU = dataRowCount; + //Create additional empty row at the end + for(let i= this.tmpRowData.length; i<=tmpNoOfSU; i++){ + this.tmpRowData.push(emptyRow); + } + } + await this.setState({ + rowData: this.tmpRowData, + noOfSU: this.tmpRowData.length, + totalCount: dataRowCount, + }) + this.state.gridApi.setRowData(this.state.rowData); + this.state.gridApi.redrawRows(); + } + } + catch (err) { + console.error('Error: ', err); + } + } + + //>>>>>> Resolved Conflicts by Ramesh. Remove or update this block as applicable. + /*else if ( key === 46){ this.growl.show({severity: 'success', summary: '', detail: selectedRows.length+' row(s) copied to clipboard '}); } /* else if ( key === 46){ @@ -1185,7 +1198,8 @@ export class SchedulingSetCreate extends Component { this.state.gridApi.setRowData(this.state.rowData); this.state.gridApi.redrawRows(); } - } */ + } + } *///<<<<<< Resolved Conflicts } /**