diff --git a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_suSummary.scss b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_suSummary.scss index 76b02736fb1959096ef3067f75b67f2ad1a72336..ab73c0560d155915f052c300f41c36280658e4ac 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_suSummary.scss +++ b/SAS/TMSS/frontend/tmss_webapp/src/layout/sass/_suSummary.scss @@ -45,4 +45,11 @@ .json-to-table::-webkit-scrollbar-thumb { background-color: #0000007c; + } + + .station-list { + max-height: 150px; + overflow-y: scroll; + border: 1px solid lightgrey; + padding: 0px 10px 10px 10px; } \ No newline at end of file diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js index 660a7c1a0e4cc0456476edfbd877e2539f5559fe..94ca5e5213e2ac906c878a8d712292d3a6629635 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js @@ -154,12 +154,19 @@ export class SchedulingUnitSummary extends Component { </> } - {<Stations + {/* {<Stations stationGroup={this.props.stationGroup} view isSummary - />} - + />} */} + <div className="col-12"><label>Stations:</label></div> + <div className="col-12 station-list"> + {this.props.stationGroup && this.props.stationGroup.map((station, index) => ( + <div key={`stn-${index}`}>{station}</div> + ))} + + </div> + <div className="col-12 task-summary"> <label>Tasks:</label> <ViewTable diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js index 05f2f9c2ecada9a2242298e6be6c5de7375778fd..d1c5a388e915e938b83657ae9e5bf9d3e279de94 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js @@ -158,7 +158,8 @@ export class TimelineView extends Component { task.band = task.specifications_doc.filter; } } - const targetObservation = _.find(taskList, (task)=> {return task.template.type_value==='observation' && task.tasktype.toLowerCase()==="blueprint" && task.specifications_doc.station_groups}); + this.setState({suTaskList: _.sortBy(taskList, "id"), isSummaryLoading: false, + stationGroup: this.getSUStations(suBlueprint)}); }); // Get the scheduling constraint template of the selected SU block ScheduleService.getSchedulingConstraintTemplate(suBlueprint.suDraft.scheduling_constraints_template_id) @@ -220,37 +221,44 @@ export class TimelineView extends Component { * @param {Array} items */ getStationItemGroups(suBlueprint, timelineItem, group, items) { - /** Get all observation tasks */ - const observtionTasks = _.filter(suBlueprint.tasks, (task) => { return task.template.type_value.toLowerCase() === "observation"}); + /* Get stations based on SU status */ + let stations = this.getSUStations(suBlueprint); + + /* Group the items by station */ + for (const station of stations) { + let stationItem = _.cloneDeep(timelineItem); + stationItem.id = `${stationItem.id}-${station}`; + stationItem.group = station; + items.push(stationItem); + } + } + + /** + * Get all stations of the SU bleprint from the observation task or subtask bases on the SU status. + * @param {Object} suBlueprint + */ + getSUStations(suBlueprint) { let stations = []; - for (const observtionTask of observtionTasks) { + /* Get all observation tasks */ + const observationTasks = _.filter(suBlueprint.tasks, (task) => { return task.template.type_value.toLowerCase() === "observation"}); + for (const observationTask of observationTasks) { /** If the status of SU is before scheduled, get all stations from the station_groups from the task specification_docs */ if (this.STATUS_BEFORE_SCHEDULED.indexOf(suBlueprint.status.toLowerCase()) >= 0 - && observtionTask.specifications_doc.station_groups) { - for (const grpStations of _.map(observtionTask.specifications_doc.station_groups, "stations")) { + && observationTask.specifications_doc.station_groups) { + for (const grpStations of _.map(observationTask.specifications_doc.station_groups, "stations")) { stations = _.concat(stations, grpStations); } } else if (this.STATUS_BEFORE_SCHEDULED.indexOf(suBlueprint.status.toLowerCase()) < 0 - && observtionTask.subTasks) { + && observationTask.subTasks) { /** If the status of SU is scheduled or after get the stations from the subtask specification tasks */ - for (const subtask of observtionTask.subTasks) { + for (const subtask of observationTask.subTasks) { if (subtask.specifications_doc.stations) { stations = _.concat(stations, subtask.specifications_doc.stations.station_list); } } } } - stations = _.uniq(stations); - /** Group the items by station */ - for (const station of stations) { - let stationItem = _.cloneDeep(timelineItem); - stationItem.id = `${stationItem.id}-${station}`; - stationItem.group = station; - items.push(stationItem); - // if (!_.find(group, {'id': station})) { - // group.push({'id': station, title: station}); - // } - } + return _.uniq(stations); } /** diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js index 7843db74cc9935e8173260c871c3dadf9f3609d5..98da19ce7b846b5145f369cc2034e6b4691e21f2 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js @@ -169,14 +169,22 @@ export class WeekTimelineView extends Component { const suBlueprint = _.find(this.state.suBlueprints, {id: parseInt(item.id.split('-')[0])}); ScheduleService.getTaskBlueprintsBySchedulingUnit(suBlueprint, true) .then(taskList => { - const targetObservation = _.find(taskList, (task)=> {return task.template.type_value==='observation' && task.tasktype.toLowerCase()==="blueprint" && task.specifications_doc.station_groups}); + const observationTask = _.find(taskList, (task)=> {return task.template.type_value==='observation' && task.specifications_doc.station_groups}); for (let task of taskList) { if (task.template.type_value.toLowerCase() === "observation") { task.antenna_set = task.specifications_doc.antenna_set; task.band = task.specifications_doc.filter; } } - this.setState({suTaskList: _.sortBy(taskList, "id"), isSummaryLoading: false, stationGroup: targetObservation?targetObservation.specifications_doc.station_groups:[]}) + let stations = []; + //>>>>>> TODO: Station groups from subtasks based on the status of SU + if (observationTask) { + for (const grpStations of _.map(observationTask.specifications_doc.station_groups, "stations")) { + stations = _.concat(stations, grpStations); + } + } + this.setState({suTaskList: _.sortBy(taskList, "id"), isSummaryLoading: false, + stationGroup: _.uniq(stations)}) }); // Get the scheduling constraint template of the selected SU block ScheduleService.getSchedulingConstraintTemplate(suBlueprint.suDraft.scheduling_constraints_template_id)