feat: add searchable view assignment targets
This commit is contained in:
@@ -45,6 +45,8 @@ export type ViewAssignment = {
|
||||
tenant_id?: string | null;
|
||||
scope_type: ViewAssignmentScopeType;
|
||||
scope_id?: string | null;
|
||||
scope_label?: string | null;
|
||||
scope_detail?: string | null;
|
||||
definition_id: string;
|
||||
revision_id?: string | null;
|
||||
mode: ViewAssignmentMode;
|
||||
@@ -57,6 +59,21 @@ export type ViewAssignment = {
|
||||
updated_at: string;
|
||||
};
|
||||
|
||||
export type ViewAssignmentTarget = {
|
||||
id: string;
|
||||
scope_type: "group" | "user";
|
||||
label: string;
|
||||
detail?: string | null;
|
||||
disabled: boolean;
|
||||
disabled_reason?: string | null;
|
||||
};
|
||||
|
||||
export type ViewAssignmentTargetList = {
|
||||
directory_available: boolean;
|
||||
targets: ViewAssignmentTarget[];
|
||||
unavailable_reason?: string | null;
|
||||
};
|
||||
|
||||
type EffectiveViewApiResponse = {
|
||||
active_view_id?: string | null;
|
||||
active_revision_id?: string | null;
|
||||
@@ -239,6 +256,24 @@ export async function fetchViewAssignments(
|
||||
return response.assignments;
|
||||
}
|
||||
|
||||
export function fetchViewAssignmentTargets(
|
||||
settings: ApiSettings,
|
||||
scopeType: "group" | "user",
|
||||
query: string,
|
||||
limit: number,
|
||||
signal?: AbortSignal
|
||||
): Promise<ViewAssignmentTargetList> {
|
||||
return apiFetch(
|
||||
settings,
|
||||
apiPath("/api/v1/views/assignment-targets", {
|
||||
scope_type: scopeType,
|
||||
query: query || undefined,
|
||||
limit
|
||||
}),
|
||||
{ signal }
|
||||
);
|
||||
}
|
||||
|
||||
export function createViewAssignment(
|
||||
settings: ApiSettings,
|
||||
payload: {
|
||||
|
||||
Reference in New Issue
Block a user