Skip to content

Commit

Permalink
fix(ui): micronaut context-path is not working since the migration to…
Browse files Browse the repository at this point in the history
… vite

close #868
  • Loading branch information
tchiotludo committed Jan 14, 2023
1 parent e5dc41f commit 3182601
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
split.pop();
return split.join('/') + "/";
}();
const KESTRA_ASSETS = '<% print(JSON.stringify(compilation.getStats().toJson().assetsByChunkName)); %>'
if (localStorage.getItem("theme")) {
document.getElementsByTagName("html")[0].classList.add(localStorage.getItem("theme"));
}
Expand Down
2 changes: 1 addition & 1 deletion ui/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {defineConfig} from "vite";
import vue from "@vitejs/plugin-vue";

export default defineConfig({
base: "/ui",
base: "",
build: {
outDir: "../webserver/src/main/resources/ui",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.kestra.webserver.controllers;

import io.micronaut.context.annotation.Value;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
Expand All @@ -11,9 +13,13 @@
@Slf4j
@Controller
public class RedirectController {
@Nullable
@Value("${micronaut.server.context-path}")
protected String basePath;

@Get
@Hidden
public HttpResponse<?> slash() {
return HttpResponse.temporaryRedirect(URI.create("/ui/"));
return HttpResponse.temporaryRedirect(URI.create((basePath != null ? basePath : "") + "/ui/"));
}
}

0 comments on commit 3182601

Please sign in to comment.