From 8213da34b80a3cfb91876b59bf2bf5a957b5b4fb Mon Sep 17 00:00:00 2001 From: unknown <n.santhanam@redkarma.eu> Date: Thu, 12 Nov 2020 19:06:50 +0530 Subject: [PATCH] TMSS-380 Station Reset Issue fixed --- .../src/routes/Scheduling/Stations.js | 12 ++++++++++++ .../tmss_webapp/src/routes/Scheduling/create.js | 17 +++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) 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 448eeb568f2..841672888ac 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js @@ -38,9 +38,21 @@ export default (props) => { useEffect(() => { if (props.stationGroup && props.stationGroup.length) { getAllStations(); + } else { + reset(); } }, [props.stationGroup]); + // Restting the stations + const reset = () => { + setStations([]); + setSelectedStations([]); + setStationOptions([]); + setCustomStations([]); + setCustomStationsOptions([]); + setmissing_StationFieldsErrors([]); + }; + /** * Fetches all stations */ 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 5116438d25a..80578731664 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -384,19 +384,24 @@ export class SchedulingUnitCreate extends Component { name: '', description: '', project: this.props.match.params.project || null, - scheduling_constraints_template_id: this.constraintTemplates[0].id - }, + scheduling_constraints_template_id: this.constraintTemplates[0].id, + }, projectDisabled: (this.props.match.params.project? true:false), observStrategy: {}, + selectedStations:{}, paramsOutput: null, validEditor: false, validFields: {}, constraintSchema: null, - touched:false - }, () => { + selectedStations: null, + touched:false, + stationGroup: [] + }, () => { this.constraintStrategy(this.constraintTemplates[0]); }); + this.state.editorFunction(); + } onUpdateStations = (state, selectedStations, missing_StationFieldsErrors, customSelectedStations) => { @@ -517,8 +522,8 @@ export class SchedulingUnitCreate extends Component { </div> </div> <Stations - stationGroup={this.state.stationGroup} - onUpdateStations={this.onUpdateStations.bind(this)} + stationGroup={this.state.stationGroup} + onUpdateStations={this.onUpdateStations.bind(this)} /> </div> {this.state.constraintSchema && <div className="p-fluid"> -- GitLab