diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss b/SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss index ab1fc7c462bbafa73b6855e927a2e9bff88ebcdc..dc9165db4993998faff505b573973541e122ad2f 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss +++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss @@ -175,14 +175,15 @@ padding-left: 22px !important; } -#MissingStation{ +#missingStation{ width: 110%; } - -.missingField{ - color: grey; +.station_header { + padding-left: 22px !important; +} +#stationgroup-label{ + padding-left: 5px; } - 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 0beafa3066e8b8711eaa1db3983e9067617baa25..c61a4868f0dee2a9a29ef86e2b3e642c55fffdd3 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Stations.js @@ -156,6 +156,11 @@ export default (props) => { <legend> <label>Stations:<span style={{color:'red'}}>*</span></label> </legend> + <div className="col-md-6 p-field p-grid"> + <label className="col-sm-6 text-caps" id="stationgroup-label"> + Stations Group: + </label> + </div> {!props.view && <div className="col-lg-3 col-md-3 col-sm-12" data-testid="selectstations"> <MultiSelect data-testid="selectstations" id="selectStations" optionLabel="value" optionValue="value" filter={true} tooltip="Select Stations" tooltipOptions={tooltipOptions} @@ -184,7 +189,7 @@ export default (props) => { disabled={props.view} onChange={(e) => setNoOfMissingFields(i, e.target.value)}/> {props.view && - <span className="missingField">Max No. of Missing Stations</span>} + <span className="info">Max No. of Missing Stations</span>} </div> </div> ) : ( @@ -209,7 +214,7 @@ export default (props) => { Maximum No. Of Missing Stations </label> <div className="col-sm-6 pr-8 custom-field"> - <InputText id="MissingStation" data-testid="name" + <InputText id="missingStation" data-testid="name" className={(state[i] && state[i].error) ?'input-error':''} tooltip="Max Number of Missing Stations" tooltipOptions={tooltipOptions} placeholder="Max Number of Missing Stations" @@ -217,7 +222,7 @@ export default (props) => { disabled={props.view} onChange={(e) => setNoOfMissingFields(i, e.target.value)}/> {props.view && - <span className="missingField">Max No. of Missing Stations</span>} + <span className="info">Max No. of Missing Stations</span>} </div> </div> 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 0ef3dec31127018a96e78dcef33dda57acb06062..9dc6e017d5e4706398966d33c4bbda3ceb7c305c 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -315,9 +315,21 @@ export class SchedulingUnitCreate extends Component { } } } - /* for (let type in constStrategy.sky.transit_offset) { - constStrategy.sky.transit_offset[type] = constStrategy.sky.transit_offset[type] * 60; - }*/ + + const station_groups = []; + (this.state.selectedStations || []).forEach(key => { + let station_group = {}; + const stations = this.state[key] ? this.state[key].stations : []; + const max_nr_missing = parseInt(this.state[key] ? this.state[key].missingFields : 0); + station_group = { + stations, + max_nr_missing + }; + if (key === 'Custom') { + station_group.stations = this.state.customSelectedStations; + } + station_groups.push(station_group); + }); UnitConversion.degreeToRadians(constStrategy.sky); @@ -327,7 +339,7 @@ export class SchedulingUnitCreate extends Component { $refs.set(observStrategy.template.parameters[index]['refs'][0], this.state.paramsOutput['param_' + index]); }); const const_strategy = {scheduling_constraints_doc: constStrategy, id: this.constraintTemplates[0].id, constraint: this.constraintTemplates[0]}; - const schedulingUnit = await ScheduleService.saveSUDraftFromObservStrategy(observStrategy, this.state.schedulingUnit, const_strategy, this.state); + const schedulingUnit = await ScheduleService.saveSUDraftFromObservStrategy(observStrategy, this.state.schedulingUnit, const_strategy, station_groups); if (schedulingUnit) { // this.growl.show({severity: 'success', summary: 'Success', detail: 'Scheduling Unit and tasks created successfully!'}); const dialog = {header: 'Success', detail: 'Scheduling Unit and Tasks are created successfully. Do you want to create another Scheduling Unit?'}; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js index 1bde5c1a4164bac9e67b760f73a3210e26f9c1f1..1a4823b7fc5072eb34eed808cd14263424b7a6d9 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -310,7 +310,21 @@ export class EditSchedulingUnit extends Component { }); const schUnit = { ...this.state.schedulingUnit }; schUnit.scheduling_constraints_doc = constStrategy; - const schedulingUnit = await ScheduleService.updateSUDraftFromObservStrategy(observStrategy,schUnit,this.state.taskDrafts, this.state.tasksToUpdate,this.state); + const station_groups = []; + (this.state.selectedStations || []).forEach(key => { + let station_group = {}; + const stations = this.state[key] ? this.state[key].stations : []; + const max_nr_missing = parseInt(this.state[key] ? this.state[key].missingFields : 0); + station_group = { + stations, + max_nr_missing + }; + if (key === 'Custom') { + station_group.stations = this.state.customSelectedStations; + } + station_groups.push(station_group); + }); + const schedulingUnit = await ScheduleService.updateSUDraftFromObservStrategy(observStrategy,schUnit,this.state.taskDrafts, this.state.tasksToUpdate, station_groups); if (schedulingUnit) { // this.growl.show({severity: 'success', summary: 'Success', detail: 'Scheduling Unit and tasks edited successfully!'}); this.props.history.push({ 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 e381f180ee8f31126b9b9c91595e79d9d2359c75..15cac898691beffc966f094cd18250dfbfe0aa2a 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -212,7 +212,7 @@ const ScheduleService = { return []; }; }, - saveSUDraftFromObservStrategy: async function(observStrategy, schedulingUnit, constraint,state) { + saveSUDraftFromObservStrategy: async function(observStrategy, schedulingUnit, constraint,station_groups) { try { // Create the scheduling unit draft with observation strategy and scheduling set const url = `/api/scheduling_unit_observing_strategy_template/${observStrategy.id}/create_scheduling_unit/?scheduling_set_id=${schedulingUnit.scheduling_set_id}&name=${schedulingUnit.name}&description=${schedulingUnit.description}` @@ -221,20 +221,6 @@ const ScheduleService = { if (schedulingUnit && schedulingUnit.id) { // Update the newly created SU draft requirement_doc with captured parameter values schedulingUnit.requirements_doc = observStrategy.template; - const station_groups = []; - (state.selectedStations || []).forEach(key => { - let station_group = {}; - const stations = state[key] ? state[key].stations : []; - const max_nr_missing = parseInt(state[key] ? state[key].missingFields : 0); - station_group = { - stations, - max_nr_missing - }; - if (key === 'Custom') { - station_group.stations = state.customSelectedStations; - } - station_groups.push(station_group); - }); schedulingUnit.requirements_doc.tasks['Target Observation'].specifications_doc.station_groups = station_groups; schedulingUnit.scheduling_constraints_doc = constraint.scheduling_constraints_doc; schedulingUnit.scheduling_constraints_template_id = constraint.id; @@ -257,29 +243,17 @@ const ScheduleService = { }; }, - updateSUDraftFromObservStrategy: async function(observStrategy,schedulingUnit,tasks,tasksToUpdate,state) { + updateSUDraftFromObservStrategy: async function(observStrategy,schedulingUnit,tasks,tasksToUpdate,station_groups) { try { delete schedulingUnit['duration']; - const station_groups = []; - (state.selectedStations || []).forEach(key => { - let station_group = {}; - const stations = state[key] ? state[key].stations : []; - const max_nr_missing = parseInt(state[key] ? state[key].missingFields : 0); - station_group = { - stations, - max_nr_missing - }; - if (key === 'Custom') { - station_group.stations = state.customSelectedStations; - } - station_groups.push(station_group); - }); - debugger - schedulingUnit.requirements_doc.tasks['Target Observation'].specifications_doc.station_groups = station_groups; + schedulingUnit = await this.updateSchedulingUnitDraft(schedulingUnit); for (const taskToUpdate in tasksToUpdate) { let task = tasks.find(task => { return task.name === taskToUpdate}); task.specifications_doc = observStrategy.template.tasks[taskToUpdate].specifications_doc; + if (task.name === 'Target Observation') { + task.specifications_doc.station_groups = station_groups; + } delete task['duration']; delete task['relative_start_time']; delete task['relative_stop_time'];