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 448eeb568f2de0ee34fee6950afff81d6bf5133b..841672888ac6cdbc75d850b1a39442f2752e1f59 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 5116438d25a47eda68eb07a38d525585b93ebad7..805787316649f94e265385af3e200bd9a8c73d20 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">