diff --git a/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/scheduleunit.service.data.js b/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/scheduleunit.service.data.js index 80860d68245094259c2540719aa2bbceab973415..3dc2166748c127847e40438c47714cf9e9f38520 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/scheduleunit.service.data.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/scheduleunit.service.data.js @@ -409,309 +409,8 @@ const SUServiceMock= { "name": "UC1 test scheduling unit 1.1", "observation_strategy_template": "http://192.168.99.100:8008/api/scheduling_unit_observing_strategy_template/1", "observation_strategy_template_id": 1, - "requirements_doc": { - "tasks": { - "Pipeline 1": { - "tags": [], - "description": "Preprocessing Pipeline for Calibrator Observation 1", - "specifications_doc": { - "flag": { - "rfi_strategy": "auto", - "outerchannels": true, - "autocorrelations": true - }, - "demix": { - "sources": {}, - "time_steps": 10, - "ignore_target": false, - "frequency_steps": 64 - }, - "average": { - "time_steps": 1, - "frequency_steps": 4 - }, - "storagemanager": "dysco" - }, - "specifications_template": "preprocessing schema" - }, - "Pipeline 2": { - "tags": [], - "description": "Preprocessing Pipeline for Calibrator Observation 2", - "specifications_doc": { - "flag": { - "rfi_strategy": "auto", - "outerchannels": true, - "autocorrelations": true - }, - "demix": { - "sources": {}, - "time_steps": 10, - "ignore_target": false, - "frequency_steps": 64 - }, - "average": { - "time_steps": 1, - "frequency_steps": 4 - }, - "storagemanager": "dysco" - }, - "specifications_template": "preprocessing schema" - }, - "Pipeline SAP0": { - "tags": [], - "description": "Preprocessing Pipeline for Target Observation SAP0", - "specifications_doc": { - "flag": { - "rfi_strategy": "auto", - "outerchannels": true, - "autocorrelations": true - }, - "demix": { - "sources": {}, - "time_steps": 10, - "ignore_target": false, - "frequency_steps": 64 - }, - "average": { - "time_steps": 1, - "frequency_steps": 4 - }, - "storagemanager": "dysco" - }, - "specifications_template": "preprocessing schema" - }, - "Pipeline SAP1": { - "tags": [], - "description": "Preprocessing Pipeline for Target Observation SAP1", - "specifications_doc": { - "flag": { - "rfi_strategy": "auto", - "outerchannels": true, - "autocorrelations": true - }, - "demix": { - "sources": {}, - "time_steps": 10, - "ignore_target": false, - "frequency_steps": 64 - }, - "average": { - "time_steps": 1, - "frequency_steps": 4 - }, - "storagemanager": "dysco" - }, - "specifications_template": "preprocessing schema" - }, - "Target Observation": { - "tags": [], - "description": "Target Observation for UC1 HBA scheduling unit", - "specifications_doc": { - "QA": { - "plots": { - "enabled": true, - "autocorrelation": true, - "crosscorrelation": true - }, - "file_conversion": { - "enabled": true, - "nr_of_subbands": -1, - "nr_of_timestamps": 256 - } - }, - "SAPs": [ - { - "name": "target0", - "subbands": [ - 349, - 372 - ], - "digital_pointing": { - "angle1": 3.9935314947195253, - "angle2": 0.5324708659626034, - "angle3": 24, - "direction_type": "J2000" - } - }, - { - "name": "target1", - "subbands": [ - 349, - 372 - ], - "digital_pointing": { - "angle1": 3.9935314947195253, - "angle2": 0.5324708659626034, - "angle3": 24, - "direction_type": "J2000" - } - } - ], - "filter": "HBA_110_190", - "duration": 28800, - "stations": [ - { - "group": "ALL", - "min_stations": 1 - } - ], - "tile_beam": { - "angle1": 5.324708659626033, - "angle2": 0.7099611546168045, - "angle3": 42, - "direction_type": "J2000" - }, - "correlator": { - "storage_cluster": "CEP4", - "integration_time": 1, - "channels_per_subband": 64 - }, - "antenna_set": "HBA_DUAL_INNER" - }, - "specifications_template": "observation schema" - }, - "Calibrator Observation 1": { - "tags": [], - "description": "Calibrator Observation for UC1 HBA scheduling unit", - "specifications_doc": { - "duration": 600, - "pointing": { - "angle1": 0, - "angle2": 0, - "angle3": 0, - "direction_type": "J2000" - }, - "autoselect": false - }, - "specifications_template": "calibrator schema" - }, - "Calibrator Observation 2": { - "tags": [], - "description": "Calibrator Observation for UC1 HBA scheduling unit", - "specifications_doc": { - "duration": 600, - "pointing": { - "angle1": 0, - "angle2": 0, - "angle3": 0, - "direction_type": "J2000" - }, - "autoselect": false - }, - "specifications_template": "calibrator schema" - } - }, - "parameters": [ - { - "name": "Target Pointing 0", - "refs": [ - "#/tasks/Target Observation/specifications_doc/SAPs/0/digital_pointing" - ] - }, - { - "name": "Target Pointing 1", - "refs": [ - "#/tasks/Target Observation/specifications_doc/SAPs/1/digital_pointing" - ] - }, - { - "name": "Tile Beam", - "refs": [ - "#/tasks/Target Observation/specifications_doc/tile_beam" - ] - } - ], - "task_relations": [ - { - "tags": [], - "input": { - "role": "input", - "datatype": "visibilities" - }, - "output": { - "role": "correlator", - "datatype": "visibilities" - }, - "consumer": "Pipeline 1", - "producer": "Calibrator Observation 1", - "dataformat": "MeasurementSet", - "selection_doc": {}, - "selection_template": "All" - }, - { - "tags": [], - "input": { - "role": "input", - "datatype": "visibilities" - }, - "output": { - "role": "correlator", - "datatype": "visibilities" - }, - "consumer": "Pipeline 2", - "producer": "Calibrator Observation 2", - "dataformat": "MeasurementSet", - "selection_doc": {}, - "selection_template": "All" - }, - { - "tags": [], - "input": { - "role": "input", - "datatype": "visibilities" - }, - "output": { - "role": "correlator", - "datatype": "visibilities" - }, - "consumer": "Pipeline SAP0", - "producer": "Target Observation", - "dataformat": "MeasurementSet", - "selection_doc": { - "sap": [ - 0 - ] - }, - "selection_template": "SAP" - }, - { - "tags": [], - "input": { - "role": "input", - "datatype": "visibilities" - }, - "output": { - "role": "correlator", - "datatype": "visibilities" - }, - "consumer": "Pipeline SAP1", - "producer": "Target Observation", - "dataformat": "MeasurementSet", - "selection_doc": { - "sap": [ - 1 - ] - }, - "selection_template": "SAP" - } - ], - "task_scheduling_relations": [ - { - "first": "Calibrator Observation 1", - "second": "Target Observation", - "placement": "before", - "time_offset": 60 - }, - { - "first": "Calibrator Observation 2", - "second": "Target Observation", - "placement": "after", - "time_offset": 60 - } - ] - }, - "requirements_template": "http://192.168.99.100:8008/api/scheduling_unit_template/1", - "requirements_template_id": 1, + "specifications_template": "http://192.168.99.100:8008/api/scheduling_unit_template/1", + "specifications_template_id": 1, "scheduling_set": "http://192.168.99.100:8008/api/scheduling_set/1", "scheduling_set_id": 1, "scheduling_unit_blueprints": [ 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 b43942a7d7f9bdc39da30a39da78696cef8c242c..4daaa04c97f081f834da300141868e6f74ede975 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 @@ -753,10 +753,10 @@ export class SchedulingSetCreate extends Component { } } } else { - let parameters = scheduleunit['requirements_doc'].parameters; + let parameters = this.state.observStrategy.template.parameters; for(const parameter of parameters){ let refUrl = parameter['refs']; - let valueItem = (await $RefParser.resolve( scheduleunit['requirements_doc'])).get(refUrl[0]); + let valueItem = (await $RefParser.resolve( this.state.observStrategy.template)).get(refUrl[0]); let excelColumns = this.state.columnMap[parameter.name]; if (excelColumns) { let excelColumnsKeys = Object.keys(excelColumns); @@ -909,8 +909,7 @@ export class SchedulingSetCreate extends Component { this.stations = responses[4]; let stationGroups = []; if (schedulingUnit && schedulingUnit.observation_strategy_template_id) { - let targetObservation = schedulingUnit.requirements_doc.tasks['Target Observation']; - targetObservation = taskDrafts.data.results.find(task => {return task.specifications_doc.station_groups?true:false}); + let targetObservation = taskDrafts.data.results.find(task => {return task.specifications_doc.station_groups?true:false}); stationGroups = targetObservation?targetObservation.specifications_doc.station_groups:[]; } if (stationGroups) { 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 1a10b933c1d11443932184e9f418259c5612808e..0fe820c3d263e9adfe5582f3952ae71eb55a15b5 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -662,7 +662,6 @@ const ScheduleService = { schedulingUnit = suObsResponse.data; if (schedulingUnit && schedulingUnit.id) { // Update the newly created SU draft requirement_doc with captured parameter values - schedulingUnit.requirements_doc = observStrategy.template; schedulingUnit.scheduling_constraints_doc = constraint.scheduling_constraints_doc; schedulingUnit.scheduling_constraints_template_id = constraint.id; schedulingUnit.scheduling_constraints_template = constraint.constraint.url; @@ -674,9 +673,7 @@ const ScheduleService = { messsage: 'Unable to Create Scheduling Unit' }; } - // Create task drafts with updated requirement_doc - schedulingUnit = await this.createSUTaskDrafts(schedulingUnit); - if (schedulingUnit && schedulingUnit.task_drafts.length > 0) { + if (schedulingUnit.task_drafts.length > 0) { schedulingUnit['isSUUpdated'] = true; schedulingUnit['taskName'] = '(Tasks)'; return schedulingUnit; @@ -752,16 +749,6 @@ const ScheduleService = { return null } }, - createSUTaskDrafts: async (schedulingUnit) => { - try { - const suCreateTaskResponse = await axios.post(`/api/scheduling_unit_draft/${schedulingUnit.id}/create_task_drafts/`); - return suCreateTaskResponse.data; - } catch (error) { - console.error(error); - schedulingUnit['isSUUpdated'] = false; - return schedulingUnit; - } - }, getSchedulingListByProject: async function (project) { /* SU - Schedulign Unit @@ -811,7 +798,7 @@ const ScheduleService = { }, createSchedulingUnitBlueprintTree: async function (id) { try { - const response = await axios.post(`/api/scheduling_unit_draft/${id}/create_blueprints_and_subtasks`); + const response = await axios.post(`/api/scheduling_unit_draft/${id}/create_scheduling_unit_blueprint_and_tasks_and_subtasks_tree`); return response.data; } catch (error) { console.error(error); @@ -829,7 +816,7 @@ const ScheduleService = { }, copySchedulingUnitBluePrint: async function (id, param) { try { - const response = await axios.post(`/api/scheduling_unit_blueprint/${id}/copy_to_scheduling_unit_draft`, param); + const response = await axios.post(`/api/scheduling_unit_blueprint/${id}/copy_to_draft`, param); return response; } catch (error) { console.error(error);