feat(web): W3-1 login, session shell, home dashboard, settings, engine panel and audit pages
- /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]>
This commit is contained in:
1 parent
ef73abe3df
commit
0dec0854df
21 files changed
+3905
-57
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { ApiKey, ApiKeyCreate, ApiKeyCreated, ApiKeyUpdate, CursorPage } from "@umt/contracts";
|
||||
import { apiData } from "~/lib/api.ts";
|
||||
import { qk } from "~/lib/query-keys.ts";
|
||||
|
||||
export function useApiKeys() {
|
||||
return useQuery({
|
||||
queryKey: qk.list("api-keys"),
|
||||
queryFn: ({ signal }) => apiData<CursorPage<ApiKey>>("/api-keys", { params: { limit: 200 }, signal }),
|
||||
});
|
||||
}
|
||||
|
||||
/** 创建:明文只在返回值里出现一次 */
|
||||
export function useCreateApiKey() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (body: ApiKeyCreate) => apiData<ApiKeyCreated>("/api-keys", { method: "POST", body }),
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: qk.all("api-keys") }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateApiKey() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: ({ id, body }: { id: string; body: ApiKeyUpdate }) =>
|
||||
apiData<ApiKey>("/api-keys/{id}", { method: "PATCH", pathParams: { id }, body }),
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: qk.all("api-keys") }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useRevokeApiKey() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => apiData<unknown>("/api-keys/{id}", { method: "DELETE", pathParams: { id } }),
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: qk.all("api-keys") }),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user