Integrace s KSPím webem #64
6 changed files with 8 additions and 6 deletions
|
@ -28,7 +28,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding: 0">
|
<body style="padding: 0">
|
||||||
<div id="svelte-root" style="position: relative;">
|
<div id="page" style="position: relative;">
|
||||||
<noscript>Interaktivní grafy bez Javascriptu neumím</noscript>
|
<noscript>Interaktivní grafy bez Javascriptu neumím</noscript>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import App from './App.svelte';
|
import App from './App.svelte';
|
||||||
|
|
||||||
|
document.getElementById("page").innerHTML = "";
|
||||||
|
|
||||||
const app = new App({
|
const app = new App({
|
||||||
target: document.getElementById("svelte-root")!,
|
target: document.getElementById("page")!,
|
||||||
props: { }
|
props: { }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ export function createEdges(nodes: TaskDescriptor[]): TaskEdge[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadTasks(): Promise<TasksFile> {
|
export async function loadTasks(): Promise<TasksFile> {
|
||||||
const r = await fetch("/tasks.json")
|
const r = await fetch("/kurz/tasks.json")
|
||||||
const j = await r.json()
|
const j = await r.json()
|
||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ using Microsoft.Extensions.Options;
|
||||||
namespace Ksp.WebServer.Controllers
|
namespace Ksp.WebServer.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("grafik")]
|
[Route("kurz")]
|
||||||
public class GrafikPageController : ControllerBase
|
public class GrafikPageController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ILogger<TasksController> logger;
|
private readonly ILogger<TasksController> logger;
|
||||||
|
|
|
@ -11,7 +11,7 @@ using Microsoft.Extensions.Logging;
|
||||||
namespace Ksp.WebServer.Controllers
|
namespace Ksp.WebServer.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("tasks.json")]
|
[Route("/kurz/tasks.json")]
|
||||||
public class TasksController : ControllerBase
|
public class TasksController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ILogger<TasksController> logger;
|
private readonly ILogger<TasksController> logger;
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Ksp.WebServer
|
||||||
if (encyklopedie is object)
|
if (encyklopedie is object)
|
||||||
{
|
{
|
||||||
encyklopedie.TextContent = "Kurzy";
|
encyklopedie.TextContent = "Kurzy";
|
||||||
encyklopedie.SetAttribute("href", "/grafik");
|
encyklopedie.SetAttribute("href", "/kurz");
|
||||||
if ("grafik" == path)
|
if ("grafik" == path)
|
||||||
{
|
{
|
||||||
foreach (var li in document.QuerySelectorAll("#menu ul li.active"))
|
foreach (var li in document.QuerySelectorAll("#menu ul li.active"))
|
||||||
|
|
Reference in a new issue