diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js index 94958c03337bc4f29abfcd6399a538157865987b..da210a6996d2747597836801d6fc7f81e4d82a92 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/excelview.schedulingset.js @@ -131,6 +131,7 @@ export class SchedulingSetCreate extends Component { rowData: [], newSet: null, priorityQueuelist: null, + disabled: '' }; this.gridApi = ''; @@ -200,6 +201,9 @@ export class SchedulingSetCreate extends Component { this.applyChanges = this.applyChanges.bind(this); this.getSchedulingDialogContent = this.getSchedulingDialogContent.bind(this); this.setSUSet = this.setSUSet.bind(this); + this.copyClipText = this.copyClipText.bind(this); + this.clearAll = this.clearAll.bind(this); + this.disableTextField = this.disableTextField.bind(this); this.formRules = { // Form validation rules project: {required: true, message: "Select project to get Scheduling Sets"}, @@ -413,7 +417,7 @@ export class SchedulingSetCreate extends Component { } close(){ - this.setState({confirmDialogVisible: false}); + this.setState({confirmDialogVisible: false, disabled: 'auto'}); } validateForm(fieldName) { @@ -2269,6 +2273,7 @@ export class SchedulingSetCreate extends Component { await this.setState({clipText: clipText}); this.copyFromClipboard(); }catch(error) { + this.setState({disabled: 'auto'}) this.callBackFunction = this.copyFromClipboard; this.onCancel = () => { this.setState({confirmDialogVisible: false, clipText: ''}); @@ -2283,20 +2288,39 @@ export class SchedulingSetCreate extends Component { this.dialogHeader = "Paste Copied Data"; this.dialogMsg = "Paste copied content in the field and click Ok to paste to the selected row(s)"; this.dialogContent = this.pasteTextField; - this.actions = [{id: "ok_btn", title: "Ok", callback: this.copyFromClipboard}, + this.actions = [{id: "clear_btn", title: "Clear", callback: this.clearAll}, + {id: "ok_btn", title: "Ok", callback: this.copyFromClipboard}, {id: "cancel_btn", title: "Cancel", callback: this.onCancel}]; this.setState({confirmDialogVisible: true}); } } } + clearAll() { + this.setState({clipText: '', disabled: 'auto'}) + } /** * Text area component passed to dialog to get the clipboard data from user * @returns Component */ pasteTextField() { - return <textarea value={this.state.clipText} style={{width: '100%'}} autoFocus - onChange={e => this.setState({clipText: e.target.value})}></textarea>; + return <textarea value={this.state.clipText} style={{width: '100%', pointerEvents: this.state.disabled}} autoFocus + onChange={(e) => {this.copyClipText(e)}} placeholder="Paste your text here..." onKeyDown={this.disableTextField}></textarea>; + } + + copyClipText(e){ + this.setState({clipText: e.target.value}) + } + + /** + * Disable the Input field in popup while paste the clipboard text + */ + disableTextField(e){ + var key = e.which || e.keyCode; + var ctrl = e.ctrlKey ? e.ctrlKey : ((key === 17 || key === 91) ? true : false); + if ( key === 86 && ctrl ) { + this.setState({disabled: 'none'}) + } } /** @@ -2304,6 +2328,7 @@ export class SchedulingSetCreate extends Component { */ async copyFromClipboard(){ try { + this.setState({}) var selectedRows = this.state.gridApi.getSelectedNodes(); this.tmpRowData = this.state.rowData; let dataRowCount = this.state.totalCount;