fix: typer exit codes, JWT 7d expiry, shared test fixtures, AdminTab query, mantine 9.6.3
This commit is contained in:
parent
03af41e837
commit
696db34c90
16 changed files with 210 additions and 251 deletions
24
frontend/package-lock.json
generated
24
frontend/package-lock.json
generated
|
|
@ -8,11 +8,11 @@
|
|||
"name": "kirche-einfach-frontend",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@mantine/core": "^9.6.1",
|
||||
"@mantine/dates": "^9.6.1",
|
||||
"@mantine/form": "^9.6.1",
|
||||
"@mantine/hooks": "^9.6.1",
|
||||
"@mantine/notifications": "^9.6.1",
|
||||
"@mantine/core": "^9.6.3",
|
||||
"@mantine/dates": "^9.6.3",
|
||||
"@mantine/form": "^9.6.3",
|
||||
"@mantine/hooks": "^9.6.3",
|
||||
"@mantine/notifications": "^9.6.3",
|
||||
"@rjsf/core": "^6.10.0",
|
||||
"@rjsf/mantine": "^6.10.0",
|
||||
"@rjsf/utils": "^6.10.0",
|
||||
|
|
@ -1373,9 +1373,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@mantine/core": {
|
||||
"version": "9.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@mantine/core/-/core-9.6.1.tgz",
|
||||
"integrity": "sha512-UkcPo8Zq0uSdodvyXV62HVmfIfHCcrjFrFrH0TggTy6Wtp8a78znGP8RJOz8zC9XSPpJmKjBQjg0M+nOvIzftA==",
|
||||
"version": "9.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@mantine/core/-/core-9.6.3.tgz",
|
||||
"integrity": "sha512-o9xzpkma6RiLbENNU4VoxKnCU4VaFlB6Yh6wAjAUiU329ypPV6tBY7VkVeQQ5Z+e12D3I+NTPrUw43onlYCqTg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@floating-ui/react": "^0.27.20",
|
||||
|
|
@ -1385,7 +1385,7 @@
|
|||
"type-fest": "^5.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@mantine/hooks": "9.6.1",
|
||||
"@mantine/hooks": "9.6.3",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0"
|
||||
}
|
||||
|
|
@ -1421,9 +1421,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@mantine/hooks": {
|
||||
"version": "9.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-9.6.1.tgz",
|
||||
"integrity": "sha512-pfxM95WozngB0ZALw6h99QV1TQ0qniOkFhzi0+dmSnKpxkVSR0xeNsvPpGDj9Teu+M69fRoE4IkzyMnu5Xld3w==",
|
||||
"version": "9.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-9.6.3.tgz",
|
||||
"integrity": "sha512-b3uJx1p5vlXOmLEgp4OqzC3FUxSIc5bmqPPxPLHsgR6S0aBiqn9psaihJP7u/v//mr3qeCmyMeIwSw9ROu4pXg==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"react": "^19.2.0"
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@
|
|||
"icons": "node scripts/icons.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mantine/core": "^9.6.1",
|
||||
"@mantine/dates": "^9.6.1",
|
||||
"@mantine/form": "^9.6.1",
|
||||
"@mantine/hooks": "^9.6.1",
|
||||
"@mantine/notifications": "^9.6.1",
|
||||
"@mantine/core": "^9.6.3",
|
||||
"@mantine/dates": "^9.6.3",
|
||||
"@mantine/form": "^9.6.3",
|
||||
"@mantine/hooks": "^9.6.3",
|
||||
"@mantine/notifications": "^9.6.3",
|
||||
"@rjsf/core": "^6.10.0",
|
||||
"@rjsf/mantine": "^6.10.0",
|
||||
"@rjsf/utils": "^6.10.0",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
IconRefresh,
|
||||
IconUpload,
|
||||
} from "@tabler/icons-react";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
LANGFLOW_URL,
|
||||
|
|
@ -33,9 +34,17 @@ const importSchema = z.object({
|
|||
importName: z.string(),
|
||||
});
|
||||
|
||||
async function fetchVersions(
|
||||
flows: FlowDefinition[],
|
||||
): Promise<Record<string, FlowVersion[]>> {
|
||||
const entries = await Promise.all(
|
||||
flows.map(async (f) => [f.id, await api.listVersions(f.id)] as const),
|
||||
);
|
||||
return Object.fromEntries(entries);
|
||||
}
|
||||
|
||||
export default function AdminTab() {
|
||||
const [flows, setFlows] = useState<FlowDefinition[]>([]);
|
||||
const [versions, setVersions] = useState<Record<string, FlowVersion[]>>({});
|
||||
const queryClient = useQueryClient();
|
||||
const importForm = useForm({
|
||||
initialValues: { langflowId: "", importName: "" },
|
||||
validate: (values) => {
|
||||
|
|
@ -53,32 +62,25 @@ export default function AdminTab() {
|
|||
notifications.show({ message, color: "green" });
|
||||
}
|
||||
|
||||
const flowsQuery = useQuery({
|
||||
queryKey: ["flows"],
|
||||
queryFn: api.listFlows,
|
||||
});
|
||||
const flows = flowsQuery.data ?? [];
|
||||
const versionsQuery = useQuery({
|
||||
queryKey: ["versions", flows.map((f) => f.id)],
|
||||
queryFn: () => fetchVersions(flows),
|
||||
enabled: flows.length > 0,
|
||||
});
|
||||
const versions = versionsQuery.data ?? {};
|
||||
useEffect(() => {
|
||||
void (async () => {
|
||||
try {
|
||||
const list = await api.listFlows();
|
||||
setFlows(list);
|
||||
const entries = await Promise.all(
|
||||
list.map(async (f) => [f.id, await api.listVersions(f.id)] as const),
|
||||
);
|
||||
setVersions(Object.fromEntries(entries));
|
||||
} catch (e) {
|
||||
setError(formatApiError(e));
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
const e = flowsQuery.error ?? versionsQuery.error;
|
||||
if (e) setError(formatApiError(e));
|
||||
}, [flowsQuery.error, versionsQuery.error]);
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
const list = await api.listFlows();
|
||||
setFlows(list);
|
||||
const entries = await Promise.all(
|
||||
list.map(async (f) => [f.id, await api.listVersions(f.id)] as const),
|
||||
);
|
||||
setVersions(Object.fromEntries(entries));
|
||||
} catch (e) {
|
||||
setError(formatApiError(e));
|
||||
}
|
||||
async function reload() {
|
||||
await queryClient.invalidateQueries({ queryKey: ["flows"] });
|
||||
await queryClient.invalidateQueries({ queryKey: ["versions"] });
|
||||
}
|
||||
|
||||
async function onImport() {
|
||||
|
|
@ -95,7 +97,7 @@ export default function AdminTab() {
|
|||
`Importiert: ${result.definition.name} (Version ${result.version.version_no})`,
|
||||
);
|
||||
importForm.reset();
|
||||
await load();
|
||||
await reload();
|
||||
} catch (e) {
|
||||
setError(formatApiError(e));
|
||||
}
|
||||
|
|
@ -106,7 +108,7 @@ export default function AdminTab() {
|
|||
try {
|
||||
const version = await api.deployVersion(flowId, versionNo);
|
||||
notifyInfo(`Deployed: Version ${version.version_no} (${version.lfx_flow_id})`);
|
||||
await load();
|
||||
await reload();
|
||||
} catch (e) {
|
||||
setError(formatApiError(e));
|
||||
}
|
||||
|
|
@ -126,7 +128,7 @@ export default function AdminTab() {
|
|||
.map(([f, e]) => `${f}: ${e}`)
|
||||
.join("; ");
|
||||
notifyInfo(`Sync ${parts}${errs ? ` — Fehler: ${errs}` : ""}`);
|
||||
await load();
|
||||
await reload();
|
||||
} catch (e) {
|
||||
setError(formatApiError(e));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue