update UI

This commit is contained in:
sophie committed 2026-05-26 15:57:00 +08:00
1 parent 041c2d033f
commit 3fe3ba63b9
3 files changed
+76 -74

No files matched your search

+50 -48
View File
@@ -777,6 +777,8 @@ const workspaceSidebarNavActive =
'bg-brand-50 text-brand-700 shadow-sm dark:bg-brand-500/15 dark:text-brand-300 dark:shadow-none dark:ring-1 dark:ring-inset dark:ring-brand-500/25';
const workspaceSidebarNavInactive =
'text-slate-600 hover:bg-slate-50 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-800/80 dark:hover:text-slate-200';
const wsScheduleFilterInputClass =
'rounded-lg border border-slate-200 bg-white px-2 py-1.5 text-xs text-slate-900 outline-none transition-colors placeholder:text-slate-400 focus:border-brand-400 focus:ring-1 focus:ring-brand-500/20 dark:border-slate-700 dark:bg-slate-950/70 dark:text-slate-200 dark:placeholder:text-slate-500 dark:[color-scheme:dark]';
const isProfileLoading = ref(false);
const isProfileSaving = ref(false);
const isProfileEditing = ref(false);
@@ -1064,13 +1066,13 @@ const wsScheduleStatusOptions = [
const getWsScheduleStatusBadge = (status: string) => {
const map: Record<string, { cls: string; label: string }> = {
success: { cls: 'bg-emerald-100 text-emerald-700', label: t('workspace.schedule.status.success') },
partial_failed: { cls: 'bg-blue-100 text-blue-700', label: t('workspace.schedule.status.partialFailed') },
failed: { cls: 'bg-rose-100 text-rose-700', label: t('workspace.schedule.status.failed') },
running: { cls: 'bg-amber-100 text-amber-700', label: t('workspace.schedule.status.running') },
queued: { cls: 'bg-slate-100 text-slate-600', label: t('workspace.schedule.status.queued') },
success: { cls: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400', label: t('workspace.schedule.status.success') },
partial_failed: { cls: 'bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-400', label: t('workspace.schedule.status.partialFailed') },
failed: { cls: 'bg-rose-100 text-rose-700 dark:bg-rose-500/15 dark:text-rose-400', label: t('workspace.schedule.status.failed') },
running: { cls: 'bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400', label: t('workspace.schedule.status.running') },
queued: { cls: 'bg-slate-100 text-slate-600 dark:bg-slate-700/80 dark:text-slate-300', label: t('workspace.schedule.status.queued') },
};
return map[status] || { cls: 'bg-slate-100 text-slate-600', label: status };
return map[status] || { cls: 'bg-slate-100 text-slate-600 dark:bg-slate-700/80 dark:text-slate-300', label: status };
};
const formatDateTime = (iso?: string | null) => {
@@ -1882,99 +1884,99 @@ onMounted(async () => {
<template v-else-if="activeSidebarItem === 'schedule_runs'">
<div class="space-y-5 animate-fade-in-up">
<div class="flex items-center justify-between">
<h2 class="text-2xl font-bold text-slate-900">{{ $t('workspace.schedule.title') }}</h2>
<h2 class="text-2xl font-bold text-slate-900 dark:text-slate-100">{{ $t('workspace.schedule.title') }}</h2>
<button
@click="loadWorkspaceScheduleRuns"
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50"
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-800"
>
<RefreshCw class="h-3.5 w-3.5" />
{{ $t('workspace.schedule.refresh') }}
</button>
</div>
<div class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200 bg-slate-50/40 px-4 py-3">
<div class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200/80 bg-white/70 px-4 py-3 shadow-sm dark:border-slate-800 dark:bg-slate-900/20 dark:shadow-none">
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.name') }}</label>
<input type="text" v-model="wsScheduleNameFilter" :placeholder="$t('workspace.schedule.filters.namePlaceholder')" class="!w-[150px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
<label class="mb-1 block text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('workspace.schedule.filters.name') }}</label>
<input type="text" v-model="wsScheduleNameFilter" :placeholder="$t('workspace.schedule.filters.namePlaceholder')" :class="['!w-[150px]', wsScheduleFilterInputClass]" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.start') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedAfter" class="!w-[170px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
<label class="mb-1 block text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('workspace.schedule.filters.start') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedAfter" :class="['!w-[170px]', wsScheduleFilterInputClass]" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.end') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedBefore" class="!w-[170px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
<label class="mb-1 block text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('workspace.schedule.filters.end') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedBefore" :class="['!w-[170px]', wsScheduleFilterInputClass]" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.status') }}</label>
<select v-model="wsScheduleStatusFilter" class="!w-[120px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white">
<label class="mb-1 block text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('workspace.schedule.filters.status') }}</label>
<select v-model="wsScheduleStatusFilter" :class="['!w-[120px]', wsScheduleFilterInputClass]">
<option v-for="o in wsScheduleStatusOptions" :key="o.value" :value="o.value">{{ o.label }}</option>
</select>
</div>
<button
@click="loadWorkspaceScheduleRuns"
class="inline-flex items-center gap-1 rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-brand-700"
class="inline-flex items-center gap-1 rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-brand-700 dark:hover:bg-brand-500"
>
<Search class="h-3.5 w-3.5" />
{{ $t('workspace.schedule.search') }}
</button>
<button
@click="resetWsScheduleFilters"
class="rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50"
class="rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:bg-transparent dark:text-slate-300 dark:hover:bg-slate-800/60"
>
{{ $t('workspace.schedule.reset') }}
</button>
</div>
<div v-if="workspaceScheduleLoading" class="py-10 text-center text-sm text-slate-400">{{ $t('workspace.schedule.loading') }}</div>
<div v-else-if="workspaceScheduleRuns.length === 0" class="py-10 text-center text-sm text-slate-400">{{ $t('workspace.schedule.empty') }}</div>
<div v-else class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div v-if="workspaceScheduleLoading" class="rounded-2xl border border-dashed border-slate-200 py-10 text-center text-sm text-slate-400 dark:border-slate-800 dark:text-slate-500">{{ $t('workspace.schedule.loading') }}</div>
<div v-else-if="workspaceScheduleRuns.length === 0" class="rounded-2xl border border-dashed border-slate-200 py-10 text-center text-sm text-slate-400 dark:border-slate-800 dark:text-slate-500">{{ $t('workspace.schedule.empty') }}</div>
<div v-else class="overflow-hidden rounded-2xl border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-800">
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="border-b border-slate-100 bg-slate-50/60">
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.name') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.runNo') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.triggerType') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.start') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.end') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.duration') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.status') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.total') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.success') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.failed') }}</th>
<tr class="border-b border-slate-100 bg-slate-50/60 dark:border-slate-700 dark:bg-slate-900/60">
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.name') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.runNo') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.triggerType') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.start') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.end') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.duration') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.status') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.total') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.success') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.failed') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.detail') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600 dark:text-slate-400">{{ $t('workspace.schedule.columns.detail') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="r in workspaceScheduleRuns" :key="r.id" class="border-b border-slate-50 transition-colors hover:bg-slate-50/50">
<td class="px-4 py-3 font-medium text-slate-900">{{ r.schedule_name || '-' }}</td>
<td class="px-4 py-3 text-slate-500 font-mono text-xs">{{ r.run_no }}</td>
<td class="px-4 py-3 text-slate-500">{{ r.trigger_type === 'manual' ? $t('workspace.schedule.trigger.manual') : r.trigger_type === 'test' ? $t('workspace.schedule.trigger.test') : $t('workspace.schedule.trigger.timed') }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ formatDateTime(r.started_at) }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ formatDateTime(r.finished_at) }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ r.duration_ms != null ? (r.duration_ms >= 1000 ? (r.duration_ms / 1000).toFixed(1) + 's' : r.duration_ms + 'ms') : '-' }}</td>
<tr v-for="r in workspaceScheduleRuns" :key="r.id" class="border-b border-slate-50 transition-colors hover:bg-slate-50/50 dark:border-slate-700/80 dark:hover:bg-slate-700/40">
<td class="px-4 py-3 font-medium text-slate-900 dark:text-slate-100">{{ r.schedule_name || '-' }}</td>
<td class="px-4 py-3 font-mono text-xs text-slate-500 dark:text-slate-400">{{ r.run_no }}</td>
<td class="px-4 py-3 text-slate-500 dark:text-slate-400">{{ r.trigger_type === 'manual' ? $t('workspace.schedule.trigger.manual') : r.trigger_type === 'test' ? $t('workspace.schedule.trigger.test') : $t('workspace.schedule.trigger.timed') }}</td>
<td class="whitespace-nowrap px-4 py-3 text-slate-500 dark:text-slate-400">{{ formatDateTime(r.started_at) }}</td>
<td class="whitespace-nowrap px-4 py-3 text-slate-500 dark:text-slate-400">{{ formatDateTime(r.finished_at) }}</td>
<td class="whitespace-nowrap px-4 py-3 text-slate-500 dark:text-slate-400">{{ r.duration_ms != null ? (r.duration_ms >= 1000 ? (r.duration_ms / 1000).toFixed(1) + 's' : r.duration_ms + 'ms') : '-' }}</td>
<td class="px-4 py-3">
<span class="inline-flex shrink-0 items-center whitespace-nowrap rounded-full px-2.5 py-1 text-xs font-semibold" :class="getWsScheduleStatusBadge(r.status).cls">
{{ getWsScheduleStatusBadge(r.status).label }}
</span>
<span v-if="r.error_message && r.error_message !== '无待处理数据'" class="ml-1 text-xs text-slate-400" :title="r.error_message">...</span>
<span v-else-if="r.error_message === '无待处理数据'" class="ml-1 text-xs text-slate-400">({{ $t('workspace.schedule.noPendingData') }})</span>
<span v-if="r.error_message && r.error_message !== '无待处理数据'" class="ml-1 text-xs text-slate-400 dark:text-slate-500" :title="r.error_message">...</span>
<span v-else-if="r.error_message === '无待处理数据'" class="ml-1 text-xs text-slate-400 dark:text-slate-500">({{ $t('workspace.schedule.noPendingData') }})</span>
</td>
<td class="px-4 py-3 text-slate-500">{{ r.total_count || 0 }}</td>
<td class="px-4 py-3 text-emerald-600 font-medium">{{ r.success_count ?? 0 }}</td>
<td class="px-4 py-3 text-rose-600 font-medium">{{ r.failed_count ?? 0 }}</td>
<td class="px-4 py-3 text-slate-500 dark:text-slate-400">{{ r.total_count || 0 }}</td>
<td class="px-4 py-3 font-medium text-emerald-600 dark:text-emerald-400">{{ r.success_count ?? 0 }}</td>
<td class="px-4 py-3 font-medium text-rose-600 dark:text-rose-400">{{ r.failed_count ?? 0 }}</td>
<td class="px-4 py-3">
<a
v-if="r.total_count > 0 && r.excel_file_name"
href="#"
@click.prevent="downloadWsScheduleExcel(r.id)"
class="inline-flex items-center gap-1 rounded-lg border border-slate-200 px-2 py-1 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50"
class="inline-flex items-center gap-1 rounded-lg border border-slate-200 px-2 py-1 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:border-slate-500 dark:hover:bg-slate-700/80"
>
<Download class="h-3 w-3" />
{{ $t('workspace.schedule.download') }}
</a>
<span v-else class="text-xs text-slate-300">-</span>
<span v-else class="text-xs text-slate-300 dark:text-slate-600">-</span>
</td>
</tr>
</tbody>