Scanner Verwaltung für Geräte-Agenten ergänzen

This commit is contained in:
2026-06-02 15:25:00 +02:00
parent a26ff30cd8
commit c854b0bf30
6 changed files with 491 additions and 4 deletions

View File

@@ -83,11 +83,39 @@ export type SystemStatus = {
}>
}
export type InstanceAgent = {
id: string
createdAt: string
updatedAt: string
name: string
description?: string | null
tokenPrefix: string
active: boolean
capabilities: Record<string, any>
scannerNames: string[]
printerNames: string[]
preferredScannerName?: string | null
scanDefaults: {
format?: string
resolution?: number
mode?: string
source?: string | null
[key: string]: any
}
lastSeenAt?: string | null
lastDebugInfo?: Record<string, any> | null
}
export type CreateInstanceAgentResult = {
agent: InstanceAgent
token: string
}
export const useAdmin = () => {
const { $api } = useNuxtApp()
const getOverview = async (): Promise<AdminOverview> => {
const response = await $api("/api/admin/overview")
const response = await $api("/api/admin/overview") as any
return {
users: response?.users || [],
@@ -162,9 +190,31 @@ export const useAdmin = () => {
return await $api("/api/admin/system-status")
}
const getInstanceAgents = async (): Promise<{ agents: InstanceAgent[] }> => {
const response = await $api("/api/instance-agents") as any
return { agents: response?.agents || [] }
}
const createInstanceAgent = async (body: Record<string, any>): Promise<CreateInstanceAgentResult> => {
return await $api("/api/instance-agents", {
method: "POST",
body,
})
}
const updateInstanceAgent = async (id: string, body: Record<string, any>): Promise<{ agent: InstanceAgent }> => {
return await $api(`/api/instance-agents/${id}`, {
method: "PATCH",
body,
})
}
return {
getOverview,
getSystemStatus,
getInstanceAgents,
createInstanceAgent,
updateInstanceAgent,
createUser,
createUserForProfile,
updateUser,