feat: add log filters and snapshot preview UI

这个提交存在于:
YokiiroBW 2026-07-05 15:33:47 +08:00
父节点 d3393ebd09
当前提交 3a44276fe2
共有 13 个文件被更改,包括 298 次插入 和 49 次删除

查看文件

@ -26,11 +26,22 @@ const text = {
emptyJobs: "\u6682\u65e0\u4efb\u52a1",
permissions: "\u6743\u9650",
features: "\u529f\u80fd",
quickLinks: "\u5feb\u6377\u5165\u53e3",
openJobs: "\u961f\u5217",
openLogs: "\u65e5\u5fd7",
openSettings: "\u8bbe\u7f6e",
openMaterials: "\u7d20\u6750",
enabled: "\u5df2\u5f00\u542f",
disabled: "\u672a\u5f00\u542f",
} as const
const workbenchUrl = computed(() => `${bootstrap.value?.api_base ?? ""}/web`)
const quickLinks = computed(() => [
{ label: text.openJobs, href: workbenchViewUrl("jobs") },
{ label: text.openLogs, href: workbenchViewUrl("logs") },
{ label: text.openSettings, href: workbenchViewUrl("settings") },
{ label: text.openMaterials, href: workbenchViewUrl("materials") },
])
const queueTotal = computed(() => {
const queue = dashboard.value?.queue
return queue ? queue.pending + queue.running + queue.failed + queue.dead_letter : 0
@ -61,6 +72,10 @@ function formatBytes(value = 0) {
if (value < 1024 * 1024 * 1024) return `${(value / 1024 / 1024).toFixed(1)} MB`
return `${(value / 1024 / 1024 / 1024).toFixed(1)} GB`
}
function workbenchViewUrl(view: string) {
return `${workbenchUrl.value}?view=${encodeURIComponent(view)}`
}
</script>
<template>
@ -150,6 +165,15 @@ function formatBytes(value = 0) {
</ul>
</div>
</section>
<section v-if="bootstrap" class="quick-links">
<h2>{{ text.quickLinks }}</h2>
<div>
<a v-for="link in quickLinks" :key="link.href" :href="link.href" target="_blank" rel="noreferrer">
{{ link.label }}
</a>
</div>
</section>
</main>
</template>
@ -282,6 +306,33 @@ article strong {
padding: 16px;
}
.quick-links {
margin-top: 16px;
padding: 16px;
border: 1px solid #d6dde6;
border-radius: 8px;
background: #ffffff;
}
.quick-links > div {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 12px;
}
.quick-links a {
display: inline-flex;
align-items: center;
min-height: 34px;
padding: 0 12px;
border: 1px solid #c7d0da;
border-radius: 6px;
color: #1d2430;
background: #ffffff;
text-decoration: none;
}
ul {
display: grid;
gap: 10px;

查看文件

@ -43,6 +43,7 @@ export const endpoints = {
settingsExport: "settings/export",
settingsImport: "settings/import",
settingsSnapshots: "settings/snapshots",
settingsSnapshot: (snapshotId: string) => `settings/snapshots/${snapshotId}`,
settingsRollback: "settings/rollback",
storageStatus: "storage/status",
mediaSign: "media/sign",

查看文件

@ -167,6 +167,7 @@ const text = {
retry: "\u91cd\u8bd5",
cancel: "\u53d6\u6d88",
filter: "\u7b5b\u9009",
applyFilters: "\u5e94\u7528\u7b5b\u9009",
detail: "\u8be6\u60c5",
jobDetail: "\u4efb\u52a1\u8be6\u60c5",
allStatuses: "\u5168\u90e8\u72b6\u6001",
@ -214,6 +215,8 @@ const text = {
importDraftInvalid: "\u5bfc\u5165 JSON \u683c\u5f0f\u65e0\u6548",
snapshots: "\u914d\u7f6e\u5feb\u7167",
loadSnapshots: "\u52a0\u8f7d\u5feb\u7167",
loadSnapshot: "\u67e5\u770b\u5feb\u7167",
snapshotPreview: "\u5feb\u7167\u9884\u89c8",
rollback: "\u56de\u6eda",
rollbackDone: "\u914d\u7f6e\u5df2\u56de\u6eda",
settingsEditor: "\u914d\u7f6e\u7f16\u8f91",
@ -237,7 +240,8 @@ const navItems: Array<{ key: ViewKey; label: string }> = [
{ key: "settings", label: text.settings },
]
const activeView = ref<ViewKey>("dashboard")
const viewKeys = navItems.map((item) => item.key)
const activeView = ref<ViewKey>(initialView())
const bootstrap = ref<UiBootstrap | null>(null)
const dashboard = ref<DashboardSummary | null>(null)
const profiles = ref<ProfileListResult | null>(null)
@ -266,6 +270,7 @@ const signedMedia = ref<MediaSignResult | null>(null)
const settingsDraft = ref("")
const settingsImportDraft = ref("")
const settingsSnapshots = ref<SettingsSnapshot[]>([])
const settingsSnapshotDetail = ref<SettingsSnapshot | null>(null)
const settingsExportResult = ref<ExportSettingsResult | null>(null)
const settingsValidation = ref<ValidateSettingsResult | null>(null)
const settingsDiff = ref<DiffSettingsResult | null>(null)
@ -319,6 +324,32 @@ const jobFilters = ref({
profile_id: "",
workflow_id: "",
})
const generationLogFilters = ref({
status: "",
profile_id: "",
workflow_id: "",
node_id: "",
})
const workflowLogFilters = ref({
workflow_id: "",
action: "",
node_id: "",
branch_name: "",
})
const errorLogFilters = ref({
source: "",
status: "",
})
const integrationLogFilters = ref({
integration_name: "",
action: "",
status: "",
})
const integrationEventFilters = ref({
integration_name: "",
action: "",
status: "",
})
const auditFilters = ref({
action: "",
target_type: "",
@ -402,6 +433,11 @@ const activeTitle = computed(() => {
onMounted(load)
function initialView(): ViewKey {
const requested = new URLSearchParams(window.location.search).get("view")
return viewKeys.includes(requested as ViewKey) ? (requested as ViewKey) : "dashboard"
}
async function load() {
loading.value = true
error.value = ""
@ -455,11 +491,11 @@ async function load() {
async function loadLogs() {
const [generation, workflows, errors, integrations, integrationEvents, 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["integrations"]>(endpoints.integrationEventLogs),
getJson<LogBundle["generation"]>(endpoints.generationLogs, compactQuery(generationLogFilters.value, 12)),
getJson<LogBundle["workflows"]>(endpoints.workflowLogs, compactQuery(workflowLogFilters.value, 12)),
getJson<LogBundle["errors"]>(endpoints.errorLogs, compactQuery(errorLogFilters.value, 12)),
getJson<LogBundle["integrations"]>(endpoints.integrationLogs, compactQuery(integrationLogFilters.value, 12)),
getJson<LogBundle["integrations"]>(endpoints.integrationEventLogs, compactQuery(integrationEventFilters.value, 20)),
getJson<LogBundle["audit"]>(endpoints.auditLogs, { limit: 12 }),
])
logs.value = {
@ -472,6 +508,38 @@ async function loadLogs() {
integrationEventLogs.value = settledValue(integrationEvents)
}
async function loadGenerationLogs() {
logs.value.generation = await getJson<LogBundle["generation"]>(
endpoints.generationLogs,
compactQuery(generationLogFilters.value, 20),
)
}
async function loadWorkflowLogs() {
logs.value.workflows = await getJson<LogBundle["workflows"]>(
endpoints.workflowLogs,
compactQuery(workflowLogFilters.value, 20),
)
}
async function loadErrorLogs() {
logs.value.errors = await getJson<LogBundle["errors"]>(endpoints.errorLogs, compactQuery(errorLogFilters.value, 20))
}
async function loadIntegrationLogs() {
logs.value.integrations = await getJson<LogBundle["integrations"]>(
endpoints.integrationLogs,
compactQuery(integrationLogFilters.value, 20),
)
}
async function loadIntegrationEventLogs() {
integrationEventLogs.value = await getJson<LogBundle["integrations"]>(
endpoints.integrationEventLogs,
compactQuery(integrationEventFilters.value, 20),
)
}
async function loadAuditLogs() {
logs.value.audit = await getJson<LogBundle["audit"]>(endpoints.auditLogs, {
action: auditFilters.value.action || undefined,
@ -485,6 +553,15 @@ function settledValue<T>(result: PromiseSettledResult<T[]>): T[] {
return result.status === "fulfilled" ? result.value : []
}
function compactQuery(values: Record<string, string>, limit: number) {
const query: Record<string, string | number | undefined> = { limit }
for (const [key, value] of Object.entries(values)) {
const normalized = value.trim()
query[key] = normalized || undefined
}
return query
}
async function loadJobs() {
jobs.value = await getJson<JobListResult>(endpoints.jobs, {
status: jobFilters.value.status || undefined,
@ -1251,12 +1328,24 @@ function loadSettingsSnapshots() {
text.loadSnapshots,
async () => {
settingsSnapshots.value = await getJson<SettingsSnapshot[]>(endpoints.settingsSnapshots, { limit: 20 })
settingsSnapshotDetail.value = settingsSnapshots.value[0] ?? null
return settingsSnapshots.value
},
false,
)
}
function loadSettingsSnapshot(snapshotId: string) {
return runOperation(
text.loadSnapshot,
async () => {
settingsSnapshotDetail.value = await getJson<SettingsSnapshot>(endpoints.settingsSnapshot(snapshotId))
return settingsSnapshotDetail.value
},
false,
)
}
function rollbackSettingsSnapshot(snapshotId: string) {
return runOperation(
text.rollback,
@ -2297,6 +2386,30 @@ function storageRootBytes(uriPrefix: string) {
<h2>{{ text.generationLogs }}</h2>
<span>{{ logs.generation.length }}</span>
</header>
<div class="form-grid">
<label>
<span>{{ text.status }}</span>
<select v-model="generationLogFilters.status">
<option value="">{{ text.allStatuses }}</option>
<option v-for="status in taskStatuses" :key="`gen-${status}`" :value="status">{{ status }}</option>
</select>
</label>
<label>
<span>ProfileId</span>
<input v-model="generationLogFilters.profile_id" type="text" />
</label>
<label>
<span>WorkflowId</span>
<input v-model="generationLogFilters.workflow_id" type="text" />
</label>
<label>
<span>NodeId</span>
<input v-model="generationLogFilters.node_id" type="text" />
</label>
<button type="button" :disabled="Boolean(busy)" @click="loadGenerationLogs">
{{ text.applyFilters }}
</button>
</div>
<ul>
<li v-for="item in logs.generation" :key="item.task_id">
<div>
@ -2313,6 +2426,23 @@ function storageRootBytes(uriPrefix: string) {
<h2>{{ text.errorLogs }}</h2>
<span>{{ logs.errors.length }}</span>
</header>
<div class="form-grid">
<label>
<span>Source</span>
<select v-model="errorLogFilters.source">
<option value="">All</option>
<option value="generation_task">generation_task</option>
<option value="integration">integration</option>
</select>
</label>
<label>
<span>{{ text.status }}</span>
<input v-model="errorLogFilters.status" type="text" />
</label>
<button type="button" :disabled="Boolean(busy)" @click="loadErrorLogs">
{{ text.applyFilters }}
</button>
</div>
<ul>
<li v-for="item in logs.errors" :key="`${item.source}-${item.id}`">
<div>
@ -2332,6 +2462,27 @@ function storageRootBytes(uriPrefix: string) {
<h2>{{ text.workflowLogs }}</h2>
<span>{{ logs.workflows.length }}</span>
</header>
<div class="form-grid">
<label>
<span>WorkflowId</span>
<input v-model="workflowLogFilters.workflow_id" type="text" />
</label>
<label>
<span>Action</span>
<input v-model="workflowLogFilters.action" type="text" />
</label>
<label>
<span>NodeId</span>
<input v-model="workflowLogFilters.node_id" type="text" />
</label>
<label>
<span>{{ text.currentBranch }}</span>
<input v-model="workflowLogFilters.branch_name" type="text" />
</label>
<button type="button" :disabled="Boolean(busy)" @click="loadWorkflowLogs">
{{ text.applyFilters }}
</button>
</div>
<ul>
<li v-for="item in logs.workflows" :key="item.history_id">
<div>
@ -2348,6 +2499,23 @@ function storageRootBytes(uriPrefix: string) {
<h2>{{ text.integrationLogs }}</h2>
<span>{{ logs.integrations.length }}</span>
</header>
<div class="form-grid">
<label>
<span>Integration</span>
<input v-model="integrationLogFilters.integration_name" type="text" />
</label>
<label>
<span>Action</span>
<input v-model="integrationLogFilters.action" type="text" />
</label>
<label>
<span>{{ text.status }}</span>
<input v-model="integrationLogFilters.status" type="text" />
</label>
<button type="button" :disabled="Boolean(busy)" @click="loadIntegrationLogs">
{{ text.applyFilters }}
</button>
</div>
<ul>
<li v-for="item in logs.integrations" :key="item.integration_log_id">
<div>
@ -2366,6 +2534,23 @@ function storageRootBytes(uriPrefix: string) {
<h2>{{ text.integrationEvents }}</h2>
<span>{{ integrationEventLogs.length }}</span>
</header>
<div class="form-grid">
<label>
<span>Integration</span>
<input v-model="integrationEventFilters.integration_name" type="text" />
</label>
<label>
<span>Action</span>
<input v-model="integrationEventFilters.action" type="text" />
</label>
<label>
<span>{{ text.status }}</span>
<input v-model="integrationEventFilters.status" type="text" />
</label>
<button type="button" :disabled="Boolean(busy)" @click="loadIntegrationEventLogs">
{{ text.applyFilters }}
</button>
</div>
<ul>
<li v-for="item in integrationEventLogs" :key="`event-${item.integration_log_id}`">
<div>
@ -2455,12 +2640,24 @@ function storageRootBytes(uriPrefix: string) {
<strong>{{ snapshot.reason }}</strong>
<small>{{ snapshot.snapshot_id }} / {{ snapshot.created_at }}</small>
</div>
<button type="button" :disabled="Boolean(busy)" @click="rollbackSettingsSnapshot(snapshot.snapshot_id)">
{{ text.rollback }}
</button>
<div class="inline-actions">
<button type="button" :disabled="Boolean(busy)" @click="loadSettingsSnapshot(snapshot.snapshot_id)">
{{ text.loadSnapshot }}
</button>
<button type="button" :disabled="Boolean(busy)" @click="rollbackSettingsSnapshot(snapshot.snapshot_id)">
{{ text.rollback }}
</button>
</div>
</li>
</ul>
</section>
<section v-if="settingsSnapshotDetail" class="editor-panel">
<header>
<h2>{{ text.snapshotPreview }}</h2>
<span>{{ settingsSnapshotDetail.snapshot_id }}</span>
</header>
<pre>{{ JSON.stringify(settingsSnapshotDetail.config, null, 2) }}</pre>
</section>
<div class="split-view">
<div class="list-view">
<header>

文件差异因一行或多行过长而隐藏

查看文件

@ -1 +0,0 @@
.plugin-page-shell[data-v-3ccfcb4a]{box-sizing:border-box;min-height:100vh;padding:24px;color:#1d2430;background:#f4f6f8;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.topbar[data-v-3ccfcb4a],.activity[data-v-3ccfcb4a]{display:grid;gap:16px;grid-template-columns:minmax(0,1fr) auto;align-items:start}h1[data-v-3ccfcb4a],h2[data-v-3ccfcb4a],p[data-v-3ccfcb4a]{margin:0}h1[data-v-3ccfcb4a]{font-size:24px;font-weight:700}h2[data-v-3ccfcb4a]{font-size:14px}p[data-v-3ccfcb4a],small[data-v-3ccfcb4a],.empty[data-v-3ccfcb4a]{color:#667085}.actions[data-v-3ccfcb4a]{display:flex;gap:8px;align-items:center}button[data-v-3ccfcb4a],a.primary[data-v-3ccfcb4a]{min-height:36px;padding:0 14px;border:1px solid #c7d0da;border-radius:6px;color:#1d2430;background:#fff;font:inherit;text-decoration:none;cursor:pointer}a.primary[data-v-3ccfcb4a]{display:inline-flex;align-items:center;border-color:#256f5b;color:#fff;background:#256f5b}.status[data-v-3ccfcb4a]{display:inline-flex;align-items:center;min-height:28px;padding:0 10px;border-radius:999px;color:#245347;background:#dff3eb;font-size:13px}.status[data-state=loading][data-v-3ccfcb4a]{color:#6b4f1d;background:#f7e7c5}.notice[data-v-3ccfcb4a]{margin-top:18px;padding:14px;border:1px solid #d6dde6;border-radius:8px;background:#fff}.metrics[data-v-3ccfcb4a]{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr));gap:12px;margin-top:20px}article[data-v-3ccfcb4a],.activity>div[data-v-3ccfcb4a]{border:1px solid #d6dde6;border-radius:8px;background:#fff}article[data-v-3ccfcb4a]{display:grid;gap:8px;padding:16px}article span[data-v-3ccfcb4a]{color:#667085;font-size:13px}article strong[data-v-3ccfcb4a]{font-size:24px}.activity[data-v-3ccfcb4a]{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:16px}.activity>div[data-v-3ccfcb4a]{padding:16px}ul[data-v-3ccfcb4a]{display:grid;gap:10px;margin:12px 0 0;padding:0;list-style:none}li[data-v-3ccfcb4a]{display:flex;justify-content:space-between;gap:12px;min-width:0}li span[data-v-3ccfcb4a],li small[data-v-3ccfcb4a]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media(max-width:820px){.topbar[data-v-3ccfcb4a],.activity[data-v-3ccfcb4a]{grid-template-columns:1fr}.actions[data-v-3ccfcb4a]{flex-wrap:wrap}.metrics[data-v-3ccfcb4a]{grid-template-columns:repeat(2,minmax(0,1fr))}}

查看文件

@ -0,0 +1 @@
.plugin-page-shell[data-v-19fccc5b]{box-sizing:border-box;min-height:100vh;padding:24px;color:#1d2430;background:#f4f6f8;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.topbar[data-v-19fccc5b],.activity[data-v-19fccc5b]{display:grid;gap:16px;grid-template-columns:minmax(0,1fr) auto;align-items:start}h1[data-v-19fccc5b],h2[data-v-19fccc5b],p[data-v-19fccc5b]{margin:0}h1[data-v-19fccc5b]{font-size:24px;font-weight:700}h2[data-v-19fccc5b]{font-size:14px}p[data-v-19fccc5b],small[data-v-19fccc5b],.empty[data-v-19fccc5b]{color:#667085}.actions[data-v-19fccc5b]{display:flex;gap:8px;align-items:center}button[data-v-19fccc5b],a.primary[data-v-19fccc5b]{min-height:36px;padding:0 14px;border:1px solid #c7d0da;border-radius:6px;color:#1d2430;background:#fff;font:inherit;text-decoration:none;cursor:pointer}a.primary[data-v-19fccc5b]{display:inline-flex;align-items:center;border-color:#256f5b;color:#fff;background:#256f5b}.status[data-v-19fccc5b]{display:inline-flex;align-items:center;min-height:28px;padding:0 10px;border-radius:999px;color:#245347;background:#dff3eb;font-size:13px}.status[data-state=loading][data-v-19fccc5b]{color:#6b4f1d;background:#f7e7c5}.notice[data-v-19fccc5b]{margin-top:18px;padding:14px;border:1px solid #d6dde6;border-radius:8px;background:#fff}.metrics[data-v-19fccc5b]{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr));gap:12px;margin-top:20px}article[data-v-19fccc5b],.activity>div[data-v-19fccc5b]{border:1px solid #d6dde6;border-radius:8px;background:#fff}article[data-v-19fccc5b]{display:grid;gap:8px;padding:16px}article span[data-v-19fccc5b]{color:#667085;font-size:13px}article strong[data-v-19fccc5b]{font-size:24px}.activity[data-v-19fccc5b]{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:16px}.activity>div[data-v-19fccc5b]{padding:16px}.quick-links[data-v-19fccc5b]{margin-top:16px;padding:16px;border:1px solid #d6dde6;border-radius:8px;background:#fff}.quick-links>div[data-v-19fccc5b]{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}.quick-links a[data-v-19fccc5b]{display:inline-flex;align-items:center;min-height:34px;padding:0 12px;border:1px solid #c7d0da;border-radius:6px;color:#1d2430;background:#fff;text-decoration:none}ul[data-v-19fccc5b]{display:grid;gap:10px;margin:12px 0 0;padding:0;list-style:none}li[data-v-19fccc5b]{display:flex;justify-content:space-between;gap:12px;min-width:0}li span[data-v-19fccc5b],li small[data-v-19fccc5b]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media(max-width:820px){.topbar[data-v-19fccc5b],.activity[data-v-19fccc5b]{grid-template-columns:1fr}.actions[data-v-19fccc5b]{flex-wrap:wrap}.metrics[data-v-19fccc5b]{grid-template-columns:repeat(2,minmax(0,1fr))}}

文件差异因一行或多行过长而隐藏

查看文件

@ -1,3 +1,3 @@
<script type="module" crossorigin src="/assets/index-Cz1Lcjhl.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D80Q2Geu.css">
<script type="module" crossorigin src="/assets/index-k6nNgdib.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-g51s8Bew.css">
<div id="app"></div>

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

查看文件

@ -1,3 +1,3 @@
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-DaDSiDJ9.js"></script>
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-DQQWiMdf.css">
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BqwYfnoc.js"></script>
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-Bj4uvUaJ.css">
<div id="app"></div>