feat: add governed configuration reference selectors

This commit is contained in:
2026-07-29 14:16:28 +02:00
parent 36291a57c1
commit f3e69b97ee
8 changed files with 503 additions and 47 deletions
+20 -2
View File
@@ -1,5 +1,5 @@
import type { ApiSettings, DeltaDeletedItem, PrivacyRetentionPolicy } from "@govoplan/core-webui";
import { apiFetch, apiGetList, apiPath, apiQuery } from "@govoplan/core-webui";
import { apiFetch, apiPath, apiQuery } from "@govoplan/core-webui";
export { fetchAdminOverview, fetchPermissionCatalog, fetchTenants } from "@govoplan/core-webui";
export type {
AdminOverview,
@@ -555,7 +555,25 @@ export function clearModuleInstallPlan(settings: ApiSettings): Promise<ModuleIns
}
export async function fetchGovernanceTemplates(settings: ApiSettings, kind?: "group" | "role"): Promise<GovernanceTemplateItem[]> {
return apiGetList<GovernanceTemplateItem, "templates">(settings, "/api/v1/admin/system/governance-templates", "templates", { kind });
const pageSize = 500;
const templates: GovernanceTemplateItem[] = [];
for (let page = 1; ; page += 1) {
const response = await apiFetch<{
templates: GovernanceTemplateItem[];
pages?: number;
}>(
settings,
apiPath("/api/v1/admin/system/governance-templates", {
kind,
page,
page_size: pageSize
})
);
templates.push(...response.templates);
if (page >= (response.pages ?? 1)) {
return templates;
}
}
}
export function createGovernanceTemplate(settings: ApiSettings, payload: Omit<GovernanceTemplateItem, "id" | "created_at" | "updated_at" | "effective_permission_count"> & { change_request_id?: string | null }): Promise<GovernanceTemplateItem> {