A Connections page under Settings lists the organisation's forge connections: host, forge type, the reference to the credential (never its value), the external account it belongs to, and the operations each execution identity may perform through it. The chat agent's page registry names the page too.
122 lines
3.4 KiB
TypeScript
122 lines
3.4 KiB
TypeScript
import { routes } from "@/router";
|
|
import { hiddenRoutes, type CapabilitySections } from "./capabilities";
|
|
import {
|
|
buildNav,
|
|
type NavNode,
|
|
type NavRoute,
|
|
type NavSpec,
|
|
} from "./nav-tree";
|
|
|
|
export type { NavEntry, NavGroup, NavLink, NavNode } from "./nav-tree";
|
|
|
|
interface NavRouteNode extends NavRoute {
|
|
meta?: {
|
|
label?: string;
|
|
description?: string;
|
|
section?: string;
|
|
navPath?: string;
|
|
};
|
|
children?: NavRouteNode[];
|
|
}
|
|
|
|
// A nested route is still a destination: an Org tab has to resolve the nav
|
|
// entry that keeps Org current.
|
|
function flattenRoutes(list: NavRouteNode[]): NavRouteNode[] {
|
|
return list.flatMap((route) => [
|
|
route,
|
|
...flattenRoutes(route.children ?? []),
|
|
]);
|
|
}
|
|
|
|
const table = flattenRoutes(routes as NavRouteNode[]);
|
|
|
|
// Primary destinations; access administration has its own area.
|
|
const specs: NavSpec[] = [
|
|
{ kind: "link", path: "/" },
|
|
{ kind: "link", path: "/tasks" },
|
|
{ kind: "link", path: "/workflows" },
|
|
{ kind: "link", path: "/events" },
|
|
{ kind: "link", path: "/access" },
|
|
{ kind: "link", path: "/settings" },
|
|
];
|
|
|
|
// The Settings sidebar, grouped by what is being configured.
|
|
const settings: NavSpec = {
|
|
kind: "group",
|
|
label: "Settings",
|
|
sections: [
|
|
{
|
|
label: "Agents",
|
|
paths: [
|
|
"/settings/soul",
|
|
"/settings/agent-profiles",
|
|
"/settings/models",
|
|
"/settings/skills",
|
|
"/settings/curators",
|
|
"/settings/schedules",
|
|
"/settings/playbooks",
|
|
"/settings/scheduling-policy",
|
|
"/settings/review",
|
|
],
|
|
},
|
|
{
|
|
label: "Integrations",
|
|
paths: [
|
|
"/settings/channels",
|
|
"/settings/connections",
|
|
"/settings/repositories",
|
|
"/settings/tools",
|
|
"/settings/extensions",
|
|
"/settings/plugins",
|
|
"/settings/secret-engines",
|
|
],
|
|
},
|
|
{
|
|
label: "Runtime",
|
|
paths: [
|
|
"/settings/task-execution",
|
|
"/settings/container-runtime",
|
|
"/settings/harness",
|
|
"/settings/credential-bindings",
|
|
"/settings/status",
|
|
],
|
|
},
|
|
{ paths: ["/settings/appearance", "/settings/history"] },
|
|
],
|
|
};
|
|
|
|
// Reached from the Dashboard's Logs button and the account menu, and by
|
|
// Jump to, but not from the bar.
|
|
const unlisted = ["/logs", "/account", "/settings/authentication", "/access/policies", "/access/agents", "/access/workspaces", "/access/models"];
|
|
|
|
/** hiddenPaths lists the routes this composition cannot back. */
|
|
export function hiddenPaths(sections: CapabilitySections | null): string[] {
|
|
return hiddenRoutes(sections, table);
|
|
}
|
|
|
|
export function navTree(hidden: string[] = []): NavNode[] {
|
|
return buildNav(table, specs, hidden).tree;
|
|
}
|
|
|
|
/** navEntries lists every destination Jump to can reach. */
|
|
export function navEntries(hidden: string[] = []) {
|
|
return buildNav(table, [...specs, settings], hidden, unlisted).jumpTargets;
|
|
}
|
|
|
|
/** settingsNav is the Settings sidebar; each section labels its first item. */
|
|
export function settingsNav(hidden: string[] = []) {
|
|
const [group] = buildNav(table, [settings], hidden).tree;
|
|
return group?.kind === "group" ? group.items : [];
|
|
}
|
|
|
|
/**
|
|
* activeNavPath maps the current route onto the nav entry that should read as
|
|
* current, so /tasks/42 keeps Tasks lit rather than lighting nothing.
|
|
*/
|
|
export function activeNavPath(path: string): string {
|
|
const route = table.find((r) => r.path === path);
|
|
const navPath = route?.meta?.navPath;
|
|
if (typeof navPath === "string") return navPath;
|
|
return path;
|
|
}
|