Skip to content

Commit

Permalink
fix: duplicate ui served from gin Router (#781)
Browse files Browse the repository at this point in the history
Signed-off-by: veds-g <[email protected]>
  • Loading branch information
veds-g authored Jun 8, 2023
1 parent e9ea7d8 commit 5ce6936
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions server/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ func Start(insecure bool, port int, namespaced bool, managedNamespace string, ba
router.Use(gin.LoggerWithConfig(gin.LoggerConfig{SkipPaths: []string{"/livez"}}))
router.RedirectTrailingSlash = true
router.Use(static.Serve(baseHref, static.LocalFile("./ui/build", true)))
router.NoRoute(func(c *gin.Context) {
c.File("./ui/build/index.html")
})
if baseHref != "/" {
router.NoRoute(func(c *gin.Context) {
c.File("./ui/build/index.html")
})
}
routes.Routes(router, routes.SystemInfo{ManagedNamespace: managedNamespace, Namespaced: namespaced})
router.Use(UrlRewrite(router))
server := http.Server{
Expand Down
4 changes: 3 additions & 1 deletion ui/src/components/common/Breadcrumbs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useMemo } from "react";
import { useLocation, Link } from "react-router-dom";
import { Link, useLocation } from "react-router-dom";
import MUIBreadcrumbs from "@mui/material/Breadcrumbs";
import Typography from "@mui/material/Typography";

Expand All @@ -22,6 +22,8 @@ export function Breadcrumbs() {
);
}
const pathParts = pathname.split("/");
// safety check for trailing slash
if (pathname.charAt(pathname.length - 1) === "/") pathParts.pop();
switch (pathParts.length) {
case 5: // pipeline view
return [
Expand Down
1 change: 0 additions & 1 deletion ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const theme = createTheme({
main: "#0077C5",
},
},

});

root.render(
Expand Down

0 comments on commit 5ce6936

Please sign in to comment.