From 6cde72da736a02be7a1018e8e65267264bb8260f Mon Sep 17 00:00:00 2001 From: Vasek Sraier Date: Mon, 30 Nov 2020 00:35:05 +0100 Subject: [PATCH 1/4] frontend: hackfixes trying to make the frontend work with the rest of KSP infra --- frontend/public/grafik.html | 2 +- frontend/src/main.ts | 2 +- frontend/src/tasks.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/public/grafik.html b/frontend/public/grafik.html index 794bcea..10f86b6 100644 --- a/frontend/public/grafik.html +++ b/frontend/public/grafik.html @@ -28,7 +28,7 @@ -
+
diff --git a/frontend/src/main.ts b/frontend/src/main.ts index b6e5acc..f89291c 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -1,7 +1,7 @@ import App from './App.svelte'; const app = new App({ - target: document.getElementById("svelte-root")!, + target: document.getElementById("page")!, props: { } }); diff --git a/frontend/src/tasks.ts b/frontend/src/tasks.ts index 4a246ea..68ea929 100644 --- a/frontend/src/tasks.ts +++ b/frontend/src/tasks.ts @@ -50,7 +50,7 @@ export function createEdges(nodes: TaskDescriptor[]): TaskEdge[] { } export async function loadTasks(): Promise { - const r = await fetch("/tasks.json") + const r = await fetch("/kurz/tasks.json") const j = await r.json() return j } From b7c1ffc1e9f6adf3824b232d088a636cd11f0854 Mon Sep 17 00:00:00 2001 From: Vasek Sraier Date: Mon, 30 Nov 2020 00:44:34 +0100 Subject: [PATCH 2/4] main.ts: trying to remove HTML content from the target div --- frontend/src/main.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/main.ts b/frontend/src/main.ts index f89291c..39440e7 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -1,5 +1,7 @@ import App from './App.svelte'; +document.getElementById("page").innerHTML = ""; + const app = new App({ target: document.getElementById("page")!, props: { } From 5e48f5b46bf13e7e7e34b0ef78fc61d88686cfec Mon Sep 17 00:00:00 2001 From: Vasek Sraier Date: Mon, 30 Nov 2020 11:47:52 +0100 Subject: [PATCH 3/4] proxy server: move tasks.json endpoint --- server/Ksp.WebServer/Controllers/TasksController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/Ksp.WebServer/Controllers/TasksController.cs b/server/Ksp.WebServer/Controllers/TasksController.cs index eb59b98..921d9f1 100644 --- a/server/Ksp.WebServer/Controllers/TasksController.cs +++ b/server/Ksp.WebServer/Controllers/TasksController.cs @@ -11,7 +11,7 @@ using Microsoft.Extensions.Logging; namespace Ksp.WebServer.Controllers { [ApiController] - [Route("tasks.json")] + [Route("/kurz/tasks.json")] public class TasksController : ControllerBase { private readonly ILogger logger; From bdce8e451870c72172b1f7fc2533c851177ff790 Mon Sep 17 00:00:00 2001 From: Vasek Sraier Date: Mon, 30 Nov 2020 11:50:50 +0100 Subject: [PATCH 4/4] proxy: moved /grafik to /kurz --- server/Ksp.WebServer/Controllers/GrafikPageController.cs | 2 +- server/Ksp.WebServer/KspPageRewriter.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/Ksp.WebServer/Controllers/GrafikPageController.cs b/server/Ksp.WebServer/Controllers/GrafikPageController.cs index 40fc950..b1b3a62 100644 --- a/server/Ksp.WebServer/Controllers/GrafikPageController.cs +++ b/server/Ksp.WebServer/Controllers/GrafikPageController.cs @@ -16,7 +16,7 @@ using Microsoft.Extensions.Options; namespace Ksp.WebServer.Controllers { [ApiController] - [Route("grafik")] + [Route("kurz")] public class GrafikPageController : ControllerBase { private readonly ILogger logger; diff --git a/server/Ksp.WebServer/KspPageRewriter.cs b/server/Ksp.WebServer/KspPageRewriter.cs index 18e3410..ffe6577 100644 --- a/server/Ksp.WebServer/KspPageRewriter.cs +++ b/server/Ksp.WebServer/KspPageRewriter.cs @@ -37,7 +37,7 @@ namespace Ksp.WebServer if (encyklopedie is object) { encyklopedie.TextContent = "Kurzy"; - encyklopedie.SetAttribute("href", "/grafik"); + encyklopedie.SetAttribute("href", "/kurz"); if ("grafik" == path) { foreach (var li in document.QuerySelectorAll("#menu ul li.active"))