diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/WeekView.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/WeekView.js index 35721c7aa9827578a901dc050d83b8f10eae6601..f63f81329ce87db72978ce3420b6ca1857fcce81 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/WeekView.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/WeekView.js @@ -279,12 +279,10 @@ export default function WeekView() { */ function handleData(event) { const jsonData = JSON.parse(event?.data) || {}; - console.log('received websocket data:', jsonData) switch (jsonData.object_type) { case 'scheduling_unit_blueprint': { switch (jsonData.action) { case 'delete': { - console.log('ws delete SU'); const schedulingUnits = data.schedulingUnits _.remove(schedulingUnits, function (su) { return su.id === jsonData.object_details.id}); setData(prevData => ({ @@ -297,7 +295,6 @@ export default function WeekView() { break; } case 'update': { - console.log("ws update SU"); setData(prevData => ({ ...prevData, schedulingUnits: prevData.schedulingUnits.map( @@ -321,8 +318,7 @@ export default function WeekView() { break; } case 'create': { - console.log("ws create SU"); - // the ws message only contains a subset of the details we need, so fetch the full set */ + // The websocket message only contains a subset of the details we need, so fetch the full set ScheduleService.getTimelineSlimBlueprints(undefined, undefined, jsonData.object_details.id) // todo: check time .then((response) => { setData(prevData => ({ @@ -330,13 +326,6 @@ export default function WeekView() { schedulingUnits: prevData.schedulingUnits.concat(response) })); }); - /** Note: the following works in principle, but the ws message is missing details which are - quite extensive to get broadcasted. Still, could be added in the websocket service. - setData(prevData => ({ - ...prevData, - schedulingUnits: prevData.schedulingUnits.concat([jsonData.object_details]) - })); - */ break; } default: { break; } @@ -346,7 +335,6 @@ export default function WeekView() { case 'reservation': { switch (jsonData.action) { case 'delete': { - console.log('ws delete reservation'); const reservations = data.reservations _.remove(reservations, function (res) { return res.id === jsonData.object_details.id}); setData(prevData => ({ @@ -359,7 +347,6 @@ export default function WeekView() { break; } case 'update': { - console.log("ws update reservation"); setData(prevData => ({ ...prevData, reservations: prevData.reservations.map( @@ -367,16 +354,15 @@ export default function WeekView() { ), })); if (summaryItem?.id === jsonData.object_details.id) { - // Note: this triggers a full fetch again to get all details (see SU above). + // Trigger a full refresh of the details panel setSummaryItem({id: jsonData.object_details.id, type: "RESERVATION"}); } break; } case 'create': { - console.log("ws create reservation"); const shouldFetchReservations = getStore(UIConstants.STORE_KEY_TIMELINE).reservationsToggle; if (shouldFetchReservations) { - // the ws message only contains a subset of the details we need, so fetch the full set + // The websocket message only contains a subset of the details we need, so fetch the full set ReservationService.getTimelineReservations(undefined, undefined, jsonData.object_details.id) // todo: check time .then((response) => { setData(prevData => ({ @@ -385,15 +371,6 @@ export default function WeekView() { })); }); } - /** Note: the following works in principle without fetching details, but new items don't render, - most likely due to missing details in the ws message, which need to be added in the websocket - service for this to work. - setData(prevData => ({ - ...prevData, - reservations: prevData.reservations.concat([jsonData.object_details]) - })); - */ - break; } default: { break; } @@ -404,11 +381,6 @@ export default function WeekView() { } } - // debug logging whenever the SU and reservation data gets updated - useEffect(() => { - console.log('data update:', data); - }, [data]) - // websocket hook that opens and allows interaction via the wss connection const { sendMessage,