feat: add governed configuration reference selectors
This commit is contained in:
+20
-2
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user