fix: refresh plugin page status panel

这个提交存在于:
YokiiroBW 2026-07-05 15:10:49 +08:00
父节点 79d1742c64
当前提交 a7e6e3e70b
共有 6 个文件被更改,包括 76 次插入 和 33 次删除

查看文件

@ -10,6 +10,26 @@ const dashboard = ref<DashboardSummary | null>(null)
const loading = ref(true)
const error = ref("")
const text = {
loadFailed: "\u52a0\u8f7d\u5931\u8d25",
loading: "\u52a0\u8f7d\u4e2d",
refresh: "\u5237\u65b0",
workbench: "\u5de5\u4f5c\u53f0",
profiles: "\u89d2\u8272",
queue: "\u961f\u5217",
running: "\u8fd0\u884c\u4e2d",
failed: "\u5931\u8d25",
storage: "\u5b58\u50a8",
recentImages: "\u6700\u8fd1\u56fe\u7247",
recentJobs: "\u4efb\u52a1",
emptyImages: "\u6682\u65e0\u56fe\u7247",
emptyJobs: "\u6682\u65e0\u4efb\u52a1",
permissions: "\u6743\u9650",
features: "\u529f\u80fd",
enabled: "\u5df2\u5f00\u542f",
disabled: "\u672a\u5f00\u542f",
} as const
const workbenchUrl = computed(() => `${bootstrap.value?.api_base ?? ""}/web`)
const queueTotal = computed(() => {
const queue = dashboard.value?.queue
@ -29,7 +49,7 @@ async function load() {
bootstrap.value = bootstrapData
dashboard.value = dashboardData
} catch (err) {
error.value = err instanceof Error ? err.message : "加载失败"
error.value = err instanceof Error ? err.message : text.loadFailed
} finally {
loading.value = false
}
@ -54,56 +74,79 @@ function formatBytes(value = 0) {
<span class="status" :data-state="dashboard?.plugin_status ?? 'loading'">
{{ dashboard?.plugin_status ?? "loading" }}
</span>
<button type="button" @click="load">刷新</button>
<a v-if="bootstrap" class="primary" :href="workbenchUrl" target="_blank" rel="noreferrer">工作台</a>
<button type="button" @click="load">{{ text.refresh }}</button>
<a v-if="bootstrap" class="primary" :href="workbenchUrl" target="_blank" rel="noreferrer">
{{ text.workbench }}
</a>
</div>
</header>
<section v-if="error" class="notice">{{ error }}</section>
<section v-else-if="loading" class="notice">加载中</section>
<section v-else-if="loading" class="notice">{{ text.loading }}</section>
<section v-else class="metrics" aria-label="ImageStudio dashboard">
<article>
<span>角色</span>
<span>{{ text.profiles }}</span>
<strong>{{ dashboard?.active_profiles ?? 0 }}</strong>
</article>
<article>
<span>队列</span>
<span>{{ text.queue }}</span>
<strong>{{ queueTotal }}</strong>
</article>
<article>
<span>运行中</span>
<span>{{ text.running }}</span>
<strong>{{ dashboard?.queue.running ?? 0 }}</strong>
</article>
<article>
<span>失败</span>
<span>{{ text.failed }}</span>
<strong>{{ dashboard?.queue.failed ?? 0 }}</strong>
</article>
<article>
<span>存储</span>
<span>{{ text.storage }}</span>
<strong>{{ formatBytes(dashboard?.storage.total_bytes) }}</strong>
</article>
</section>
<section class="activity">
<div>
<h2>最近图片</h2>
<h2>{{ text.recentImages }}</h2>
<ul>
<li v-for="image in dashboard?.recent_images ?? []" :key="String((image as any).image_id)">
<span>{{ (image as any).image_id }}</span>
<small>{{ (image as any).created_at }}</small>
</li>
<li v-if="!dashboard?.recent_images?.length" class="empty">暂无图片</li>
<li v-if="!dashboard?.recent_images?.length" class="empty">{{ text.emptyImages }}</li>
</ul>
</div>
<div>
<h2>任务</h2>
<h2>{{ text.recentJobs }}</h2>
<ul>
<li v-for="job in dashboard?.recent_jobs ?? []" :key="String((job as any).task_id)">
<span>{{ (job as any).task_id }}</span>
<small>{{ (job as any).status }}</small>
</li>
<li v-if="!dashboard?.recent_jobs?.length" class="empty">暂无任务</li>
<li v-if="!dashboard?.recent_jobs?.length" class="empty">{{ text.emptyJobs }}</li>
</ul>
</div>
</section>
<section v-if="bootstrap" class="activity">
<div>
<h2>{{ text.permissions }}</h2>
<ul>
<li v-for="(value, key) in bootstrap.permissions" :key="key">
<span>{{ key }}</span>
<small>{{ value ? text.enabled : text.disabled }}</small>
</li>
</ul>
</div>
<div>
<h2>{{ text.features }}</h2>
<ul>
<li v-for="(value, key) in bootstrap.feature_flags" :key="key">
<span>{{ key }}</span>
<small>{{ value ? text.enabled : text.disabled }}</small>
</li>
</ul>
</div>
</section>

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

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

查看文件

@ -0,0 +1 @@
.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))}}

查看文件

@ -1 +0,0 @@
.plugin-page-shell[data-v-7e06e9af]{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-7e06e9af],.activity[data-v-7e06e9af]{display:grid;gap:16px;grid-template-columns:minmax(0,1fr) auto;align-items:start}h1[data-v-7e06e9af],h2[data-v-7e06e9af],p[data-v-7e06e9af]{margin:0}h1[data-v-7e06e9af]{font-size:24px;font-weight:700}h2[data-v-7e06e9af]{font-size:14px}p[data-v-7e06e9af],small[data-v-7e06e9af],.empty[data-v-7e06e9af]{color:#667085}.actions[data-v-7e06e9af]{display:flex;gap:8px;align-items:center}button[data-v-7e06e9af],a.primary[data-v-7e06e9af]{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-7e06e9af]{display:inline-flex;align-items:center;border-color:#256f5b;color:#fff;background:#256f5b}.status[data-v-7e06e9af]{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-7e06e9af]{color:#6b4f1d;background:#f7e7c5}.notice[data-v-7e06e9af]{margin-top:18px;padding:14px;border:1px solid #d6dde6;border-radius:8px;background:#fff}.metrics[data-v-7e06e9af]{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr));gap:12px;margin-top:20px}article[data-v-7e06e9af],.activity>div[data-v-7e06e9af]{border:1px solid #d6dde6;border-radius:8px;background:#fff}article[data-v-7e06e9af]{display:grid;gap:8px;padding:16px}article span[data-v-7e06e9af]{color:#667085;font-size:13px}article strong[data-v-7e06e9af]{font-size:24px}.activity[data-v-7e06e9af]{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:16px}.activity>div[data-v-7e06e9af]{padding:16px}ul[data-v-7e06e9af]{display:grid;gap:10px;margin:12px 0 0;padding:0;list-style:none}li[data-v-7e06e9af]{display:flex;justify-content:space-between;gap:12px;min-width:0}li span[data-v-7e06e9af],li small[data-v-7e06e9af]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media(max-width:820px){.topbar[data-v-7e06e9af],.activity[data-v-7e06e9af]{grid-template-columns:1fr}.actions[data-v-7e06e9af]{flex-wrap:wrap}.metrics[data-v-7e06e9af]{grid-template-columns:repeat(2,minmax(0,1fr))}}

查看文件

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