refactor(webui): describe organization function actions

This commit is contained in:
2026-07-21 13:51:19 +02:00
parent 865901f090
commit 2ca61059dc
2 changed files with 33 additions and 3 deletions

View File

@@ -365,11 +365,12 @@ export type OrganizationFunctionActionContext = PlatformRouteContext & {
export type OrganizationFunctionActionContribution = { export type OrganizationFunctionActionContribution = {
id: string; id: string;
label?: string; label: string;
icon: ReactNode;
order?: number; order?: number;
anyOf?: string[]; anyOf?: string[];
allOf?: string[]; allOf?: string[];
render: (context: OrganizationFunctionActionContext) => ReactNode; onClick: (context: OrganizationFunctionActionContext) => void;
}; };
export type OrganizationFunctionActionsUiCapability = { export type OrganizationFunctionActionsUiCapability = {

View File

@@ -1,4 +1,8 @@
import type { PlatformWebModule } from "../src/types"; import type {
OrganizationFunctionActionContext,
OrganizationFunctionActionContribution,
PlatformWebModule
} from "../src/types";
import { import {
hasUiCapability, hasUiCapability,
moduleInstalled, moduleInstalled,
@@ -67,3 +71,28 @@ assert(routes.join(",") === "/campaigns,/files,/mail", "routes should aggregate
assert(scopeGrants("tenant:*", "calendar:event:read"), "tenant wildcard should grant tenant-level module scopes"); assert(scopeGrants("tenant:*", "calendar:event:read"), "tenant wildcard should grant tenant-level module scopes");
assert(!scopeGrants("tenant:*", "system:settings:read"), "tenant wildcard should not grant system scopes"); assert(!scopeGrants("tenant:*", "system:settings:read"), "tenant wildcard should not grant system scopes");
let selectedFunctionId = "";
const functionAction: OrganizationFunctionActionContribution = {
id: "test.view-assignments",
label: "View assignments",
icon: "assignments-icon",
order: 40,
anyOf: ["idm:organization_assignment:read"],
onClick: (context) => {
selectedFunctionId = context.function.id;
}
};
functionAction.onClick({
settings: { apiBaseUrl: "", apiKey: "", accessToken: "" },
auth: {} as OrganizationFunctionActionContext["auth"],
function: {
id: "function-1",
tenant_id: "tenant-1",
organization_unit_id: "unit-1",
slug: "test-function",
name: "Test function"
}
});
assert(selectedFunctionId === "function-1", "organization function actions receive their row context");
assert(!("render" in functionAction), "organization function actions expose metadata instead of arbitrary rendered controls");