chore(frontend): introduce prettier + eslint and prune unused code
- Add Prettier 3 with prettier-plugin-organize-imports (sorts/removes unused imports) - Add ESLint 10 flat config with typescript-eslint + eslint-plugin-vue + eslint-config-prettier - Add root scripts: format, format:check, lint, lint:fix - Reformat 257 files across admin-web, ops-web, desktop-client, packages - Remove unused locals/exports flagged by --noUnusedLocals/--noUnusedParameters - Fix duplicate localTabLabel key, surrogate-pair regex u-flag, NBSP literal in regex - Skip server/ (Go) and apps/browser-extension/ (deprecated per ADR) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,54 +1,54 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { computed } from 'vue'
|
||||
|
||||
import StatusBadge from "../components/StatusBadge.vue";
|
||||
import SurfaceCard from "../components/SurfaceCard.vue";
|
||||
import { useDesktopRuntime } from "../composables/useDesktopRuntime";
|
||||
import { formatRelativeTime } from "../lib/formatters";
|
||||
import { translateDesktopPlatform } from "../lib/media-catalog";
|
||||
import { taskTone } from "../lib/runtime-ui";
|
||||
import StatusBadge from '../components/StatusBadge.vue'
|
||||
import SurfaceCard from '../components/SurfaceCard.vue'
|
||||
import { useDesktopRuntime } from '../composables/useDesktopRuntime'
|
||||
import { formatRelativeTime } from '../lib/formatters'
|
||||
import { translateDesktopPlatform } from '../lib/media-catalog'
|
||||
import { taskTone } from '../lib/runtime-ui'
|
||||
|
||||
function translatePlatform(platform: string) {
|
||||
return translateDesktopPlatform(platform);
|
||||
return translateDesktopPlatform(platform)
|
||||
}
|
||||
|
||||
function translateTaskStatus(status: string) {
|
||||
const map: Record<string, string> = {
|
||||
queued: "等待排队",
|
||||
in_progress: "执行中",
|
||||
succeeded: "成功",
|
||||
failed: "失败",
|
||||
unknown: "失败",
|
||||
aborted: "已取消",
|
||||
};
|
||||
return map[status?.toLowerCase()] || status;
|
||||
queued: '等待排队',
|
||||
in_progress: '执行中',
|
||||
succeeded: '成功',
|
||||
failed: '失败',
|
||||
unknown: '失败',
|
||||
aborted: '已取消',
|
||||
}
|
||||
return map[status?.toLowerCase()] || status
|
||||
}
|
||||
|
||||
const { snapshot } = useDesktopRuntime();
|
||||
const { snapshot } = useDesktopRuntime()
|
||||
|
||||
const columns = computed(() => {
|
||||
const tasks = snapshot.value?.tasks ?? [];
|
||||
const tasks = snapshot.value?.tasks ?? []
|
||||
return [
|
||||
{
|
||||
key: "queued",
|
||||
title: "等待派发 (Queued)",
|
||||
description: "已经落库,等待 RabbitMQ 唤醒或客户端主动 lease。",
|
||||
items: tasks.filter((item) => item.status === "queued"),
|
||||
key: 'queued',
|
||||
title: '等待派发 (Queued)',
|
||||
description: '已经落库,等待 RabbitMQ 唤醒或客户端主动 lease。',
|
||||
items: tasks.filter((item) => item.status === 'queued'),
|
||||
},
|
||||
{
|
||||
key: "in_progress",
|
||||
title: "正在执行 (In Progress)",
|
||||
description: "当前被 client 持有活动租约,结果回写必须带 lease_token。",
|
||||
items: tasks.filter((item) => item.status === "in_progress"),
|
||||
key: 'in_progress',
|
||||
title: '正在执行 (In Progress)',
|
||||
description: '当前被 client 持有活动租约,结果回写必须带 lease_token。',
|
||||
items: tasks.filter((item) => item.status === 'in_progress'),
|
||||
},
|
||||
{
|
||||
key: "exception",
|
||||
title: "异常与终态 (Terminal)",
|
||||
description: "failed、succeeded、aborted 等终态任务。",
|
||||
items: tasks.filter((item) => !["queued", "in_progress"].includes(item.status)),
|
||||
key: 'exception',
|
||||
title: '异常与终态 (Terminal)',
|
||||
description: 'failed、succeeded、aborted 等终态任务。',
|
||||
items: tasks.filter((item) => !['queued', 'in_progress'].includes(item.status)),
|
||||
},
|
||||
];
|
||||
});
|
||||
]
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -58,7 +58,8 @@ const columns = computed(() => {
|
||||
<p class="eyebrow">WORKFLOW CENTER</p>
|
||||
<h2>任务调度中心</h2>
|
||||
<p class="hero-summary">
|
||||
基于 lease 的可靠端云协议泳道。这里更偏底层调度视角,用来观察 MQ 下发、租约占用与 fallback 消费的运行阶段。
|
||||
基于 lease 的可靠端云协议泳道。这里更偏底层调度视角,用来观察 MQ 下发、租约占用与 fallback
|
||||
消费的运行阶段。
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
@@ -78,7 +79,11 @@ const columns = computed(() => {
|
||||
<strong>{{ task.title }}</strong>
|
||||
<p>{{ task.accountName }} · {{ translatePlatform(task.platform) }}</p>
|
||||
</div>
|
||||
<StatusBadge :tone="taskTone(task.status)" :label="translateTaskStatus(task.status)" class="shrink-badge" />
|
||||
<StatusBadge
|
||||
:tone="taskTone(task.status)"
|
||||
:label="translateTaskStatus(task.status)"
|
||||
class="shrink-badge"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="task-flags">
|
||||
@@ -91,9 +96,7 @@ const columns = computed(() => {
|
||||
<footer class="task-footer">
|
||||
<span>
|
||||
{{
|
||||
task.leaseExpiresAt
|
||||
? `${formatRelativeTime(task.leaseExpiresAt)} 过期`
|
||||
: "已释放"
|
||||
task.leaseExpiresAt ? `${formatRelativeTime(task.leaseExpiresAt)} 过期` : '已释放'
|
||||
}}
|
||||
</span>
|
||||
<small>{{ formatRelativeTime(task.updatedAt) }}</small>
|
||||
@@ -299,19 +302,19 @@ h2 {
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
html[data-theme="dark"] .task-card {
|
||||
html[data-theme='dark'] .task-card {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
html[data-theme="dark"] .action-button.secondary {
|
||||
html[data-theme='dark'] .action-button.secondary {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
html[data-theme="dark"] .action-button.success {
|
||||
html[data-theme='dark'] .action-button.success {
|
||||
color: #6ee7b7;
|
||||
}
|
||||
|
||||
html[data-theme="dark"] .action-button.danger {
|
||||
html[data-theme='dark'] .action-button.danger {
|
||||
color: #fca5a5;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user