Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
fix(dashboard): refine overview layout and queue status display
Timothy Yin2e15a1652616
diff --git a/app/components/dashboard/RecentActivity.vue b/app/components/dashboard/RecentActivity.vueindex 366b7848..8a7543b9 100644--- a/app/components/dashboard/RecentActivity.vue+++ b/app/components/dashboard/RecentActivity.vue@@ -86,10 +86,10 @@ const getItemMeta = (item: ActivityItem) => {<template><UCard><template #header>- <div class="flex items-center justify-between gap-3 pb-1.5">- <h2 class="text-lg font-semibold">- {{ $t('dashboard.overview.section.recentActivity.title') }}- </h2>+ <DashboardSectionHeader+ :title="$t('dashboard.overview.section.recentActivity.title')"+ icon="tabler:activity"+ ><UButtonto="/dashboard/queue"size="xs"@@ -99,7 +99,7 @@ const getItemMeta = (item: ActivityItem) => {>{{ $t('dashboard.overview.section.recentActivity.viewQueue') }}</UButton>- </div>+ </DashboardSectionHeader></template><divdiff --git a/app/components/dashboard/SectionHeader.vue b/app/components/dashboard/SectionHeader.vuenew file mode 100644index 00000000..edfcd61c--- /dev/null+++ b/app/components/dashboard/SectionHeader.vue@@ -0,0 +1,19 @@+<script setup lang="ts">+defineProps<{+ title: string+ icon: string+}>()+</script>++<template>+ <div class="flex min-h-8 flex-wrap items-center justify-between gap-3">+ <h2 class="flex items-center gap-2.5 text-base font-semibold leading-6">+ <UIcon+ :name="icon"+ class="size-5 shrink-0 -translate-y-px text-muted"+ />+ {{ title }}+ </h2>+ <slot />+ </div>+</template>diff --git a/app/pages/dashboard/index.vue b/app/pages/dashboard/index.vueindex 8ad7aa21..78fa83d4 100644--- a/app/pages/dashboard/index.vue+++ b/app/pages/dashboard/index.vue@@ -51,6 +51,26 @@ const systemStatus = computed(() => {return 'healthy'})+const hasQueueActivity = computed(() => {+ const pool = dashboardStats.value?.workerPool+ return (pool?.totalProcessed || 0) > 0 || (pool?.totalErrors || 0) > 0+})++const queueSuccessRate = computed(() =>+ Math.min(+ 100,+ Math.max(0, dashboardStats.value?.workerPool?.averageSuccessRate || 0),+ ),+)++const queueSuccessColor = computed(() => {+ const pool = dashboardStats.value?.workerPool+ if (!pool || !hasQueueActivity.value) return 'neutral'+ if (pool.averageSuccessRate > 90) return 'success'+ if (pool.averageSuccessRate > 70) return 'warning'+ return 'error'+})+// 获取所有有照片的年份const availableYears = computed(() => {if (!photos.value || photos.value.length === 0) return []@@ -185,9 +205,10 @@ const onShareSite = () => {<!-- 运行信息 --><UCard><template #header>- <h2 class="text-lg font-semibold pb-1.5">- {{ $t('dashboard.overview.section.runtimeInfo.title') }}- </h2>+ <DashboardSectionHeader+ :title="$t('dashboard.overview.section.runtimeInfo.title')"+ icon="tabler:server"+ /></template><div class="grid grid-cols-2 md:grid-cols-4 gap-4">@@ -267,9 +288,9 @@ const onShareSite = () => {</UCard><!-- 详细统计区域 -->- <div class="grid grid-cols-1 lg:grid-cols-5 gap-4">+ <div class="grid grid-cols-1 items-start lg:grid-cols-5 gap-4"><!-- 左侧 -->- <div class="lg:col-span-3">+ <div class="min-w-0 space-y-4 lg:col-span-3"><UCard><div class="heatmap-container"><ClientOnly>@@ -347,16 +368,18 @@ const onShareSite = () => {</ClientOnly></div></UCard>+ <DashboardRecentActivity /></div><!-- 右侧:系统资源监控 -->- <div class="lg:col-span-2 w-full space-y-4">+ <div class="min-w-0 lg:col-span-2 w-full space-y-4"><!-- 内存使用 --><UCard><template #header>- <h3 class="font-semibold pb-1.5">- {{ $t('dashboard.overview.section.memory.title') }}- </h3>+ <DashboardSectionHeader+ :title="$t('dashboard.overview.section.memory.title')"+ icon="tabler:cpu"+ /></template><div class="space-y-2">@@ -407,72 +430,129 @@ const onShareSite = () => {<!-- 队列详情 --><UCard><template #header>- <h3 class="font-semibold pb-1.5">- {{ $t('dashboard.overview.section.queue.title') }}- </h3>+ <DashboardSectionHeader+ :title="$t('dashboard.overview.section.queue.title')"+ icon="tabler:list-check"+ /></template>- <div class="space-y-1">- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.activeWorkers') }}- </span>- <UBadge variant="soft">- {{ dashboardStats?.workerPool?.activeWorkers || 0 }}- </UBadge>- </div>- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.totalWorkers') }}- </span>- <UBadge variant="soft">- {{ dashboardStats?.workerPool?.totalWorkers || 0 }}- </UBadge>- </div>- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.totalProcessed') }}- </span>- <UBadge variant="soft">- {{ dashboardStats?.workerPool?.totalProcessed || 0 }}- </UBadge>- </div>- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.totalFailed') }}- </span>- <UBadge variant="soft">- {{ dashboardStats?.workerPool?.totalErrors || 0 }}- </UBadge>+ <div+ class="grid grid-cols-[100px_minmax(0,1fr)] overflow-hidden rounded-lg border border-default"+ >+ <div+ class="flex flex-col items-center justify-center gap-1 border-r border-default bg-elevated/50 px-2 py-3"+ >+ <div class="relative h-12 w-20">+ <svg+ viewBox="0 0 100 60"+ class="h-full w-full"+ aria-hidden="true"+ >+ <path+ d="M 10 50 A 40 40 0 0 1 90 50"+ fill="none"+ stroke="currentColor"+ stroke-width="7"+ stroke-linecap="round"+ class="text-border"+ />+ <path+ v-if="hasQueueActivity && queueSuccessRate > 0"+ d="M 10 50 A 40 40 0 0 1 90 50"+ fill="none"+ stroke="currentColor"+ stroke-width="7"+ stroke-linecap="round"+ pathLength="100"+ :stroke-dasharray="queueSuccessRate + ' 100'"+ :class="{+ 'text-success': queueSuccessColor === 'success',+ 'text-warning': queueSuccessColor === 'warning',+ 'text-error': queueSuccessColor === 'error',+ }"+ />+ </svg>+ <span+ class="absolute inset-x-0 bottom-0 text-center text-base font-semibold leading-5 tabular-nums"+ :class="{ 'text-muted': !hasQueueActivity }"+ >{{+ hasQueueActivity+ ? Math.round(queueSuccessRate) + '%'+ : '—'+ }}</span+ >+ </div>+ <span class="text-center text-xs leading-4 text-muted">{{+ $t('dashboard.overview.section.queue.avgSuccessRate')+ }}</span></div>- <div class="flex justify-between items-center text-sm">- <span>- {{ $t('dashboard.overview.section.queue.avgSuccessRate') }}- </span>- <UBadge- :color="- (dashboardStats?.workerPool?.averageSuccessRate || 0) > 90- ? 'success'- : (dashboardStats?.workerPool?.averageSuccessRate ||- 0) > 70- ? 'warning'- : 'error'- "- variant="soft"+ <div class="grid min-w-0 grid-cols-2 gap-px bg-border">+ <div+ class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 bg-default px-3 py-2.5">- {{- Math.round(- dashboardStats?.workerPool?.averageSuccessRate || 0,- )- }}%- </UBadge>+ <UIcon+ name="tabler:activity"+ class="size-4 shrink-0 text-muted"+ />+ <span class="min-w-0 flex-1 text-xs text-muted">{{+ $t('dashboard.overview.section.queue.activeWorkers')+ }}</span>+ <span class="text-base font-semibold tabular-nums">{{+ dashboardStats?.workerPool?.activeWorkers || 0+ }}</span>+ </div>+ <div+ class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 bg-default px-3 py-2.5"+ >+ <UIcon+ name="tabler:cpu"+ class="size-4 shrink-0 text-muted"+ />+ <span class="min-w-0 flex-1 text-xs text-muted">{{+ $t('dashboard.overview.section.queue.totalWorkers')+ }}</span>+ <span class="text-base font-semibold tabular-nums">{{+ dashboardStats?.workerPool?.totalWorkers || 0+ }}</span>+ </div>+ <div+ class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 bg-default px-3 py-2.5"+ >+ <UIcon+ name="tabler:circle-check"+ class="size-4 shrink-0 text-muted"+ />+ <span class="min-w-0 flex-1 text-xs text-muted">{{+ $t('dashboard.overview.section.queue.totalProcessed')+ }}</span>+ <span class="text-base font-semibold tabular-nums">{{+ dashboardStats?.workerPool?.totalProcessed || 0+ }}</span>+ </div>+ <div+ class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 bg-default px-3 py-2.5"+ >+ <UIcon+ name="tabler:circle-x"+ class="size-4 shrink-0 text-muted"+ />+ <span class="min-w-0 flex-1 text-xs text-muted">{{+ $t('dashboard.overview.section.queue.totalFailed')+ }}</span>+ <span+ class="text-base font-semibold tabular-nums"+ :class="{+ 'text-error':+ (dashboardStats?.workerPool?.totalErrors || 0) > 0,+ }"+ >{{ dashboardStats?.workerPool?.totalErrors || 0 }}</span+ >+ </div></div></div></UCard></div></div>-- <DashboardRecentActivity /></div></template></UDashboardPanel>