- /login: setup/login/TOTP states driven by server error codes, fixed-height error slot - console layout: GET /auth/session gate, redirect to /login, account popover (change password, logout) - home: six dashboard sections with SSE-driven refresh, automation switch and read-only reconcile toggle - settings tabs: downloaders, media servers, library roots, path mappings, site credentials, API keys (one-time plaintext), Pi upstream, cache/organize/retention/budget, automation - engine: runs list (status/name filters, cursor paging, stats tiles), run detail (step timeline, json payloads, signals, cancel) - audit: filterable list with detail sheet - vite: allow repo root in server.fs so deno-installed deps under node_modules/.deno load in dev Co-Authored-By: Claude Opus 5.5 <[email protected]>
26 lines
808 B
TypeScript
26 lines
808 B
TypeScript
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
import type { AuditEvent, CursorPage } from "@umt/contracts";
|
|
import { apiData } from "~/lib/api.ts";
|
|
import { qk } from "~/lib/query-keys.ts";
|
|
|
|
export type AuditFilters = {
|
|
actorType?: string;
|
|
action?: string;
|
|
targetType?: string;
|
|
targetId?: string;
|
|
};
|
|
|
|
/** 审计事件(新→旧),游标"加载更多" */
|
|
export function useAuditEvents(filters: AuditFilters) {
|
|
return useInfiniteQuery({
|
|
queryKey: qk.list("audit", filters),
|
|
initialPageParam: undefined as string | undefined,
|
|
queryFn: ({ pageParam, signal }) =>
|
|
apiData<CursorPage<AuditEvent>>("/audit-events", {
|
|
params: { ...filters, cursor: pageParam, limit: 50 },
|
|
signal,
|
|
}),
|
|
getNextPageParam: (last) => last.nextCursor ?? undefined,
|
|
});
|
|
}
|