astrbot_plugin_imagestudio/frontend/standalone-web/src/App.vue

995 行
29 KiB
Vue

2026-07-05 09:24:00 +08:00
<script setup lang="ts">
import { computed, onMounted, ref } from "vue"
import { endpoints } from "../../shared/api/endpoints"
import { getJson, postJson } from "../../shared/api/client"
2026-07-05 09:24:00 +08:00
import type { UiBootstrap } from "../../shared/types/bootstrap"
import type { DashboardSummary } from "../../shared/types/dashboard"
import type { ApiDialect, CapabilityProfile } from "../../shared/types/discovery"
2026-07-05 09:24:00 +08:00
import type { JobListResult } from "../../shared/types/job"
import type { LogBundle } from "../../shared/types/logs"
import type { MaterialCategory, MaterialListResult } from "../../shared/types/material"
2026-07-05 09:24:00 +08:00
import type { ProfileListResult } from "../../shared/types/profile"
import type {
CurrentSettings,
ExportSettingsResult,
ReloadSettingsResult,
SettingsSchema,
} from "../../shared/types/settings"
import type { MediaSignResult, StorageStatus } from "../../shared/types/storage"
import type { WardrobeItem, WardrobeMatchResult } from "../../shared/types/wardrobe"
2026-07-05 09:24:00 +08:00
type ViewKey = "dashboard" | "profiles" | "materials" | "wardrobe" | "jobs" | "discovery" | "logs" | "settings"
2026-07-05 09:24:00 +08:00
const text = {
waiting: "\u7b49\u5f85\u64cd\u4f5c",
loading: "\u52a0\u8f7d\u4e2d...",
loadFailed: "\u52a0\u8f7d\u5931\u8d25",
refresh: "\u5237\u65b0",
complete: "\u5b8c\u6210",
failed: "\u5931\u8d25",
noProfile: "\u672a\u9009\u62e9\u89d2\u8272",
noTags: "\u65e0\u6807\u7b7e",
noImage: "\u672a\u7ed1\u5b9a\u56fe\u7247",
dashboard: "\u8fd0\u884c\u6982\u89c8",
profiles: "\u89d2\u8272",
materials: "\u7d20\u6750\u5e93",
wardrobe: "\u89d2\u8272\u8863\u6a71",
jobs: "\u4efb\u52a1\u961f\u5217",
discovery: "\u80fd\u529b\u63a2\u6d4b",
logs: "\u65e5\u5fd7\u5ba1\u8ba1",
settings: "\u8bbe\u7f6e",
profileList: "\u89d2\u8272\u5217\u8868",
emptyProfiles: "\u6682\u65e0\u89d2\u8272",
categories: "\u7d20\u6750\u5206\u7c7b",
materialItems: "\u7d20\u6750\u6761\u76ee",
emptyCategories: "\u6682\u65e0\u5206\u7c7b",
emptyMaterials: "\u6682\u65e0\u7d20\u6750",
pendingConfirm: "\u5f85\u786e\u8ba4",
signFirstImage: "\u7b7e\u540d\u9996\u56fe",
noSignableMaterial: "\u6ca1\u6709\u53ef\u7b7e\u540d\u7684\u7d20\u6750\u56fe\u7247",
signMaterial: "\u7b7e\u540d\u7d20\u6750",
match: "\u5339\u914d",
matchWardrobe: "\u8863\u6a71\u5339\u914d",
emptyWardrobe: "\u6682\u65e0\u8863\u6a71\u6761\u76ee",
moveFailed: "\u5931\u8d25\u8f6c\u6b7b\u4fe1",
retryDead: "\u91cd\u8bd5\u6b7b\u4fe1",
retry: "\u91cd\u8bd5",
cancel: "\u53d6\u6d88",
emptyJobs: "\u6682\u65e0\u4efb\u52a1",
dialects: "\u534f\u8bae\u65b9\u8a00",
safeProbe: "\u5b89\u5168\u63a2\u6d4b",
capabilityProfiles: "\u80fd\u529b\u6863\u6848",
support: "\u652f\u6301",
unsupported: "\u4e0d\u652f\u6301",
unconfirmed: "\u5f85\u786e\u8ba4",
emptyCapabilities: "\u6682\u65e0\u80fd\u529b\u6863\u6848",
generationLogs: "\u751f\u6210\u65e5\u5fd7",
errorLogs: "\u9519\u8bef",
workflowLogs: "\u5de5\u4f5c\u6d41",
integrationLogs: "\u96c6\u6210",
auditLogs: "\u5ba1\u8ba1",
emptyGenerationLogs: "\u6682\u65e0\u751f\u6210\u65e5\u5fd7",
emptyErrors: "\u6682\u65e0\u9519\u8bef",
emptyWorkflowLogs: "\u6682\u65e0\u5de5\u4f5c\u6d41\u65e5\u5fd7",
emptyIntegrationLogs: "\u6682\u65e0\u96c6\u6210\u65e5\u5fd7",
emptyAuditLogs: "\u6682\u65e0\u5ba1\u8ba1\u65e5\u5fd7",
noErrorDetail: "\u65e0\u9519\u8bef\u8be6\u60c5",
reload: "\u91cd\u8f7d",
exportRedacted: "\u5bfc\u51fa\u8131\u654f\u914d\u7f6e",
exportSettings: "\u5bfc\u51fa\u8bbe\u7f6e",
exportDone: "\u5bfc\u51fa\u8bbe\u7f6e\u5b8c\u6210\uff0c\u914d\u7f6e\u5df2\u8131\u654f",
storage: "\u5b58\u50a8",
running: "\u8fd0\u884c",
} as const
const navItems: Array<{ key: ViewKey; label: string }> = [
{ key: "dashboard", label: "\u6982\u89c8" },
{ key: "profiles", label: text.profiles },
{ key: "materials", label: "\u7d20\u6750" },
{ key: "wardrobe", label: "\u8863\u6a71" },
{ key: "jobs", label: "\u961f\u5217" },
{ key: "discovery", label: "\u63a2\u6d4b" },
{ key: "logs", label: "\u65e5\u5fd7" },
{ key: "settings", label: text.settings },
]
2026-07-05 09:24:00 +08:00
const activeView = ref<ViewKey>("dashboard")
const bootstrap = ref<UiBootstrap | null>(null)
const dashboard = ref<DashboardSummary | null>(null)
const profiles = ref<ProfileListResult | null>(null)
const jobs = ref<JobListResult | null>(null)
const settingsSchema = ref<SettingsSchema | null>(null)
const currentSettings = ref<CurrentSettings | null>(null)
const storage = ref<StorageStatus | null>(null)
const materialCategories = ref<MaterialCategory[]>([])
const materials = ref<MaterialListResult | null>(null)
const wardrobe = ref<WardrobeItem[]>([])
const dialects = ref<ApiDialect[]>([])
const capabilities = ref<CapabilityProfile[]>([])
const wardrobeMatch = ref<WardrobeMatchResult | null>(null)
const logs = ref<LogBundle>({ generation: [], workflows: [], errors: [], integrations: [], audit: [] })
const signedMedia = ref<MediaSignResult | null>(null)
const lastOperation = ref("")
2026-07-05 09:24:00 +08:00
const loading = ref(true)
const busy = ref("")
2026-07-05 09:24:00 +08:00
const error = ref("")
const selectedProfileId = computed(() => profiles.value?.items[0]?.profile_id ?? "")
const selectedProfileName = computed(() => profiles.value?.items[0]?.name ?? text.noProfile)
2026-07-05 09:24:00 +08:00
const queueTotal = computed(() => {
const queue = dashboard.value?.queue
return queue ? queue.pending + queue.running + queue.failed + queue.dead_letter : 0
})
const pendingRecognition = computed(
() => materials.value?.items.filter((item) => item.recognition_status !== "confirmed").length ?? 0,
)
const activeTitle = computed(() => {
const titles: Record<ViewKey, string> = {
dashboard: text.dashboard,
profiles: text.profiles,
materials: text.materials,
wardrobe: text.wardrobe,
jobs: text.jobs,
discovery: text.discovery,
logs: text.logs,
settings: text.settings,
}
return titles[activeView.value]
})
2026-07-05 09:24:00 +08:00
onMounted(load)
async function load() {
loading.value = true
error.value = ""
try {
const [
bootstrapData,
dashboardData,
profileData,
jobData,
schemaData,
settingsData,
storageData,
categoryData,
materialData,
dialectData,
capabilityData,
] = await Promise.all([
getJson<UiBootstrap>(endpoints.uiBootstrap),
getJson<DashboardSummary>(endpoints.dashboardSummary),
getJson<ProfileListResult>(endpoints.profiles, { page: 1, page_size: 20 }),
getJson<JobListResult>(endpoints.jobs, { page: 1, page_size: 20 }),
getJson<SettingsSchema>(endpoints.settingsSchema),
getJson<CurrentSettings>(endpoints.settingsCurrent),
getJson<StorageStatus>(endpoints.storageStatus),
getJson<MaterialCategory[]>(endpoints.materialCategories),
getJson<MaterialListResult>(endpoints.materials, { page: 1, page_size: 24 }),
getJson<ApiDialect[]>(endpoints.apiDiscoveryDialects),
getJson<CapabilityProfile[]>(endpoints.apiDiscoveryCapabilities),
])
2026-07-05 09:24:00 +08:00
bootstrap.value = bootstrapData
dashboard.value = dashboardData
profiles.value = profileData
jobs.value = jobData
settingsSchema.value = schemaData
currentSettings.value = settingsData
storage.value = storageData
materialCategories.value = categoryData
materials.value = materialData
dialects.value = dialectData
capabilities.value = capabilityData
await loadWardrobe(profileData.items[0]?.profile_id)
await loadLogs()
2026-07-05 09:24:00 +08:00
} catch (err) {
error.value = err instanceof Error ? err.message : text.loadFailed
2026-07-05 09:24:00 +08:00
} finally {
loading.value = false
}
}
async function loadLogs() {
const [generation, workflows, errors, integrations, audit] = await Promise.allSettled([
getJson<LogBundle["generation"]>(endpoints.generationLogs, { limit: 12 }),
getJson<LogBundle["workflows"]>(endpoints.workflowLogs, { limit: 12 }),
getJson<LogBundle["errors"]>(endpoints.errorLogs, { limit: 12 }),
getJson<LogBundle["integrations"]>(endpoints.integrationLogs, { limit: 12 }),
getJson<LogBundle["audit"]>(endpoints.auditLogs, { limit: 12 }),
])
logs.value = {
generation: settledValue(generation),
workflows: settledValue(workflows),
errors: settledValue(errors),
integrations: settledValue(integrations),
audit: settledValue(audit),
}
}
function settledValue<T>(result: PromiseSettledResult<T[]>): T[] {
return result.status === "fulfilled" ? result.value : []
}
async function loadWardrobe(profileId?: string) {
if (!profileId) {
wardrobe.value = []
return
}
wardrobe.value = await getJson<WardrobeItem[]>(endpoints.wardrobe(profileId))
}
async function runOperation(label: string, action: () => Promise<unknown>, refresh = true) {
busy.value = label
error.value = ""
try {
const result = await action()
lastOperation.value = `${label}${text.complete}`
if (label === text.exportSettings) {
lastOperation.value = `${text.exportDone}: ${Boolean((result as ExportSettingsResult).redacted)}`
}
if (refresh) {
await load()
}
} catch (err) {
error.value = err instanceof Error ? err.message : `${label}${text.failed}`
} finally {
busy.value = ""
}
}
function retryJob(taskId: string) {
return runOperation(text.retry, () => postJson(endpoints.jobRetry(taskId)))
}
function cancelJob(taskId: string) {
return runOperation(text.cancel, () => postJson(endpoints.jobCancel(taskId)))
}
function moveFailedJobs() {
return runOperation(text.moveFailed, () => postJson(endpoints.jobDeadLetterMoveFailed, { limit: 20 }))
}
function retryDeadLetters() {
return runOperation(text.retryDead, () => postJson(endpoints.jobDeadLetterRetry, { limit: 20 }))
}
function safeProbeModel() {
const dialect = dialects.value[0]?.dialect ?? "unknown"
return runOperation(text.safeProbe, () =>
postJson<CapabilityProfile>(endpoints.apiDiscoveryProbeModel, {
provider_id: "local-preview",
model_id: "metadata-only",
dialect,
capabilities: { supports: ["text_to_image"] },
}),
)
}
2026-07-05 11:22:03 +08:00
function setCapabilityStatus(profile: CapabilityProfile, status: CapabilityProfile["status"]) {
return runOperation(text.discovery, () =>
2026-07-05 11:22:03 +08:00
postJson<CapabilityProfile>(endpoints.apiDiscoveryManualOverride, {
provider_id: profile.provider_id,
model_id: profile.model_id,
dialect: profile.dialect,
status,
capabilities: profile.capabilities,
}),
)
}
function matchWardrobe() {
const profileId = selectedProfileId.value
if (!profileId) return Promise.resolve()
return runOperation(
text.matchWardrobe,
async () => {
wardrobeMatch.value = await postJson<WardrobeMatchResult>(endpoints.wardrobeMatch(profileId), {
tags: ["daily"],
})
return wardrobeMatch.value
},
false,
)
}
function reloadSettings() {
return runOperation(
text.reload,
async () => {
const result = await postJson<ReloadSettingsResult>(endpoints.settingsReload)
currentSettings.value = { config_path: currentSettings.value?.config_path ?? "***PATH***", config: result.config }
return result
},
false,
)
}
function exportSettings() {
return runOperation(text.exportSettings, () => getJson<ExportSettingsResult>(endpoints.settingsExport), false)
}
function signFirstMaterial() {
const uri = materials.value?.items.find((item) => item.image_uri?.startsWith("storage://"))?.image_uri
if (!uri) {
lastOperation.value = text.noSignableMaterial
return Promise.resolve()
}
return runOperation(
text.signMaterial,
async () => {
signedMedia.value = await getJson<MediaSignResult>(endpoints.mediaSign, { uri })
return signedMedia.value
},
false,
)
}
2026-07-05 09:24:00 +08:00
function formatBytes(value = 0) {
if (value < 1024) return `${value} B`
if (value < 1024 * 1024) return `${(value / 1024).toFixed(1)} KB`
if (value < 1024 * 1024 * 1024) return `${(value / 1024 / 1024).toFixed(1)} MB`
return `${(value / 1024 / 1024 / 1024).toFixed(1)} GB`
}
function storageRootBytes(uriPrefix: string) {
return storage.value?.roots.find((root) => root.uri_prefix === uriPrefix)?.bytes ?? 0
}
2026-07-05 09:24:00 +08:00
</script>
2026-07-04 22:51:52 +08:00
<template>
<main class="web-shell">
<aside class="sidebar">
2026-07-05 09:24:00 +08:00
<div class="brand">
<strong>{{ bootstrap?.display_name ?? "ImageStudio" }}</strong>
<span>{{ bootstrap?.dashboard_user ?? "AstrBot" }}</span>
</div>
<nav>
<button
v-for="item in navItems"
:key="item.key"
type="button"
:class="{ active: activeView === item.key }"
@click="activeView = item.key"
>
{{ item.label }}
2026-07-05 09:24:00 +08:00
</button>
</nav>
2026-07-04 22:51:52 +08:00
</aside>
2026-07-05 09:24:00 +08:00
2026-07-04 22:51:52 +08:00
<section class="workspace">
2026-07-05 09:24:00 +08:00
<header class="topbar">
<div>
<h1>{{ activeTitle }}</h1>
<p>{{ dashboard?.plugin_status ?? "loading" }} / {{ lastOperation || text.waiting }}</p>
</div>
<div class="actions">
<button type="button" :disabled="Boolean(busy)" @click="load">
{{ busy || text.refresh }}
</button>
2026-07-05 09:24:00 +08:00
</div>
</header>
<section v-if="error" class="notice error">{{ error }}</section>
<section v-else-if="loading" class="notice">{{ text.loading }}</section>
2026-07-05 09:24:00 +08:00
<template v-else>
<section v-if="activeView === 'dashboard'" class="dashboard-grid">
<article>
<span>{{ text.profiles }}</span>
2026-07-05 09:24:00 +08:00
<strong>{{ dashboard?.active_profiles ?? 0 }}</strong>
</article>
<article>
<span>{{ text.jobs }}</span>
2026-07-05 09:24:00 +08:00
<strong>{{ queueTotal }}</strong>
</article>
<article>
<span>{{ text.materials }}</span>
<strong>{{ materials?.total ?? 0 }}</strong>
2026-07-05 09:24:00 +08:00
</article>
<article>
<span>{{ text.storage }}</span>
<strong>{{ formatBytes(storage?.total_bytes ?? dashboard?.storage.total_bytes) }}</strong>
2026-07-05 09:24:00 +08:00
</article>
</section>
<section v-if="activeView === 'profiles'" class="list-view">
<header>
<h2>{{ text.profileList }}</h2>
2026-07-05 09:24:00 +08:00
<span>{{ profiles?.total ?? 0 }}</span>
</header>
<ul>
<li v-for="profile in profiles?.items ?? []" :key="profile.profile_id">
<div>
<strong>{{ profile.name }}</strong>
<small>{{ profile.profile_id }}</small>
</div>
<span class="badge">{{ profile.status }}</span>
2026-07-05 09:24:00 +08:00
</li>
<li v-if="!profiles?.items.length" class="empty">{{ text.emptyProfiles }}</li>
2026-07-05 09:24:00 +08:00
</ul>
</section>
<section v-if="activeView === 'materials'" class="split-view">
<div class="list-view">
<header>
<h2>{{ text.categories }}</h2>
<span>{{ materialCategories.length }}</span>
</header>
<ul>
<li v-for="category in materialCategories" :key="category.category_id">
<div>
<strong>{{ category.name }}</strong>
<small>{{ category.category_type }}</small>
</div>
<span>{{ category.sort_order }}</span>
</li>
<li v-if="!materialCategories.length" class="empty">{{ text.emptyCategories }}</li>
</ul>
</div>
<div class="list-view">
<header>
<h2>{{ text.materialItems }}</h2>
<div class="inline-actions">
<span>{{ pendingRecognition }} {{ text.pendingConfirm }}</span>
<button type="button" :disabled="Boolean(busy)" @click="signFirstMaterial">
{{ text.signFirstImage }}
</button>
</div>
</header>
<ul>
<li v-for="material in materials?.items ?? []" :key="material.material_id">
<div>
<strong>{{ material.display_name }}</strong>
<small>{{ material.image_uri ?? text.noImage }}</small>
</div>
<span class="badge">{{ material.recognition_status }}</span>
</li>
<li v-if="!materials?.items.length" class="empty">{{ text.emptyMaterials }}</li>
</ul>
<pre v-if="signedMedia">{{ JSON.stringify(signedMedia, null, 2) }}</pre>
</div>
</section>
<section v-if="activeView === 'wardrobe'" class="list-view">
<header>
<h2>{{ selectedProfileName }}</h2>
<button type="button" :disabled="!selectedProfileId || Boolean(busy)" @click="matchWardrobe">
{{ text.match }}
</button>
</header>
<ul>
<li v-for="item in wardrobe" :key="item.wardrobe_item_id">
<div>
<strong>{{ item.wardrobe_category }}</strong>
<small>{{ item.material_id }} / {{ item.tags.join(", ") || text.noTags }}</small>
</div>
<span>{{ item.usage_count }}</span>
</li>
<li v-if="!wardrobe.length" class="empty">{{ text.emptyWardrobe }}</li>
</ul>
<pre v-if="wardrobeMatch">{{ JSON.stringify(wardrobeMatch, null, 2) }}</pre>
</section>
2026-07-05 09:24:00 +08:00
<section v-if="activeView === 'jobs'" class="list-view">
<header>
<h2>{{ text.jobs }}</h2>
<div class="inline-actions">
<button type="button" :disabled="Boolean(busy)" @click="moveFailedJobs">{{ text.moveFailed }}</button>
<button type="button" :disabled="Boolean(busy)" @click="retryDeadLetters">{{ text.retryDead }}</button>
</div>
2026-07-05 09:24:00 +08:00
</header>
<ul>
<li v-for="job in jobs?.items ?? []" :key="job.task_id">
<div>
<strong>{{ job.task_id }}</strong>
<small>{{ job.task_type }} / {{ job.progress }}%</small>
</div>
<div class="inline-actions">
<span class="badge">{{ job.status }}</span>
<button v-if="job.status === 'failed'" type="button" @click="retryJob(job.task_id)">
{{ text.retry }}
</button>
<button v-if="job.status === 'pending'" type="button" @click="cancelJob(job.task_id)">
{{ text.cancel }}
</button>
</div>
2026-07-05 09:24:00 +08:00
</li>
<li v-if="!jobs?.items.length" class="empty">{{ text.emptyJobs }}</li>
2026-07-05 09:24:00 +08:00
</ul>
</section>
<section v-if="activeView === 'discovery'" class="split-view">
<div class="list-view">
<header>
<h2>{{ text.dialects }}</h2>
<button type="button" :disabled="Boolean(busy)" @click="safeProbeModel">{{ text.safeProbe }}</button>
</header>
<ul>
<li v-for="dialect in dialects" :key="dialect.dialect">
<div>
<strong>{{ dialect.label }}</strong>
<small>{{ dialect.capabilities.join(", ") || text.unconfirmed }}</small>
</div>
<span>{{ dialect.dialect }}</span>
</li>
</ul>
</div>
<div class="list-view">
<header>
<h2>{{ text.capabilityProfiles }}</h2>
<span>{{ capabilities.length }}</span>
</header>
<ul>
<li v-for="profile in capabilities" :key="profile.capability_profile_id">
<div>
<strong>{{ profile.provider_id }} / {{ profile.model_id }}</strong>
<small>{{ profile.dialect }}</small>
</div>
2026-07-05 11:22:03 +08:00
<div class="inline-actions">
<span class="badge">{{ profile.status }}</span>
<button type="button" :disabled="Boolean(busy)" @click="setCapabilityStatus(profile, 'confirmed_supported')">
{{ text.support }}
</button>
<button type="button" :disabled="Boolean(busy)" @click="setCapabilityStatus(profile, 'confirmed_unsupported')">
{{ text.unsupported }}
2026-07-05 11:22:03 +08:00
</button>
<button type="button" :disabled="Boolean(busy)" @click="setCapabilityStatus(profile, 'unconfirmed')">
{{ text.unconfirmed }}
2026-07-05 11:22:03 +08:00
</button>
</div>
</li>
<li v-if="!capabilities.length" class="empty">{{ text.emptyCapabilities }}</li>
</ul>
</div>
</section>
<section v-if="activeView === 'logs'" class="logs-view">
<div class="split-view">
<div class="list-view">
<header>
<h2>{{ text.generationLogs }}</h2>
<span>{{ logs.generation.length }}</span>
</header>
<ul>
<li v-for="item in logs.generation" :key="item.task_id">
<div>
<strong>{{ item.task_id }}</strong>
<small>{{ item.status }} / {{ item.progress }}%</small>
</div>
<span>{{ item.created_at }}</span>
</li>
<li v-if="!logs.generation.length" class="empty">{{ text.emptyGenerationLogs }}</li>
</ul>
</div>
<div class="list-view">
<header>
<h2>{{ text.errorLogs }}</h2>
<span>{{ logs.errors.length }}</span>
</header>
<ul>
<li v-for="item in logs.errors" :key="`${item.source}-${item.id}`">
<div>
<strong>{{ item.source }}</strong>
<small>{{ item.error_message ?? text.noErrorDetail }}</small>
</div>
<span class="badge">{{ item.status }}</span>
</li>
<li v-if="!logs.errors.length" class="empty">{{ text.emptyErrors }}</li>
</ul>
</div>
</div>
<div class="split-view">
<div class="list-view">
<header>
<h2>{{ text.workflowLogs }}</h2>
<span>{{ logs.workflows.length }}</span>
</header>
<ul>
<li v-for="item in logs.workflows" :key="item.history_id">
<div>
<strong>{{ item.action }}</strong>
<small>{{ item.title ?? item.workflow_id }}</small>
</div>
<span>{{ item.branch_name ?? "main" }}</span>
</li>
<li v-if="!logs.workflows.length" class="empty">{{ text.emptyWorkflowLogs }}</li>
</ul>
</div>
<div class="list-view">
<header>
<h2>{{ text.integrationLogs }}</h2>
<span>{{ logs.integrations.length }}</span>
</header>
<ul>
<li v-for="item in logs.integrations" :key="item.integration_log_id">
<div>
<strong>{{ item.integration_name }}</strong>
<small>{{ item.action }}</small>
</div>
<span class="badge">{{ item.status }}</span>
</li>
<li v-if="!logs.integrations.length" class="empty">{{ text.emptyIntegrationLogs }}</li>
</ul>
</div>
</div>
<div class="list-view">
<header>
<h2>{{ text.auditLogs }}</h2>
<span>{{ logs.audit.length }}</span>
</header>
<ul>
<li v-for="item in logs.audit" :key="item.audit_id">
<div>
<strong>{{ item.action }}</strong>
<small>{{ item.actor_type }} / {{ item.target_type }} / {{ item.target_id }}</small>
</div>
<span>{{ item.created_at }}</span>
</li>
<li v-if="!logs.audit.length" class="empty">{{ text.emptyAuditLogs }}</li>
</ul>
</div>
</section>
2026-07-05 09:24:00 +08:00
<section v-if="activeView === 'settings'" class="settings-view">
<div class="toolbar">
<button type="button" :disabled="Boolean(busy)" @click="reloadSettings">{{ text.reload }}</button>
<button type="button" :disabled="Boolean(busy)" @click="exportSettings">{{ text.exportRedacted }}</button>
</div>
2026-07-05 09:24:00 +08:00
<div class="settings-sections">
<article v-for="section in settingsSchema?.sections ?? []" :key="section.key">
<h2>{{ section.title }}</h2>
<span>{{ section.fields.length }}</span>
2026-07-05 09:24:00 +08:00
</article>
</div>
<pre>{{ JSON.stringify(currentSettings?.config ?? {}, null, 2) }}</pre>
</section>
</template>
2026-07-04 22:51:52 +08:00
</section>
2026-07-05 09:24:00 +08:00
<aside class="inspector">
<h2>{{ text.running }}</h2>
2026-07-05 09:24:00 +08:00
<dl>
<div>
<dt>Pending</dt>
<dd>{{ dashboard?.queue.pending ?? 0 }}</dd>
</div>
<div>
<dt>Running</dt>
<dd>{{ dashboard?.queue.running ?? 0 }}</dd>
</div>
<div>
<dt>Failed</dt>
<dd>{{ dashboard?.queue.failed ?? 0 }}</dd>
</div>
<div>
<dt>Dead</dt>
<dd>{{ dashboard?.queue.dead_letter ?? 0 }}</dd>
</div>
</dl>
<h2>{{ text.storage }}</h2>
<dl>
<div>
<dt>Images</dt>
<dd>{{ formatBytes(storageRootBytes("storage://images/")) }}</dd>
</div>
<div>
<dt>Materials</dt>
<dd>{{ formatBytes(storageRootBytes("storage://materials/")) }}</dd>
</div>
2026-07-05 09:24:00 +08:00
</dl>
</aside>
2026-07-04 22:51:52 +08:00
</main>
</template>
<style scoped>
.web-shell {
box-sizing: border-box;
display: grid;
2026-07-05 09:24:00 +08:00
grid-template-columns: 220px minmax(0, 1fr) 260px;
2026-07-04 22:51:52 +08:00
min-height: 100vh;
2026-07-05 09:24:00 +08:00
color: #1b2430;
background: #f5f6f8;
2026-07-04 22:51:52 +08:00
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
2026-07-05 09:24:00 +08:00
.sidebar,
.inspector {
2026-07-04 22:51:52 +08:00
background: #ffffff;
}
2026-07-05 09:24:00 +08:00
.sidebar {
border-right: 1px solid #d9e0e8;
padding: 20px;
}
.inspector {
border-left: 1px solid #d9e0e8;
padding: 20px;
2026-07-04 22:51:52 +08:00
}
2026-07-05 09:24:00 +08:00
.brand {
display: grid;
gap: 4px;
margin-bottom: 24px;
}
.brand strong {
font-size: 19px;
}
.brand span,
p,
dt,
.empty,
small {
2026-07-05 09:24:00 +08:00
color: #667085;
}
nav {
display: grid;
gap: 6px;
}
button {
min-height: 36px;
border: 1px solid #c7d0da;
2026-07-05 09:24:00 +08:00
border-radius: 6px;
color: #1b2430;
background: #ffffff;
2026-07-05 09:24:00 +08:00
font: inherit;
text-align: center;
2026-07-05 09:24:00 +08:00
cursor: pointer;
}
button:disabled {
cursor: wait;
opacity: 0.62;
}
2026-07-05 09:24:00 +08:00
nav button {
border-color: transparent;
background: transparent;
text-align: left;
2026-07-05 09:24:00 +08:00
padding: 0 10px;
}
button.active {
border-color: #b8d8cf;
color: #164f43;
background: #e5f4ef;
2026-07-04 22:51:52 +08:00
}
.workspace {
2026-07-05 09:24:00 +08:00
min-width: 0;
padding: 24px;
2026-07-04 22:51:52 +08:00
}
.topbar,
.list-view header,
.toolbar,
.inline-actions {
2026-07-05 09:24:00 +08:00
display: flex;
gap: 12px;
2026-07-05 09:24:00 +08:00
align-items: center;
2026-07-04 22:51:52 +08:00
}
.topbar,
.list-view header {
justify-content: space-between;
}
.actions,
.inline-actions {
flex-wrap: wrap;
justify-content: flex-end;
}
.topbar button,
.toolbar button,
.list-view header button,
.inline-actions button {
2026-07-05 09:24:00 +08:00
padding: 0 14px;
}
h1,
h2,
p,
dl,
dd {
2026-07-04 22:51:52 +08:00
margin: 0;
}
2026-07-05 09:24:00 +08:00
h1 {
min-height: 30px;
font-size: 26px;
}
h2 {
font-size: 15px;
}
.notice,
article,
.list-view,
pre {
border: 1px solid #d9e0e8;
border-radius: 8px;
background: #ffffff;
}
.notice {
margin-top: 18px;
padding: 14px;
}
.error {
border-color: #f0b4b4;
color: #8a1f1f;
background: #fff7f7;
}
.dashboard-grid,
.split-view {
2026-07-05 09:24:00 +08:00
display: grid;
gap: 12px;
margin-top: 18px;
}
.dashboard-grid {
grid-template-columns: repeat(4, minmax(130px, 1fr));
}
.split-view {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
2026-07-05 09:24:00 +08:00
article {
display: grid;
gap: 8px;
padding: 16px;
}
article span {
color: #667085;
font-size: 13px;
}
article strong {
font-size: 24px;
}
.list-view,
.logs-view,
2026-07-05 09:24:00 +08:00
.settings-view {
margin-top: 18px;
}
.split-view .list-view,
.logs-view .list-view {
margin-top: 0;
2026-07-05 09:24:00 +08:00
}
.list-view {
padding: 16px;
2026-07-05 09:24:00 +08:00
}
ul {
display: grid;
gap: 10px;
margin: 14px 0 0;
padding: 0;
list-style: none;
}
li {
display: flex;
justify-content: space-between;
gap: 12px;
min-width: 0;
padding: 10px 0;
border-top: 1px solid #eef1f5;
}
li:first-child {
border-top: 0;
}
li > div {
display: grid;
gap: 3px;
min-width: 0;
2026-07-05 09:24:00 +08:00
}
li strong,
li span,
li small {
2026-07-05 09:24:00 +08:00
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.badge {
align-self: center;
max-width: 180px;
border-radius: 999px;
padding: 4px 9px;
color: #1f4d62;
background: #e5f1f7;
font-size: 12px;
}
.toolbar {
justify-content: flex-start;
margin: 18px 0 12px;
}
2026-07-05 09:24:00 +08:00
.settings-sections {
display: grid;
grid-template-columns: repeat(3, minmax(120px, 1fr));
gap: 12px;
}
pre {
overflow: auto;
max-height: 420px;
margin: 12px 0 0;
padding: 14px;
font-size: 12px;
line-height: 1.5;
2026-07-05 09:24:00 +08:00
}
dl {
display: grid;
gap: 12px;
margin: 14px 0 24px;
2026-07-05 09:24:00 +08:00
}
dl div {
display: flex;
justify-content: space-between;
}
@media (max-width: 1160px) {
2026-07-05 09:24:00 +08:00
.web-shell {
grid-template-columns: 190px minmax(0, 1fr);
}
.inspector {
display: none;
}
}
@media (max-width: 820px) {
2026-07-04 22:51:52 +08:00
.web-shell {
grid-template-columns: 1fr;
}
.sidebar {
border-right: 0;
2026-07-05 09:24:00 +08:00
border-bottom: 1px solid #d9e0e8;
}
nav {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
nav button {
text-align: center;
}
.dashboard-grid,
.split-view,
2026-07-05 09:24:00 +08:00
.settings-sections {
grid-template-columns: 1fr;
2026-07-04 22:51:52 +08:00
}
.topbar,
.list-view header {
align-items: flex-start;
flex-direction: column;
}
2026-07-04 22:51:52 +08:00
}
</style>