Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -64,8 +64,8 @@ describe("command registry", () => {
perform(actions.find((action) => action.id === "apiKeys")!);
expect(navigate).toHaveBeenNthCalledWith(1, "/acme/dashboard");
expect(navigate).toHaveBeenNthCalledWith(2, "/acme/settings/members");
expect(navigate).toHaveBeenNthCalledWith(3, "/acme/settings/api");
expect(navigate).toHaveBeenNthCalledWith(2, "/acme/settings/team");
expect(navigate).toHaveBeenNthCalledWith(3, "/acme/api");
expect(actions.find((action) => action.id === "members")?.scope).toMatchObject({
layout: "app",
tenantSlug: "acme",
@@ -178,22 +178,29 @@ describe("command registry", () => {
t,
navigate,
rootData: rootData(true, true),
appData: { ...appData({ admin: true, permissions: ["admin.accounts.view"] }), currentTenant: null, isSuperAdmin: true } as any,
appData: {
...appData({
admin: true,
permissions: ["admin.accounts.view", "admin_identity.sessions.read"],
}),
currentTenant: null,
isSuperAdmin: true,
} as any,
});
perform(actions.find((action) => action.id === "/dashboard")!);
perform(actions.find((action) => action.id === "/settings/profile")!);
perform(actions.find((action) => action.id === "/settings/security")!);
perform(actions.find((action) => action.name === "admin.switchToApp")!);
expect(navigate).toHaveBeenNthCalledWith(1, "/dashboard");
expect(navigate).toHaveBeenNthCalledWith(2, "/settings/profile");
expect(navigate).toHaveBeenNthCalledWith(2, "/settings/security");
expect(navigate).toHaveBeenNthCalledWith(3, "/select-tenant");
expect(actions.find((action) => action.id === "/dashboard")?.scope).toMatchObject({ layout: "admin", platform: true, adminOnly: true });
expect(actions.find((action) => action.name === "admin.switchToApp")?.scope).toMatchObject({ layout: "admin", platform: true, adminOnly: true });
expectNoLegacyPrefixes(navigate.mock.calls.map(([target]) => target));
});
it("does not expose expandable admin sidebar parents as command destinations", () => {
it("keeps expandable parents out of commands while exposing the consolidated settings hub", () => {
const actions = getCommandRegistryActions({
layout: "admin",
t,
@@ -201,7 +208,7 @@ describe("command registry", () => {
appData: {
...appData({
admin: true,
permissions: ["admin.accounts.view", "admin.settings.view"],
permissions: ["admin.accounts.view", "admin.settings.view", "admin_identity.sessions.read"],
}),
currentTenant: null,
isSuperAdmin: true,
@@ -210,9 +217,9 @@ describe("command registry", () => {
});
expect(actions.some((action) => action.id === "/accounts" && action.name === "app.sidebar.accountsAndUsers")).toBe(false);
expect(actions.some((action) => action.id === "/settings" && action.name === "app.sidebar.settings")).toBe(false);
expect(actions.some((action) => action.id === "/settings" && action.name === "app.sidebar.settings")).toBe(true);
expect(actions.some((action) => action.id === "/accounts" && action.name === "admin.tenants.title")).toBe(true);
expect(actions.some((action) => action.id === "/settings/profile")).toBe(true);
expect(actions.some((action) => action.id === "/settings/security")).toBe(true);
});
it("does not expose disabled sidebar items as command destinations", () => {
@@ -289,7 +296,22 @@ describe("command registry", () => {
id: "dashboard",
scope: { layout: "app" },
});
expect(getCommandRegistryActions({ layout: "admin", t, navigate: navigateMock(), rootData: rootData(true, true) })[0]).toMatchObject({
expect(
getCommandRegistryActions({
layout: "admin",
t,
navigate: navigateMock(),
rootData: rootData(true, true),
appData: {
...appData({
admin: true,
permissions: ["admin.dashboard.view"],
}),
currentTenant: null,
isSuperAdmin: false,
} as any,
})[0]
).toMatchObject({
id: "/dashboard",
scope: { layout: "admin" },
});
@@ -21,6 +21,7 @@ export type CommandActionScope = {
adminOnly?: boolean;
featureFlag?: string;
permission?: string;
anyPermissions?: string[];
};
export type CommandAction = {
@@ -105,7 +106,7 @@ function getAppCommandActions({ t, navigate, submitLogout, appData, rootData }:
keywords: "",
subtitle: t("app.sidebar.settings"),
scope: tenantScope({ permission: "app.settings.members.view" }),
perform: () => navigate(tenantPath("settings/members")),
perform: () => navigate(tenantPath("settings/team")),
});
pushPermissionAction(actions, appData, "app.settings.subscription.view", {
id: "subscription",
@@ -114,7 +115,7 @@ function getAppCommandActions({ t, navigate, submitLogout, appData, rootData }:
keywords: "",
subtitle: t("app.sidebar.settings"),
scope: tenantScope({ permission: "app.settings.subscription.view" }),
perform: () => navigate(tenantPath("settings/subscription")),
perform: () => navigate(tenantPath("settings/billing")),
});
pushPermissionAction(actions, appData, "app.settings.account.view", {
id: "account",
@@ -123,7 +124,7 @@ function getAppCommandActions({ t, navigate, submitLogout, appData, rootData }:
keywords: "",
subtitle: t("app.sidebar.settings"),
scope: tenantScope({ permission: "app.settings.account.view" }),
perform: () => navigate(tenantPath("settings/account")),
perform: () => navigate(tenantPath("settings/workspace")),
});
if (rootData.appConfiguration.app.features.tenantApiKeys) {
@@ -132,9 +133,9 @@ function getAppCommandActions({ t, navigate, submitLogout, appData, rootData }:
name: t("models.apiKey.plural"),
shortcut: [],
keywords: "",
subtitle: t("app.sidebar.settings"),
subtitle: t("models.apiKey.plural"),
scope: tenantScope({ featureFlag: "tenantApiKeys", permission: "app.settings.apiKeys.view" }),
perform: () => navigate(tenantPath("settings/api")),
perform: () => navigate(tenantPath("api")),
});
}
@@ -146,7 +147,7 @@ function getAppCommandActions({ t, navigate, submitLogout, appData, rootData }:
keywords: "",
subtitle: t("app.sidebar.settings"),
scope: tenantScope({ permission: "app.settings.auditTrails.view" }),
perform: () => navigate(tenantPath("settings/logs")),
perform: () => navigate(tenantPath("settings/compliance")),
});
actions.push({
id: "events",
@@ -155,7 +156,7 @@ function getAppCommandActions({ t, navigate, submitLogout, appData, rootData }:
keywords: "",
subtitle: t("app.sidebar.settings"),
scope: tenantScope({ permission: "app.settings.auditTrails.view" }),
perform: () => navigate(tenantPath("settings/logs/events")),
perform: () => navigate(tenantPath("settings/compliance/events")),
});
}
@@ -208,14 +209,15 @@ function getAdminCommandActions({ t, navigate, submitLogout, rootData }: Command
return [];
}
const actions = getSidebarCommandActions(AdminSidebar({ t, appConfiguration: rootData.appConfiguration, routing: rootData.routing }), "admin").map(
(action) => ({
const actions = getSidebarCommandActions(
AdminSidebar({ t, appConfiguration: rootData.appConfiguration, routing: rootData.routing }),
"admin"
).map((action) => ({
...action,
perform(currentAction: CommandAction) {
navigateOrAssign(currentAction.id, navigate);
},
})
);
}));
actions.push({
id: "create account",
shortcut: [],
@@ -272,7 +274,8 @@ function getCommandsFromSidebarItem(item: SideBarItem, layout: CommandRegistryLa
return commands;
}
const isExpandableOnlyParent = item.isCollapsible && item.items && item.items.length > 0;
if (item.path && item.title && !isExpandableOnlyParent) {
const childOwnsDestination = item.items?.some((subItem) => subItem.path === item.path);
if (item.path && item.title && !isExpandableOnlyParent && !childOwnsDestination) {
let description = item.description ?? "";
const parentTitles = parent.filter((value) => value);
if (parentTitles.length > 0) {
@@ -283,7 +286,7 @@ function getCommandsFromSidebarItem(item: SideBarItem, layout: CommandRegistryLa
name: item.title,
shortcut: [],
subtitle: description,
scope: { layout, platform: true, adminOnly: layout === "admin", permission: item.permission },
scope: { layout, platform: true, adminOnly: layout === "admin", permission: item.permission, anyPermissions: item.anyPermissions },
});
}
item.items?.forEach((subItem) => getCommandsFromSidebarItem(subItem, layout, commands, [...parent, item.title]));