diff --git a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js index 5266aa478cf62af7d703a3c2e82e60f381bbe1c2..79948b49b949c17b92ebf4a6a32bb6d0ea0996c0 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js @@ -200,7 +200,6 @@ function Jeditor(props) { const subbandValidator = validateSubbandOutput; const timeValidator = Validator.validateTime; const angleValidator = Validator.validateAngle; - console.log(JSON.stringify(schema)); JSONEditor.defaults.custom_validators.push((schema, value, path) => { const errors = []; if (schema.validationType === "subband_list") { @@ -795,7 +794,8 @@ function Jeditor(props) { if(path[path.indexOf('list')]) path[path.indexOf('list')] = 'frequency'; path = path.join('.') const subbandArray = prpOutput.split(","); - let bandpassFilter = editorRef.current.getValue() ? editorRef.current.getValue().filter : null; + let bandpassFilter = editorRef.current.getValue() ? (editorRef.current.getValue().filter || editorRef.current.getValue().target?.filter || null) : null; + // let bandpassFilter = editorRef.current.getValue() ? editorRef.current.getValue().filter : null; let frequencyValues = null for (const subband of subbandArray) { const subbandRange = subband.split('..'); @@ -832,7 +832,7 @@ function Jeditor(props) { } } - if(editor.editors[path]?.formname) { + if(editor?.editors[path]?.formname) { // add values to respective frequency document.getElementById(editor.editors[path]?.formname).value = frequencyValues; document.getElementById(editor.editors[path]?.formname).disabled = true; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js index 986fd03769bc1ab468f6a5c6701259bd6894fbc7..481f1ec388c9ff1c0552d197cdb9563d909eae7e 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/ViewSchedulingUnit.js @@ -346,7 +346,10 @@ class ViewSchedulingUnit extends Component { task.subTaskID = subTaskIds.length ? subTaskIds[0].id : ''; return task; })); - const targetObservation = _.find(tasks, (task) => { return task.template.type_value === 'observation' && task.tasktype.toLowerCase() === schedule_type && task.specifications_doc.station_groups }); + const targetObservation = _.find(tasks, (task) => { + return task.template.type_value === 'observation' + && task.tasktype.toLowerCase() === schedule_type + && (task.specifications_doc.station_groups || task.specifications_doc.target?.station_groups) }); const isIngestPresent = _.find(tasks, (task) => { return task.template.type_value === 'ingest'}); await this.getFilterColumns(this.props.match.params.type.toLowerCase()); this.setState({ @@ -355,7 +358,7 @@ class ViewSchedulingUnit extends Component { scheduleunitType: schedule_type, schedulingUnitTasks: tasks, isLoading: false, - stationGroup: targetObservation ? targetObservation.specifications_doc.station_groups : [], + stationGroup: targetObservation ? (targetObservation.specifications_doc.station_groups || targetObservation.specifications_doc.target?.station_groups) : [], redirect: null, dialogVisible: false, ingestGroup @@ -488,7 +491,7 @@ class ViewSchedulingUnit extends Component { scheduletask[key] = task[key]; } scheduletask['specifications_doc'] = task['specifications_doc']; - scheduletask.duration = moment.utc((scheduletask.duration || 0) * 1000).format(UIConstants.CALENDAR_TIME_FORMAT); + scheduletask.duration = moment.utc((task['specifications_doc'].target?.duration || scheduletask.duration || 0) * 1000).format(UIConstants.CALENDAR_TIME_FORMAT); scheduletask.relative_start_time = moment.utc(scheduletask.relative_start_time * 1000).format(UIConstants.CALENDAR_TIME_FORMAT); scheduletask.relative_stop_time = moment.utc(scheduletask.relative_stop_time * 1000).format(UIConstants.CALENDAR_TIME_FORMAT); scheduletask.template = task.specifications_template; 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 322fcd84946e037c4f7efd92d7df4b6dceb4e1d8..fa6c7349d8997a317e5759306baaaa5f3314efe6 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -185,8 +185,12 @@ export class SchedulingUnitCreate extends Component { if (['target observation', 'beamforming observation'].indexOf(taskTemplate.name.toLowerCase()) >= 0) { observationType = taskTemplate.name; } - if (taskTemplate.type_value==='observation' && task.specifications_doc.station_groups) { - station_group = task.specifications_doc.station_groups; + if (taskTemplate.type_value==='observation') { + if (task.specifications_doc.station_groups) { + station_group = task.specifications_doc.station_groups; + } else if (task.specifications_doc.target?.station_groups) { + station_group = task.specifications_doc.target.station_groups; + } } // Get the default Bandpass filter and pass to the editor to for frequency calculation from subband list if (taskTemplate.type_value === 'observation' && task.specifications_doc.filter) { @@ -426,6 +430,8 @@ export class SchedulingUnitCreate extends Component { let task = observStrategy.template.tasks[taskName]; if (task.specifications_doc.station_groups) { task.specifications_doc.station_groups = station_groups; + } else if (task.specifications_doc.target?.station_groups) { + task.specifications_doc.target.station_groups = station_groups; } } const const_strategy = {scheduling_constraints_doc: constStrategy, id: this.constraintTemplates[0].id, constraint: this.constraintTemplates[0]}; 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 5a78ea520739ea9faa89a8180fa05225dbaf9181..477b7d10860ccd43f96e1a4df811a31acd1ced06 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -123,8 +123,12 @@ export class EditSchedulingUnit extends Component { if (task) { tasksToUpdate[taskName] = taskName; const taskTemplate = _.find(this.taskTemplates, {'name': task['specifications_template']['name']}); - if (taskTemplate.type_value==='observation' && task.specifications_doc.station_groups) { - station_group = task.specifications_doc.station_groups; + if (taskTemplate.type_value==='observation') { + if (task.specifications_doc.station_groups) { + station_group = task.specifications_doc.station_groups; + } else if (task.specifications_doc.target?.station_groups) { + station_group = task.specifications_doc.target.station_groups; + } } // Get the default Bandpass filter and pass to the editor to for frequency calculation from subband list if (taskTemplate.type_value === 'observation' && task.specifications_doc.filter) { @@ -188,9 +192,9 @@ export class EditSchedulingUnit extends Component { this.setState({ schedulingUnit: responses[4], taskDrafts: responses[5].data.results, observStrategyVisible: responses[4].observation_strategy_template_id?true:false }); this.changeStrategy(responses[4].observation_strategy_template_id); - const targetObservation = responses[5].data.results.find(task => {return task.template.type_value === 'observation' && task.specifications_doc.station_groups?true:false}); + const targetObservation = responses[5].data.results.find(task => {return task.template.type_value === 'observation' && (task.specifications_doc.station_groups || task.specifications_doc.target?.station_groups)?true:false}); this.setState({ - stationGroup: targetObservation?targetObservation.specifications_doc.station_groups:[] + stationGroup: targetObservation?(targetObservation.specifications_doc.station_groups || targetObservation.specifications_doc.target?.station_groups || []):[] }); if (this.state.schedulingUnit.project) { const projectSchedSets = _.filter(this.schedulingSets, {'project_id': this.state.schedulingUnit.project}); 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 5257f7da8b288b420891ca5da2495c7f6b9ee185..e28f99caae0c252bac5eb8c0b72727ba06bd78c9 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 @@ -555,8 +555,8 @@ export class SchedulingSetCreate extends Component { const task = tasks[taskName]; if (task) { const taskTemplate = _.find(this.taskTemplates, {'name': task['specifications_template']['name']}); - if (taskTemplate.type_value==='observation' && task.specifications_doc.station_groups) { - station_group = task.specifications_doc.station_groups; + if (taskTemplate.type_value==='observation' && (task.specifications_doc.station_groups || task.specifications_doc.target?.station_groups)) { + station_group = task.specifications_doc.station_groups || task.specifications_doc.target?.station_groups; } let taskTemplateSchema = this.taskTemplateSchemas[task['specifications_template']['name']]; if (!taskTemplateSchema) { @@ -912,8 +912,8 @@ export class SchedulingSetCreate extends Component { this.stations = responses[4]; let stationGroups = []; if (schedulingUnit && schedulingUnit.observation_strategy_template_id) { - let targetObservation = taskDrafts.data.results.find(task => {return task.specifications_doc.station_groups?true:false}); - stationGroups = targetObservation?targetObservation.specifications_doc.station_groups:[]; + let targetObservation = taskDrafts.data.results.find(task => {return (task.specifications_doc.station_groups || task.specifications_doc.target?.station_groups)?true:false}); + stationGroups = targetObservation?(targetObservation.specifications_doc.station_groups || targetObservation.specifications_doc.target?.station_groups):[]; } if (stationGroups) { stationGroups.map(stationGroup =>{ @@ -1906,6 +1906,8 @@ export class SchedulingSetCreate extends Component { let task = observStrategy.template.tasks[taskName]; if (task.specifications_doc.station_groups) { task.specifications_doc.station_groups = tmpStationGroups; + } else if (task.specifications_doc.target?.station_groups) { + task.specifications_doc.target.station_groups = tmpStationGroups; } } } 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 26bcb9e85ed3f883d142772bca11e42ee8b0a169..86aac18f01bbd538adffca0ba491a8602d17928e 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -711,6 +711,8 @@ const ScheduleService = { task.specifications_doc = observStrategy.template.tasks[taskToUpdate].specifications_doc; if (task.specifications_doc.station_groups) { task.specifications_doc.station_groups = station_groups; + } else if (task.specifications_doc.target?.station_groups) { + task.specifications_doc.target.station_groups = station_groups; } delete task['duration']; delete task['relative_start_time'];