From 836956d2568756db828242b404846a6a762a7f71 Mon Sep 17 00:00:00 2001 From: NguyenDonLam Date: Tue, 8 Oct 2024 01:20:58 +1100 Subject: [PATCH 1/7] feat(display ganttchart): adding persistence to Gantt pages (untested) --- frontend/src/components/GanttChart.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/GanttChart.tsx b/frontend/src/components/GanttChart.tsx index 841f411..dfc7be1 100644 --- a/frontend/src/components/GanttChart.tsx +++ b/frontend/src/components/GanttChart.tsx @@ -3,6 +3,7 @@ import { Id } from "vis-data/declarations/data-interface"; import { DataGroupCollectionType, DataItemCollectionType, DataSet, Timeline } from "vis-timeline/standalone"; import "vis-timeline/styles/vis-timeline-graph2d.min.css"; import "../styles/ganttUnassignable.css"; +import { useAuthContext } from "../security/AuthContext"; import { findCampusSolution, @@ -13,13 +14,14 @@ import { rawDate, toRawDate, } from "../scripts/solutionParsing"; -import { TimetableSolution, Unit } from "../scripts/api"; +import { LOCAL_API_URL, TimetableSolution, Unit } from "../scripts/api"; import { useParams } from "react-router-dom"; import JSZip from "jszip"; import { saveAs } from "file-saver"; export default memo(function GanttChart() { const params = useParams(); + const { authHeader } = useAuthContext(); const timelineRef = useRef(null); const items = useRef(new DataSet()); const groups = useRef(new DataSet()); @@ -218,6 +220,7 @@ export default memo(function GanttChart() { method: "PUT", headers: { "Content-Type": "application/json", + "Authorization": authHeader, }, body: JSON.stringify(moddedUnits), }); @@ -225,6 +228,21 @@ export default memo(function GanttChart() { if (!response.ok) { throw new Error("Failed to save data, error in GanttChart.tsx"); } + + + + fetch(LOCAL_API_URL + "/timetabling/view", { headers: { 'Authorization': authHeader } }) + .then((response) => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.json(); + }) + .then((data) => { + const timetableSolutions: TimetableSolution[] = + data as TimetableSolution[]; + sessionStorage.setItem("campusSolutions", JSON.stringify(timetableSolutions)); + }); } catch (error) { console.error("Error saving data:", error); } From a9ca561c890daa8ef68b3bd99aec2ee1e66250ee Mon Sep 17 00:00:00 2001 From: NguyenDonLam Date: Tue, 8 Oct 2024 01:20:58 +1100 Subject: [PATCH 2/7] feat(display ganttchart): adding persistence to Gantt pages (untested) --- frontend/src/components/GanttChart.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/GanttChart.tsx b/frontend/src/components/GanttChart.tsx index 841f411..dfc7be1 100644 --- a/frontend/src/components/GanttChart.tsx +++ b/frontend/src/components/GanttChart.tsx @@ -3,6 +3,7 @@ import { Id } from "vis-data/declarations/data-interface"; import { DataGroupCollectionType, DataItemCollectionType, DataSet, Timeline } from "vis-timeline/standalone"; import "vis-timeline/styles/vis-timeline-graph2d.min.css"; import "../styles/ganttUnassignable.css"; +import { useAuthContext } from "../security/AuthContext"; import { findCampusSolution, @@ -13,13 +14,14 @@ import { rawDate, toRawDate, } from "../scripts/solutionParsing"; -import { TimetableSolution, Unit } from "../scripts/api"; +import { LOCAL_API_URL, TimetableSolution, Unit } from "../scripts/api"; import { useParams } from "react-router-dom"; import JSZip from "jszip"; import { saveAs } from "file-saver"; export default memo(function GanttChart() { const params = useParams(); + const { authHeader } = useAuthContext(); const timelineRef = useRef(null); const items = useRef(new DataSet()); const groups = useRef(new DataSet()); @@ -218,6 +220,7 @@ export default memo(function GanttChart() { method: "PUT", headers: { "Content-Type": "application/json", + "Authorization": authHeader, }, body: JSON.stringify(moddedUnits), }); @@ -225,6 +228,21 @@ export default memo(function GanttChart() { if (!response.ok) { throw new Error("Failed to save data, error in GanttChart.tsx"); } + + + + fetch(LOCAL_API_URL + "/timetabling/view", { headers: { 'Authorization': authHeader } }) + .then((response) => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.json(); + }) + .then((data) => { + const timetableSolutions: TimetableSolution[] = + data as TimetableSolution[]; + sessionStorage.setItem("campusSolutions", JSON.stringify(timetableSolutions)); + }); } catch (error) { console.error("Error saving data:", error); } From 9d04c7d88e767ec8a0add906c368aa03cca75585 Mon Sep 17 00:00:00 2001 From: NguyenDonLam Date: Thu, 10 Oct 2024 14:20:46 +1100 Subject: [PATCH 3/7] fix(display ganttchart): client cant add data/remove data from gantt --- frontend/src/components/GanttChart.tsx | 48 ++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/GanttChart.tsx b/frontend/src/components/GanttChart.tsx index dfc7be1..ebe0818 100644 --- a/frontend/src/components/GanttChart.tsx +++ b/frontend/src/components/GanttChart.tsx @@ -18,6 +18,7 @@ import { LOCAL_API_URL, TimetableSolution, Unit } from "../scripts/api"; import { useParams } from "react-router-dom"; import JSZip from "jszip"; import { saveAs } from "file-saver"; +import { Button } from "@mui/material"; export default memo(function GanttChart() { const params = useParams(); @@ -60,7 +61,13 @@ export default memo(function GanttChart() { end: "2024-10-19", min: "2024-10-14", max: "2024-10-19", - editable: true, + editable: { + add: false, // add new items by double tapping + updateTime: true, // drag items horizontally + updateGroup: true, // drag items from one group to another + remove: false, // delete an item by tapping the delete button top right + overrideItems: false, // allow these options to override item.editable + }, }; // Initialize the timeline @@ -251,8 +258,43 @@ export default memo(function GanttChart() { return (
- - + +
); }) From 6aef8a230600dfc58d229253448ff9ee5b29d4db Mon Sep 17 00:00:00 2001 From: NguyenDonLam Date: Thu, 10 Oct 2024 16:01:41 +1100 Subject: [PATCH 4/7] fix(display ganttchart): download corrupted building fix --- frontend/src/components/GanttChart.tsx | 2 +- frontend/src/styles/ganttUnassignable.css | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/GanttChart.tsx b/frontend/src/components/GanttChart.tsx index ebe0818..62c6a6f 100644 --- a/frontend/src/components/GanttChart.tsx +++ b/frontend/src/components/GanttChart.tsx @@ -208,7 +208,7 @@ export default memo(function GanttChart() { "-" + course.replace(/[^a-zA-Z0-9]/g, "_") + ".csv", - csvData + csvData.replace(/\u00A0/g, "")// TODO: TEST THIS OUT ); } }) diff --git a/frontend/src/styles/ganttUnassignable.css b/frontend/src/styles/ganttUnassignable.css index ed6eff8..b3f10a4 100644 --- a/frontend/src/styles/ganttUnassignable.css +++ b/frontend/src/styles/ganttUnassignable.css @@ -1,3 +1,7 @@ .vis-item.vis-background.negative { background-color: rgba(255, 0, 0, 0.2); +} + +.modified { + background-color: "red"; } \ No newline at end of file From 515d7bd8afec5e35da2b1158c59b3fb7c3b30b35 Mon Sep 17 00:00:00 2001 From: NguyenDonLam Date: Thu, 10 Oct 2024 16:07:19 +1100 Subject: [PATCH 5/7] fix(display ganttchart): GanttChart now use remote backend --- frontend/src/components/GanttChart.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/GanttChart.tsx b/frontend/src/components/GanttChart.tsx index 62c6a6f..ead4329 100644 --- a/frontend/src/components/GanttChart.tsx +++ b/frontend/src/components/GanttChart.tsx @@ -14,7 +14,7 @@ import { rawDate, toRawDate, } from "../scripts/solutionParsing"; -import { LOCAL_API_URL, TimetableSolution, Unit } from "../scripts/api"; +import { REMOTE_API_URL, TimetableSolution, Unit } from "../scripts/api"; import { useParams } from "react-router-dom"; import JSZip from "jszip"; import { saveAs } from "file-saver"; @@ -223,7 +223,7 @@ export default memo(function GanttChart() { const saveData = async () => { try { - const response = await fetch("http://localhost:8080/timetabling/update", { + const response = await fetch(REMOTE_API_URL + "/timetabling/update", { method: "PUT", headers: { "Content-Type": "application/json", @@ -238,7 +238,7 @@ export default memo(function GanttChart() { - fetch(LOCAL_API_URL + "/timetabling/view", { headers: { 'Authorization': authHeader } }) + fetch(REMOTE_API_URL + "/timetabling/view", { headers: { 'Authorization': authHeader } }) .then((response) => { if (!response.ok) { throw new Error("Network response was not ok"); From 637ea07b40e65b4f9ff232de854b295a3fca168d Mon Sep 17 00:00:00 2001 From: NguyenDonLam Date: Sat, 12 Oct 2024 21:48:00 +1100 Subject: [PATCH 6/7] fix(display ganttchart): corrupted building v2 --- frontend/src/components/GanttChart.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/GanttChart.tsx b/frontend/src/components/GanttChart.tsx index ead4329..79765cc 100644 --- a/frontend/src/components/GanttChart.tsx +++ b/frontend/src/components/GanttChart.tsx @@ -208,7 +208,7 @@ export default memo(function GanttChart() { "-" + course.replace(/[^a-zA-Z0-9]/g, "_") + ".csv", - csvData.replace(/\u00A0/g, "")// TODO: TEST THIS OUT + csvData.replace(/\u00A0/g, " ") ); } }) From b93c8d5214c012724727d437d9dc2a6cb7bcd82e Mon Sep 17 00:00:00 2001 From: NguyenDonLam Date: Sat, 12 Oct 2024 22:09:24 +1100 Subject: [PATCH 7/7] fix: front page image now takes up the full space dynamically --- frontend/src/pages/Enrolment.tsx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/Enrolment.tsx b/frontend/src/pages/Enrolment.tsx index 1d1cf76..fa9557d 100644 --- a/frontend/src/pages/Enrolment.tsx +++ b/frontend/src/pages/Enrolment.tsx @@ -48,17 +48,29 @@ export default function StarterPage() {
- + Time tabler - The smartest Timetabler ever -

A timetabling website for the Victorian Institute of Technology

-

-Team JetEdge

+ + The smartest Timetabler ever + +

+ A timetabling website for the Victorian Institute of Technology +

+

-Team JetEdge

- +
- logo.exe + logo.exe