Skip to content

Commit

Permalink
fix(machines): Broken routes for machine and controller logs lp2060133 (
Browse files Browse the repository at this point in the history
  • Loading branch information
ndv99 committed Apr 4, 2024
1 parent e4c49ba commit 9d9edb4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/app/base/components/node/NodeLogs/NodeLogs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe("NodeLogs", () => {
{
route: path,
state,
routePattern: `${urls.machines.machine.logs.index(null)}/*`,
}
);
expect(screen.getByLabelText(label)).toBeInTheDocument();
Expand Down
13 changes: 11 additions & 2 deletions src/app/base/components/node/NodeLogs/NodeLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import InstallationOutput from "./InstallationOutput";
import type { ControllerDetails } from "@/app/store/controller/types";
import type { MachineDetails } from "@/app/store/machine/types";
import type { Node } from "@/app/store/types/node";
import { getRelativeRoute } from "@/app/utils";

type GenerateURL = (
args: { id: Node["system_id"] } | null,
Expand All @@ -29,6 +30,7 @@ const NodeLogs = ({ node, urls }: Props): JSX.Element => {
const showingOutput = pathname.startsWith(
urls.installationOutput({ id: node.system_id })
);

return (
<>
<div className="u-position--relative">
Expand All @@ -55,10 +57,17 @@ const NodeLogs = ({ node, urls }: Props): JSX.Element => {
<Routes>
<Route
element={<InstallationOutput node={node} />}
path={urls.installationOutput(null)}
path={getRelativeRoute(
urls.installationOutput(null),
urls.index(null)
)}
/>
{[urls.index(null), urls.events(null)].map((path) => (
<Route element={<EventLogs node={node} />} key={path} path={path} />
<Route
element={<EventLogs node={node} />}
key={path}
path={getRelativeRoute(path, urls.index(null))}
/>
))}
</Routes>
</>
Expand Down
18 changes: 2 additions & 16 deletions src/app/controllers/views/ControllerDetails/ControllerDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,10 @@ const ControllerDetails = (): JSX.Element => {
/>
<Route
element={<ControllerLogs systemId={id} />}
path={getRelativeRoute(
path={`${getRelativeRoute(
urls.controllers.controller.logs.index(null),
base
)}
/>
<Route
element={<ControllerLogs systemId={id} />}
path={getRelativeRoute(
urls.controllers.controller.logs.events(null),
base
)}
/>
<Route
element={<ControllerLogs systemId={id} />}
path={getRelativeRoute(
urls.controllers.controller.logs.installationOutput(null),
base
)}
)}/*`}
/>
<Route
element={<ControllerConfiguration systemId={id} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe("ControllerLogs", () => {
renderWithBrowserRouter(<ControllerLogs systemId="abc123" />, {
route: path,
state,
routePattern: `${urls.controllers.controller.logs.index(null)}/*`,
});
expect(screen.getByLabelText(label)).toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe("MachineLogs", () => {
renderWithBrowserRouter(<MachineLogs systemId="abc123" />, {
route: path,
state,
routePattern: `${urls.machines.machine.logs.index(null)}/*`,
});
expect(screen.getByLabelText(label)).toBeInTheDocument();
});
Expand Down

0 comments on commit 9d9edb4

Please sign in to comment.