The broadcast, schedules and message log cards now sit on the swarm page, after the notification router; the message log opens its stream on its first open instead of when the page loads, and its connection badge moves into its filter bar. The messages tab is removed from the header, and the old /messages address redirects to /swarm next to /schedules, which now does too. MessagesPage becomes MessageCards, and comments, tests and the swarm UI docs say the swarm page where they said the messages tab.
76 lines
2.7 KiB
TypeScript
76 lines
2.7 KiB
TypeScript
// Root shell component — routing only. Each route's content is its own
|
|
// page component under `./pages/`; this file just maps paths to them.
|
|
import {
|
|
Link,
|
|
Redirect,
|
|
Route,
|
|
Router,
|
|
Switch,
|
|
useSearch,
|
|
} from "wouter-preact";
|
|
import { MOVED_ROUTES, movedHref } from "./shell/routes.js";
|
|
import { Shell } from "./shell/Shell.js";
|
|
import { useGuardedLocation } from "./shell/useGuardedLocation.js";
|
|
import { AgentsPage } from "./pages/agents/AgentsPage.js";
|
|
import { AgentGroupPage } from "./pages/agents/AgentGroupPage.js";
|
|
import { AgentTerminalPage } from "./pages/agents/AgentTerminalPage.js";
|
|
import { NEW_FLOW_PATH } from "./pages/notifications/FlowDraft.js";
|
|
import { FlowEditorPage } from "./pages/notifications/FlowEditorPage.js";
|
|
import { SwarmPage } from "./pages/swarm/SwarmPage.js";
|
|
import { ComponentsPage } from "./pages/ComponentsPage.js";
|
|
import { JobsPage } from "./pages/JobsPage.js";
|
|
import { ReportsPage } from "./pages/reports/ReportsPage.js";
|
|
import { StartPage } from "./pages/StartPage.js";
|
|
import { Panel } from "./ui/panel/Panel.js";
|
|
import { ToastHost } from "./ui/toast/Toast.js";
|
|
|
|
// An address from before the tabs were folded together: replace it with the
|
|
// tab that holds the page now, query kept.
|
|
function MovedTo({ from }: { from: string }) {
|
|
return <Redirect to={movedHref(from, useSearch()) ?? "/"} replace />;
|
|
}
|
|
|
|
function NotFound() {
|
|
return (
|
|
<Panel title="404" icon="🧭">
|
|
<p>no route here.</p>
|
|
<p>
|
|
<Link href="/">back to the start page</Link>
|
|
</p>
|
|
</Panel>
|
|
);
|
|
}
|
|
|
|
export function App() {
|
|
return (
|
|
<Router hook={useGuardedLocation}>
|
|
<ToastHost />
|
|
<Shell>
|
|
<Switch>
|
|
<Route path="/" component={StartPage} />
|
|
<Route path="/reports" component={ReportsPage} />
|
|
{Object.keys(MOVED_ROUTES).map((from) => (
|
|
<Route key={from} path={from}>
|
|
<MovedTo from={from} />
|
|
</Route>
|
|
))}
|
|
<Route path="/agents" component={AgentsPage} />
|
|
<Route path="/agents/group/:id" component={AgentGroupPage} />
|
|
<Route path="/agents/:name/terminal" component={AgentTerminalPage} />
|
|
<Route
|
|
path="/agents/:name/subagents/:subagent/terminal"
|
|
component={AgentTerminalPage}
|
|
/>
|
|
<Route path="/jobs" component={JobsPage} />
|
|
<Route path="/swarm" component={SwarmPage} />
|
|
<Route path={NEW_FLOW_PATH}>
|
|
<FlowEditorPage params={{ flowId: "" }} isNew />
|
|
</Route>
|
|
<Route path="/notifications/:flowId" component={FlowEditorPage} />
|
|
<Route path="/components" component={ComponentsPage} />
|
|
<Route component={NotFound} />
|
|
</Switch>
|
|
</Shell>
|
|
</Router>
|
|
);
|
|
}
|