chore: initialize repository with deployment baseline
This commit is contained in:
54
src/components/layout/nav-config.js
Normal file
54
src/components/layout/nav-config.js
Normal file
@@ -0,0 +1,54 @@
|
||||
export const navigationGroups = [
|
||||
{
|
||||
id: "overview",
|
||||
label: "Overview",
|
||||
items: [
|
||||
{ path: "/", label: "Dashboard", iconKey: "dashboard" },
|
||||
{ path: "/monitoring", label: "Monitoring", iconKey: "monitoring" },
|
||||
{ path: "/operations", label: "Operations", iconKey: "operations" },
|
||||
{ path: "/audit-logs", label: "Audit Logs", iconKey: "audit" }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "compute",
|
||||
label: "Compute",
|
||||
items: [
|
||||
{ path: "/vms", label: "Virtual Machines", iconKey: "vms" },
|
||||
{ path: "/nodes", label: "Nodes", iconKey: "nodes" },
|
||||
{ path: "/provisioning", label: "Provisioning", iconKey: "provisioning" },
|
||||
{ path: "/backups", label: "Backups", iconKey: "backups" }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "network",
|
||||
label: "Network",
|
||||
items: [
|
||||
{ path: "/network", label: "IPAM & Pools", iconKey: "network" },
|
||||
{ path: "/security", label: "Security", iconKey: "security" }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "tenant",
|
||||
label: "Tenants",
|
||||
items: [
|
||||
{ path: "/tenants", label: "Tenants", iconKey: "tenants" },
|
||||
{ path: "/client", label: "Client Area", iconKey: "client" },
|
||||
{ path: "/billing", label: "Billing", iconKey: "billing" },
|
||||
{ path: "/rbac", label: "RBAC", iconKey: "rbac" },
|
||||
{ path: "/settings", label: "Settings", iconKey: "settings" }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
export const flatNavigation = navigationGroups.flatMap((group) =>
|
||||
group.items.map((item) => ({ ...item, group: group.label }))
|
||||
);
|
||||
|
||||
export function resolveNavigation(pathname) {
|
||||
if (!pathname || pathname === "/") {
|
||||
return flatNavigation.find((item) => item.path === "/") ?? null;
|
||||
}
|
||||
|
||||
const sortedBySpecificity = [...flatNavigation].sort((a, b) => b.path.length - a.path.length);
|
||||
return sortedBySpecificity.find((item) => item.path !== "/" && pathname.startsWith(item.path)) ?? null;
|
||||
}
|
||||
Reference in New Issue
Block a user