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 1165bcb00b49ce53c9dc175d1e0b792e04d2d75f..f30e2c7264883aa358befd2bc191a4b02cbc7cad 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js @@ -50,7 +50,7 @@ export class SchedulingUnitSummary extends Component { getHeaderTemplate = (permissions) => { - return <div > + return <div className="p-panel-header justify-content-start"> <span className="p-panel-title" >Scheduling Unit Details</span> <Link onClick={this.redirectToSUDetails} title="View Full Details"> <i className="fa fa-eye" style={{ paddingRight: '3px' }}></i></Link> diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/business/timelineRowBusiness.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/business/timelineRowBusiness.js index 10d55aa00d37bb25457b95c19e96600531b204ce..6f65347d4aa3cf10399e3d3995ffab8806c5973a 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/business/timelineRowBusiness.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/business/timelineRowBusiness.js @@ -3,25 +3,24 @@ export function expandTimeLineRowsForGrouping(timeLineRows, groupingkey) { const includeStationsInfo = groupingkey == "station_group" const includeStationsUsedInfo = groupingkey == "station_used_group" const includeStationsMissingInfo = groupingkey == "station_missing_group" - const includeStationsgroupInfo = groupingkey == "stationgroup_group" let expandedschedulingUnitItems = []; - if (includeStationsgroupInfo) expandTimeLineForStationGroup(includeStationsgroupInfo, timeLineRows, expandedschedulingUnitItems); - if (includeStationsInfo) expandTimeLineForStations( timeLineRows, expandedschedulingUnitItems,"specified_stations",groupingkey); - if (includeStationsUsedInfo) expandTimeLineForStations( timeLineRows, expandedschedulingUnitItems,"used_stations",groupingkey); - if (includeStationsMissingInfo) expandTimeLineForStations( timeLineRows, expandedschedulingUnitItems,"missing_stations",groupingkey); + if (includeStationsgroupInfo) expandTimeLineForStationGroup(timeLineRows, expandedschedulingUnitItems); + if (includeStationsInfo) expandTimeLineForStations(timeLineRows, expandedschedulingUnitItems, "specified_stations", groupingkey); + if (includeStationsUsedInfo) expandTimeLineForStations(timeLineRows, expandedschedulingUnitItems, "used_stations", groupingkey); + if (includeStationsMissingInfo) expandTimeLineForStations(timeLineRows, expandedschedulingUnitItems, "missing_stations", groupingkey); return expandedschedulingUnitItems; } -function expandTimeLineForStations(timeLineRows, expandedschedulingUnitItems,propertykey,groupingkey) { +function expandTimeLineForStations(timeLineRows, expandedschedulingUnitItems, propertykey, groupingkey) { for (const timelinerow of timeLineRows) { let stationgroups = timelinerow[propertykey]; if (stationgroups) { for (const station of stationgroups) { - generateNewStationTimeLineRow(timelinerow, expandedschedulingUnitItems, station,groupingkey); + generateNewStationTimeLineRow(timelinerow, expandedschedulingUnitItems, station, groupingkey); } } } @@ -29,7 +28,7 @@ function expandTimeLineForStations(timeLineRows, expandedschedulingUnitItems,pro } // we split up the CS/RS/IS Stations into possible 3 rows. -function expandTimeLineForStationGroup(includeStationsgroupInfo, timeLineRows, expandedschedulingUnitItems) { +function expandTimeLineForStationGroup(timeLineRows, expandedschedulingUnitItems) { for (const timelinerow of timeLineRows) { const stationsgroups = timelinerow.stationsgroups; @@ -48,8 +47,8 @@ function expandTimeLineForStationGroup(includeStationsgroupInfo, timeLineRows, e } function generateNewStationGroupTimeLineRow(schedulingunitTimelinerow, expandedschedulingUnitItems, stationPrefix) { - - let newtimelineItem = { ...schedulingunitTimelinerow } + + let newtimelineItem = { ...schedulingunitTimelinerow } newtimelineItem.stationgroup_group = stationPrefix + newtimelineItem.groupingSuffix; @@ -58,8 +57,8 @@ function generateNewStationGroupTimeLineRow(schedulingunitTimelinerow, expandeds expandedschedulingUnitItems.push(newtimelineItem) } -function generateNewStationTimeLineRow(schedulingunitTimelinerow, expandedschedulingUnitItems, station,groupingkey) { - let newtimelineItem = { ...schedulingunitTimelinerow } +function generateNewStationTimeLineRow(schedulingunitTimelinerow, expandedschedulingUnitItems, station, groupingkey) { + let newtimelineItem = { ...schedulingunitTimelinerow } newtimelineItem[groupingkey] = station + newtimelineItem.groupingSuffix; newtimelineItem.id = newtimelineItem.id + newtimelineItem[groupingkey]; cleanSingleTimelineGroups(newtimelineItem); @@ -77,9 +76,6 @@ function cleanSingleTimelineGroups(timelineItem) { if (timelineItem.antenna_set_group) delete timelineItem.antenna_set_group; if (timelineItem.band_group) delete timelineItem.band_group; if (timelineItem.stationsgroups) delete timelineItem.stationsgroups; - if (timelineItem.specified_stations) delete timelineItem.specified_stations; - if (timelineItem.groupingSuffix) delete timelineItem.groupingSuffix; if (timelineItem.scheduler_group) delete timelineItem.scheduler_group; - } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.js index bdfe8480ceea82341aa68ccbd0e59e8b8cd5dd1e..3b49b4abba35b8721782cb5242b3c1cf8fd975ef 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.js @@ -1,16 +1,25 @@ -export function getFieldsHtml(fields, status = undefined, style = {}) { - const labelClassName = status ? `col-5 su-${status}-icon` : 'col-5' - - const result = - fields.map((field ) => ( - <div key={field.label} className="entry"> - <label className={labelClassName} style={style}>{field.label}</label> - <div className="col-7">{field.value?field.value:'-'}</div> - </div> - )) +export function getFieldsHtml(fields = [], status = undefined, style = {}) { + const result = fields.map((field, index) => { + try { + const { label = '-', value = '-' } = field || {}; + + return ( + <div key={`${label}-${index}`} className="entry"> + <label className={status ? `col-5 su-${status}-icon` : 'col-5'} style={style}> + {label} + </label> + <div className="col-7">{value}</div> + </div> + ); + } catch (error) { + console.error(`Error processing field at index ${index}:`, error); + return <div key={`error-${index}`}>Error processing field</div>; + } + }); + return result; -} + } const labelObject = (label, value) => ({ label: label, @@ -18,6 +27,7 @@ const labelObject = (label, value) => ({ }) function getScheduleItem(mouseOverItem) { + console.log(mouseOverItem) const scheduleItemFields = [ labelObject("Project:", mouseOverItem.project), labelObject("Scheduling Unit:", mouseOverItem.name), @@ -32,7 +42,7 @@ function getScheduleItem(mouseOverItem) { ]; if (mouseOverItem.status === 'unschedulable') { - scheduleItemFields.push({label: "Reason:", value: mouseOverItem.unschedulable_reason}) + scheduleItemFields.push({ label: "Reason:", value: mouseOverItem.unschedulable_reason }) } const suId = mouseOverItem.suId ? mouseOverItem.suId : mouseOverItem.id; const fieldsHTML = getFieldsHtml(scheduleItemFields, mouseOverItem.status) @@ -47,11 +57,12 @@ function getScheduleItem(mouseOverItem) { } function getReservationItem(mouseOverItem) { + let reservationItemFields = [ labelObject("Name:", mouseOverItem.name), labelObject("Description:", mouseOverItem.desc), labelObject("Type:", mouseOverItem.activity_type), - labelObject("Stations:", mouseOverItem.stations,), + labelObject("Stations:", mouseOverItem.stations), labelObject("Project:", mouseOverItem.project ? mouseOverItem.project : "-"), labelObject("Start Time:", mouseOverItem.real_start_time), labelObject("End Time:", mouseOverItem.real_end_time), @@ -66,7 +77,7 @@ function getReservationItem(mouseOverItem) { }; return <div className={`p-grid timeline-item-popover`} style={reservationStyle}> <h3 className={`col-12`}>{"Reservation (" + mouseOverItem.reservationId + ") Overview"}</h3> - {getFieldsHtml(reservationItemFields, undefined, {color: mouseOverItem.color})} + {getFieldsHtml(reservationItemFields, undefined, { color: mouseOverItem.color })} </div>; } @@ -75,26 +86,34 @@ function getReservationItem(mouseOverItem) { * @return {*|null} the specific html for the type that is hovered over */ function getItemForType(mouseOverItem) { - switch (mouseOverItem.type) { - case "SCHEDULE": - return getScheduleItem(mouseOverItem) - case "RESERVATION": - return getReservationItem(mouseOverItem) - default: //when there should not be a pop-over; like a sun timing - return null; + switch (mouseOverItem.type) { + case "SCHEDULE": + return getScheduleItem(mouseOverItem) + case "RESERVATION": + return getReservationItem(mouseOverItem) + default: //when there should not be a pop-over; like a sun timing + return null; + } } -} /** * In the timeline, when hovering over an item, this popover will be shown * @param props mouseOverItem: the item with all it's information to be shown in the pop-up */ export default function TimelineItemPopover(props) { - const {mouseOverItem} = props; - if (!mouseOverItem) { - return; + + try { + const { mouseOverItem } = props; + if (!mouseOverItem) { + return; + } + return <div className="p-overlaypanel-content"> + {getItemForType(mouseOverItem)} + </div> + } + catch (e) { + return <div className="p-overlaypanel-content"> + Error parsing + </div> } - return <div className="p-overlaypanel-content"> - {getItemForType(mouseOverItem)} - </div> } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/toolbar/filters.helper.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/toolbar/filters.helper.js index 6f44dfa09e960891aef57f5f63b0714348c27608..1f54043851604a95e0fdfe0b2f2dfc021537bb90 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/toolbar/filters.helper.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/toolbar/filters.helper.js @@ -61,7 +61,7 @@ export function splitObjectIfSpanIsMultipleDays(element, shouldShowOnSkyTimes) { element.real_end_time = "Unknown" let spanInDays = 7 //initial amount of days if stop time is unknown - if (stopTime) { + if (stopTime) { element.real_end_time = moment(stopTime).format(UIConstants.CALENDAR_DATETIME_FORMAT) spanInDays = moment(stopTime).startOf('day').diff(moment(startTime).startOf('day'), 'days') } @@ -91,22 +91,22 @@ function getGroupCount(stations) { isISonly: isStations > 0 && csStations + rsStations === 0 } - if (stationFocus.isCSonly) { stationFocus.group="CS"} - if (stationFocus.isRSonly) { stationFocus.group="RS"} - if (stationFocus.isISonly) { stationFocus.group="IS"} + if (stationFocus.isCSonly) { stationFocus.group = "CS" } + if (stationFocus.isRSonly) { stationFocus.group = "RS" } + if (stationFocus.isISonly) { stationFocus.group = "IS" } + - return { summary: "CS/RS/IS : " + csStations + "/" + rsStations + "/" - + isStations, stationsgroups: { CS: csStations, RS: rsStations, IS: isStations } , stationFocus:stationFocus + + isStations, stationsgroups: { CS: csStations, RS: rsStations, IS: isStations }, stationFocus: stationFocus } } export function getStationsInfo(stations) { - let stationsInfo = { summary: "-", stationsgroups: { CS: 0, RS: 0, IS: 0 } , stationFocus:{ isCSonly:false, isRSonly:false, isISonly:false}} + let stationsInfo = { summary: "-", stationsgroups: { CS: 0, RS: 0, IS: 0 }, stationFocus: { isCSonly: false, isRSonly: false, isISonly: false } } if (stations?.length) { stationsInfo = getGroupCount(stations); if (stations.length < 3) { @@ -166,7 +166,13 @@ export function getTimelineItem(suBlueprint, displayDate, includeStationsInfo, i real_start_time: suBlueprint.real_start_time, real_end_time: suBlueprint.real_end_time, }; + + setGroupingKeys(timeLineRow, currentGrouping, includeStationsInfo, suBlueprint, includeStationsgroupInfo, stations); + return timeLineRow; +} + +function setGroupingKeys(timeLineRow, currentGrouping, includeStationsInfo, suBlueprint, includeStationsgroupInfo, stations) { if (timeLineRow.antenna_set !== undefined) { timeLineRow.antenna_set_group = timeLineRow.antenna_set + '#' + currentGrouping; } @@ -174,28 +180,22 @@ export function getTimelineItem(suBlueprint, displayDate, includeStationsInfo, i timeLineRow.band_group = timeLineRow.band + '#' + currentGrouping; } - - // we do want to include the stations specified here, cause lateron we will split them one by one station if grouping wants them per station if (includeStationsInfo) { - timeLineRow.specified_stations = suBlueprint.specified_stations - timeLineRow.used_stations = suBlueprint.used_stations - timeLineRow.missing_stations = suBlueprint.missing_stations - - + timeLineRow.specified_stations = suBlueprint.specified_stations; + timeLineRow.used_stations = suBlueprint.used_stations; + timeLineRow.missing_stations = suBlueprint.missing_stations; } - - // we do want to include the grouping info here, cause later on we will split them one by stationgroup if grouping wants them per group if (includeStationsgroupInfo) { - timeLineRow.stationsgroups = stations.stationsgroups + timeLineRow.stationsgroups = stations.stationsgroups; } if (includeStationsInfo || includeStationsgroupInfo) { timeLineRow.groupingSuffix = '#' + currentGrouping; - } - return timeLineRow; + + } /** @@ -214,8 +214,10 @@ export function getReservationItem(reservation, index, displayDate) { const group = moment(reservation.start_time).format(UIConstants.CALENDAR_GROUP_FORMAT); const blockColor = getReservationTypeColorIndex(specificationsDoc?.schedulability); const duration = reservation.duration ? UnitConverter.getSecsToHHmmss(reservation.duration) : "Unknown"; - const stations = getStationsInfo(specificationsDoc?.resources?.specified_stations); - return { + const stations = getStationsInfo(specificationsDoc?.resources?.stations); + + + let timeLineRow = { id: reservation.id + "~" + index, reservationId: reservation.id, start_time: startTime, @@ -223,11 +225,12 @@ export function getReservationItem(reservation, index, displayDate) { group: group, name: reservation.name, project: reservation.project_id, + type: 'RESERVATION', activity_type: `${type}${reservation.project_id ? (" - " + reservation.project_id) : ""}`, reason: type, title: '', - stations: stations, + stations: stations.summary, desc: reservation.description, duration: duration, planned: specificationsDoc?.activity?.planned, @@ -238,6 +241,14 @@ export function getReservationItem(reservation, index, displayDate) { selectedBgColor: blockColor.bgColor, color: blockColor.color }; + const currentGrouping = moment(timeLineRow.start_time).format(UIConstants.CALENDAR_DEFAULTDATE_FORMAT) + timeLineRow.name_group = timeLineRow.name + '#' + currentGrouping + timeLineRow.project_group = timeLineRow.project + '#' + currentGrouping + + + + + return timeLineRow; }