fix(web): 收敛控制台列表主按钮、报警可读性与焦点环
按 UI 评审闭环 UI-02~UI-07(查询降权、对象/处理人可读化、筛选分层、数据源名映射、焦点外环);概览与登录壳按约定暂缓。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c7a23837f4
commit
9dffeae667
25 files changed
+1057
-94
No files matched your search
@@ -0,0 +1,71 @@
|
||||
# Context Pack — ui-playwright-review fixes
|
||||
|
||||
## Task goal
|
||||
|
||||
按 UI 评审报告修复 UI-02~UI-07;**不改** UI-01(概览占位)、UI-08(登录壳)。
|
||||
|
||||
## Requirement source
|
||||
|
||||
- `docs/evidence/ui-review/2026-11-19-console-full/report.md`
|
||||
- 用户确认:`U1先不用改;UI-08先不改;其他的可以进行修复`
|
||||
|
||||
## Implementation source
|
||||
|
||||
本 context-pack;切片一次落地(前端 console 为主)。
|
||||
|
||||
## Involved modules
|
||||
|
||||
- `web/apps/console` 列表按钮、报警列表/详情、查询列表数据源名、EP 焦点桥接
|
||||
- `web/design/tokens.css`(可选只读)、`element-theme.css`
|
||||
- `web/apps/console/locales/*`
|
||||
|
||||
## Loaded rules / docs
|
||||
|
||||
- `.cursor/rules/element-admin-ui.mdc`
|
||||
- `docs/current/frontend-ui.md`
|
||||
- `standards://frontend/element-plus?version=1.0.2`
|
||||
- `standards://frontend/frontend-stack?version=2.1.0`
|
||||
- `standards://frontend/visual-ux?version=2.0.1`
|
||||
|
||||
## Allowed modification scope
|
||||
|
||||
- `web/apps/console/src/datasources/DatasourceList.vue`
|
||||
- `web/apps/console/src/queries/QueryList.vue`
|
||||
- `web/apps/console/src/mappings/MappingList.vue`
|
||||
- `web/apps/console/src/alarms/*`(format、List、Detail、相关单测)
|
||||
- `web/apps/console/src/shared/styles/element-theme.css`
|
||||
- `web/apps/console/locales/{zh-CN,zh-TW,en,th}/common.json`
|
||||
- 必要的 unit / e2e 适配
|
||||
- 任务产物与证据报告备注
|
||||
|
||||
## Forbidden modification scope
|
||||
|
||||
- 概览/Home 业务内容(UI-01)
|
||||
- 登录页品牌壳(UI-08)
|
||||
- 后端 API 契约变更(除非前端无法解析 identity;本轮仅前端解析)
|
||||
- 密钥、`.env.local`
|
||||
|
||||
## Current approved slice
|
||||
|
||||
`S-fix-ui-02-07`:一次修复 UI-02~UI-07;`gateClass: standard`;`risk_score: 2`
|
||||
|
||||
## Validation commands
|
||||
|
||||
```powershell
|
||||
cd web
|
||||
pnpm --filter @watchman/console test:unit
|
||||
pnpm --filter @watchman/console typecheck
|
||||
```
|
||||
|
||||
可选:相关 e2e alarms/queries/datasources。
|
||||
|
||||
## Assumptions
|
||||
|
||||
- 「新建」保留 primary;「查询」降为默认按钮(报警列表无新建,查询保持 primary)。
|
||||
- identity 形如 `identity:v1:{"serial":"..."}`;解析失败则回退原文。
|
||||
- 处理人无目录服务:UUID 截断展示 + title 全文。
|
||||
|
||||
## Stop conditions
|
||||
|
||||
- 需改后端字段或权限模型
|
||||
- 用户推翻「查询降权 / 新建保留 primary」选择
|
||||
@@ -0,0 +1,43 @@
|
||||
# Task Intake Result
|
||||
|
||||
## Task Type
|
||||
|
||||
review(工业管理后台 UI 设计评审;只读,默认不改代码)
|
||||
|
||||
## Current Understanding
|
||||
|
||||
- 目标:启动本地服务 → Playwright + 截图取证 → 对 Watchman 控制台 UI 做设计评审 → 输出优化建议。
|
||||
- 页面分类:`admin`(工业内部 B 端管理后台);大屏/HMI 本轮默认 `NOT_RUN`(仓库尚无对应交付面)。
|
||||
- 范围假设:已交付的控制台壳与业务页(登录、数据源、查询、映射/规则、报警中心等可访问路由),合成数据优先。
|
||||
- 已有相关证据:`docs/evidence/ui-review/2026-11-19-watchman-admin/`(仅数据源列表;曾因登录阻塞改用合成 `auth/me`)。本轮按用户要求先起服务再评,尽量覆盖更广页面。
|
||||
- 冲突注意:当前 `.task/active.json` 仍指向 `2026-11-19/ui-hexin-align`(phase: `review-complete-awaiting-final-approval`)。本任务目录已建,但未切换 active,待用户确认。
|
||||
|
||||
## Gate Policy
|
||||
|
||||
- config/default: `balanced`
|
||||
- allowTaskOverride: `true`
|
||||
- recommended: `autonomous`(只读评审 + 启动本地 dev 服务;无代码切片、无边界改写;建议少中途停顿)
|
||||
- selected: `autonomous`(用户 2026-11-19 确认)
|
||||
- reason or override reason: 用户明确选择 autonomous;只读评审
|
||||
- effective: `autonomous`
|
||||
- finalApprovalRequired: `true`(评审报告交付后需最终确认;默认不自动改 UI)
|
||||
|
||||
## Blocking Questions
|
||||
|
||||
1. 本任务 `gatePolicy.selected` 选 `strict` / `balanced` / `autonomous` 哪一个?
|
||||
2. 是否将 `.task/active.json` 从 `ui-hexin-align`(待最终批准)切换到本任务 `ui-playwright-review`?
|
||||
3. 登录方式:本机 Casdoor 真实账号(请确认已配置且可用),还是 `VITE_AUTH_MODE=fixture` / 合成会话(与上轮类似,不绕权)?
|
||||
|
||||
## Non-blocking Assumptions
|
||||
|
||||
- 不写业务数据、不触真实 MES/企微、不绕过登录与权限。
|
||||
- 启动方式按 `docs/runbook.md`:API `127.0.0.1:8000`,Console `127.0.0.1:5173`。
|
||||
- 产出:截图 + 评审报告 + 优化建议;默认不进入 coding。
|
||||
|
||||
## Recommended Next Step
|
||||
|
||||
用户确认门禁与登录方式后 → 切换/绑定 active task → 执行 `industrial-ui-review`(启动服务 → Playwright 截图 → 按 admin 参考出报告)。
|
||||
|
||||
## Suggested Prompt For Next Step
|
||||
|
||||
确认:`gatePolicy.selected=<...>`;`active` 切换为 `ui-playwright-review`;登录用 `<casdoor|fixture>`。然后启动服务并评审。
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"taskId": "2026-11-19/ui-playwright-review",
|
||||
"type": "review",
|
||||
"phase": "closed",
|
||||
"allowedToCode": false,
|
||||
"currentSlice": "S-fix-ui-02-07",
|
||||
"fixed": ["UI-02", "UI-03", "UI-04", "UI-05", "UI-06", "UI-07"],
|
||||
"deferred": ["UI-01", "UI-08"],
|
||||
"recheck": "docs/evidence/ui-review/2026-11-19-console-recheck/report.md",
|
||||
"validation": {
|
||||
"unit": "132 passed",
|
||||
"typecheck": "passed",
|
||||
"uiRecheck": "UI-02..07 CLOSED"
|
||||
},
|
||||
"gatePolicy": {
|
||||
"recommended": "autonomous",
|
||||
"selected": "autonomous",
|
||||
"effective": "autonomous",
|
||||
"finalApprovalRequired": true,
|
||||
"allowTaskOverride": true
|
||||
},
|
||||
"closedAt": "2026-11-19T11:05:00Z",
|
||||
"closeReason": "user requested commit, push, and close task"
|
||||
}
|
||||
+8
-14
@@ -1,17 +1,11 @@
|
||||
{
|
||||
"taskId": "2026-11-19/ui-hexin-align",
|
||||
"type": "refactor",
|
||||
"phase": "review-complete-awaiting-final-approval",
|
||||
"taskId": null,
|
||||
"type": null,
|
||||
"phase": "idle",
|
||||
"allowedToCode": false,
|
||||
"currentSlice": "S9",
|
||||
"lastGate": "slices-S0-S9-done-awaiting-final",
|
||||
"nextCommand": "final-approval",
|
||||
"gatePolicy": {
|
||||
"recommended": "strict",
|
||||
"selected": "autonomous",
|
||||
"effective": "autonomous",
|
||||
"finalApprovalRequired": true,
|
||||
"allowTaskOverride": true
|
||||
},
|
||||
"updatedAt": "2026-11-19T08:06:00Z"
|
||||
"currentSlice": null,
|
||||
"lastGate": "ui-playwright-review-closed",
|
||||
"nextCommand": null,
|
||||
"closedTaskId": "2026-11-19/ui-playwright-review",
|
||||
"updatedAt": "2026-11-19T11:05:00Z"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"outline": "3px none rgb(15, 23, 42)",
|
||||
"boxShadow": "rgb(2, 132, 199) 0px 0px 0px 1px inset",
|
||||
"borderColor": "rgb(15, 23, 42)"
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
# UI Review — Watchman 控制台(真实登录全页)
|
||||
|
||||
## 范围与条件
|
||||
|
||||
- 页面/路由:登录、`/#/` 概览、`/#/datasources`、`/#/queries`、`/#/mappings`、`/#/alarms`、报警详情
|
||||
- 页面分类:`admin`(工业内部 B 端管理后台);大屏 / HMI:`NOT_RUN`
|
||||
- 角色与核心任务:真实 Casdoor 账号(`watchman` 业务角色);查看列表、筛选空态、键盘 Tab 聚焦、打开报警详情;未执行新建/停用/接手等写操作
|
||||
- 环境/版本:本地 API `watchman 0.1.0` + Vite `127.0.0.1:5173`;Playwright Chromium(仓库依赖)+ Cursor 浏览器复核
|
||||
- 视口/设备:`1440×900`、`1280×800`;`viewport-metrics.json` 显示各业务页 `scrollHeight === clientHeight`(整页不滚)
|
||||
- 主题/语言:亮色、简体中文;登录页另截暗色一帧
|
||||
- 数据边界:真实本地库数据(含大量合成/演示数据源与查询);未接真实 MES / 企微发送
|
||||
- 操作边界:只读浏览与筛选;未点停用、未改配置、未写报警进展
|
||||
- 敏感信息:侧栏欢迎语含真实显示名;截图已落盘,对外分享前应遮蔽。本报告不重复显示名与口令。
|
||||
|
||||
## 方法与证据
|
||||
|
||||
- 设计评审:`industrial-ui-review` admin + `report-and-browser` 模板
|
||||
- 功能 E2E:本轮不是完整功能断言;仅记录实际看到的交互结果
|
||||
- 视觉回归:未建像素基线
|
||||
- 浏览器/Playwright:`web/apps/console/scripts/ui-review-capture.mjs`(凭据仅进程环境变量,未入库);Cursor 浏览器登录与导航复核
|
||||
- 项目真源:`docs/current/frontend-ui.md`、`docs/ui/ELEMENT_MIGRATION.md`、`.cursor/rules/element-admin-ui.mdc`、`D:/FDE/SP/design-system/PAGE_PATTERNS.md`;主色 D41 `#0284c7`
|
||||
- 公司规范:`standards://frontend/frontend-stack?version=2.1.0`、`standards://frontend/element-plus?version=1.0.2`、`standards://frontend/visual-ux?version=2.0.1`、`standards://security/red-line?version=1.1.0`
|
||||
|
||||
证据目录:`docs/evidence/ui-review/2026-11-19-console-full/screenshots/`
|
||||
|
||||
## 结论
|
||||
|
||||
壳层与列表骨架整体符合 Watchman 约定:侧栏品牌 + 底栏登录信息/退出、面包屑不重复大标题、列表「筛选 → 表体滚动 → 底部分页」、筛选无匹配文案区分清楚。`1440×900` / `1280×800` 下业务列表页未见整页纵向滚动。
|
||||
|
||||
主要缺口集中在:**概览对值班价值不足**、**列表区双主色按钮权重冲突**、**报警/查询对现场人员不友好的技术标识原文展示**、**报警筛选过密**。键盘焦点相对早前「灰边难辨」已改善为项目主色 1px inset,但仍偏弱。
|
||||
|
||||
本轮未发现会导致误操作危险控制的 `P0` UI 问题;写操作与确认框未测。
|
||||
|
||||
## Findings
|
||||
|
||||
### UI-01 概览页几乎只有健康条,缺少预警工作台入口
|
||||
|
||||
- 页面名/URL或路由:概览,`/#/`
|
||||
- 区域:主内容「服务健康」卡片及大片留白
|
||||
- 截图:[home-1440x900-data-01.png](./screenshots/home-1440x900-data-01.png)
|
||||
- 描述:登录后默认落地页仅展示服务可用与版本;无待处理报警摘要、无模块快捷入口、无最近异常或健康趋势。
|
||||
- 为何不美观/不合理:工业预警后台的首屏应帮助值班员 3 步内知道「现在有什么要处理、从哪进」。当前首屏信息密度过低,与「预警平台」任务目标脱节。公司 `visual-ux`「一切皆可视化/总览可见能力与状态」也要求总览承载能力入口(Watchman 主色仍以 D41 为准)。
|
||||
- 影响:值班与管理者每次登录都要再点侧栏;无法从概览感知报警积压或系统健康全貌。
|
||||
- 建议:概览增加「待处理/处理中报警计数」「最近报警」「数据源异常/熔断」卡片,并链到 `/alarms`、`/datasources`;健康检查可降为次级条。若阶段上故意留空,应在页内写明「占位/后续阶段」以免被当成残页。
|
||||
- 优先级:P2
|
||||
- 判断类型:主观(对照任务场景 + `visual-ux` 总览原则;非本仓已冻结的页面字段契约)
|
||||
- 验证状态:VERIFIED_BROWSER
|
||||
- 依据:真实登录后首屏截图;`standards://frontend/visual-ux?version=2.0.1` §一.10;admin 任务顺序要求
|
||||
|
||||
### UI-02 列表工具条「查询」与「新建」同为实心主色,主操作竞争
|
||||
|
||||
- 页面名/URL或路由:数据源 / 查询 / 映射列表
|
||||
- 区域:筛选工具条右侧按钮组
|
||||
- 截图:[datasources-1440x900-data-02.png](./screenshots/datasources-1440x900-data-02.png)、[mappings-1440x900-data-06.png](./screenshots/mappings-1440x900-data-06.png)
|
||||
- 描述:「查询」与「新建」均为蓝色实心主按钮;「重置」为次级描边。视觉上两个同权主操作并排。
|
||||
- 为何不美观/不合理:admin 规范要求每区通常一个明确主操作;共享 `PAGE_PATTERNS` 将「新建」作为列表页右侧主操作,筛选查询不应与其同权。
|
||||
- 影响:高频「查询」与低频「新建」抢注意力,增加误点与扫读成本。
|
||||
- 建议:保留「新建」为 `type="primary"`;「查询」改为默认/次级,或「查询」用 primary、「新建」用 plain/default(二选一,全站统一)。与今日早前数据源专项评审 UI-03 同族问题。
|
||||
- 优先级:P2
|
||||
- 判断类型:客观(对照 admin 操作层级 + PAGE_PATTERNS P1)
|
||||
- 验证状态:VERIFIED_BROWSER
|
||||
- 依据:多页截图;`admin-review.md` 操作层级;`PAGE_PATTERNS.md` P1
|
||||
|
||||
### UI-03 报警列表「对象」列展示原始 identity 串
|
||||
|
||||
- 页面名/URL或路由:报警列表,`/#/alarms`
|
||||
- 区域:表格「对象」列
|
||||
- 截图:[alarms-1440x900-data-07.png](./screenshots/alarms-1440x900-data-07.png)
|
||||
- 描述:对象单元格显示类似 `identity:v1:{"serial":"DEMO-…"}` 的技术串,而非可读对象编号。
|
||||
- 为何不美观/不合理:现场/值班扫读需要稳定、短、可比较的对象标识;原始序列化串抬高行高、阻碍纵向比较,也不利于口述与交接。
|
||||
- 影响:定位对象变慢;与「场景」中文名形成强烈反差,降低整表专业可信度。
|
||||
- 建议:列表默认展示解析后的 `serial`(或业务对象号);完整 identity 放详情或 Tooltip;列宽按短标识优化。
|
||||
- 优先级:P1
|
||||
- 判断类型:客观(对照 admin 表格「服务比较与决策」与工业值班扫读场景)
|
||||
- 验证状态:VERIFIED_BROWSER
|
||||
- 依据:真实库三条报警截图;`admin-review.md` 表格原则
|
||||
|
||||
### UI-04 报警筛选控件过多,首行拥挤
|
||||
|
||||
- 页面名/URL或路由:报警列表,`/#/alarms`
|
||||
- 区域:筛选工具条
|
||||
- 截图:[alarms-1440x900-data-07.png](./screenshots/alarms-1440x900-data-07.png)
|
||||
- 描述:单行容纳模块、场景名称、对象编号、起止时间、状态 + 查询/重置,控件密集,时间字段文案偏长。
|
||||
- 为何不美观/不合理:共享筛选模式默认单行、搜索约 16rem;工业后台允许密度,但应保证可扫读与可点目标。当前条件与操作挤在同一视觉带。
|
||||
- 影响:窄于 1440 时易换行错乱或误触;新手难判断「默认筛什么」。
|
||||
- 建议:默认露出状态 + 场景 + 时间范围;其余进「更多筛选」;或两行:条件一行、操作右对齐一行。保持「点查询才请求」约定。
|
||||
- 优先级:P2
|
||||
- 判断类型:主观(对照 PAGE_PATTERNS P2 + 值班筛选效率)
|
||||
- 验证状态:VERIFIED_BROWSER
|
||||
- 依据:报警列表截图;`PAGE_PATTERNS.md` P2
|
||||
|
||||
### UI-05 报警详情摘要键值层级弱,处理人呈 UUID
|
||||
|
||||
- 页面名/URL或路由:报警详情,`/#/alarms/:id`
|
||||
- 区域:摘要栅格、页脚
|
||||
- 截图:[alarm-detail-1440x900-data-10.png](./screenshots/alarm-detail-1440x900-data-10.png)
|
||||
- 描述:摘要为多列表格式键值;标签与值字重/颜色接近。「当前处理人」为长 UUID;对象仍为 identity 原文。已关闭态页脚仅「返回列表」(符合只读,合理)。
|
||||
- 为何不美观/不合理:详情页应先回答状态、场景、对象、时间线;次要技术字段应降权或分组。UUID 对人名不可读。
|
||||
- 影响:接手交接与复核变慢;关键字段淹没在同权网格中。
|
||||
- 建议:顶部状态条(状态 + 场景 + 可读对象);时间字段分组;处理人映射显示名(无则显示「未知用户」+ 截断 id);identity 折叠。
|
||||
- 优先级:P2
|
||||
- 判断类型:主观(对照 admin 详情信息架构 + 值班交接场景)
|
||||
- 验证状态:VERIFIED_BROWSER
|
||||
- 依据:详情截图;`docs/current/frontend-ui.md` 详情/页脚约定(页脚居中返回符合)
|
||||
|
||||
### UI-06 查询列表「数据源」列偏技术标识 / UUID
|
||||
|
||||
- 页面名/URL或路由:查询列表,`/#/queries`
|
||||
- 区域:表格「数据源」列
|
||||
- 截图:[queries-1440x900-data-05.png](./screenshots/queries-1440x900-data-05.png)
|
||||
- 描述:部分行数据源显示短名(如 demo),部分为 UUID 形态长串,列宽被技术 id 拉伸。
|
||||
- 为何不美观/不合理:列表应优先展示数据源**名称**;内部 id 留给详情或次要列。
|
||||
- 影响:比较与筛选心智被 id 干扰;与「名称」列的中文说明风格不一致。
|
||||
- 建议:绑定展示 `datasource.name`;悬停/详情给 id。
|
||||
- 优先级:P2
|
||||
- 判断类型:客观(对照表格「关键列靠前、便于扫读」)
|
||||
- 验证状态:VERIFIED_BROWSER
|
||||
- 依据:查询列表截图
|
||||
|
||||
### UI-07 键盘焦点可见性仍偏弱(仅主色 1px inset)
|
||||
|
||||
- 页面名/URL或路由:数据源列表筛选
|
||||
- 区域:名称输入
|
||||
- 截图:[datasources-1440x900-keyboard-focus-03.png](./screenshots/datasources-1440x900-keyboard-focus-03.png);样式见 [focus-styles.json](./focus-styles.json)
|
||||
- 描述:真实 Tab 聚焦后 computed:`outline: 3px none …`,`boxShadow: rgb(2, 132, 199) 0 0 0 1px inset`。相对早前灰边已改为 D41 主色,但仍只有 1px inset、无外环。
|
||||
- 为何不美观/不合理:工业后台高频键盘操作需要即时可辨当前位置;仅颜色 1px 变化在明亮背景下不够稳。
|
||||
- 影响:连续 Tab 时仍可能丢焦点位置。
|
||||
- 建议:在 token / EP 桥接层统一 `:focus-visible`:2px 主色外环或加粗 inset + 轻微外扩,不单靠色相。
|
||||
- 优先级:P2
|
||||
- 判断类型:客观(可测样式 + 键盘可用性)
|
||||
- 验证状态:VERIFIED_INTERACTION
|
||||
- 依据:`focus-styles.json`;admin 键盘焦点要求;与 `2026-11-19-watchman-admin` UI-01 对照(有改善未闭环)
|
||||
|
||||
### UI-08 登录壳与业务壳组件语言不一致(可接受但需收敛)
|
||||
|
||||
- 页面名/URL或路由:登录页
|
||||
- 区域:整页
|
||||
- 截图:[login-1440x900-default-01.png](./screenshots/login-1440x900-default-01.png)
|
||||
- 描述:登录页为品牌向自定义布局(大标题「让异常被看见」、图表底景、自研按钮);登录成功后进入 Element Plus 管理壳。暗色登录另见 `login-1280x800-dark-03.png`。
|
||||
- 为何不美观/不合理:品牌登录可以强视觉;但控件态、圆角、焦点与业务壳若长期分叉,会增加维护与无障碍成本。公司管理台默认亮色简洁,登录可例外,但 EP 规则要求管理台勿混第二套主控件语言。
|
||||
- 影响:短期可接受;长期主题/焦点/校验样式可能双轨。
|
||||
- 建议:保留品牌构图;表单控件逐步映射到同一 token(含 focus);业务壳内禁止再引入登录页那套 `btn-primary` 工具类。
|
||||
- 优先级:P3
|
||||
- 判断类型:主观
|
||||
- 验证状态:VERIFIED_BROWSER
|
||||
- 依据:登录与壳层截图对比;`element-admin-ui.mdc`;`visual-ux` 管理台默认亮
|
||||
|
||||
## 正向观察(非 finding)
|
||||
|
||||
- 侧栏品牌 + 底栏「已登录 / 退出」符合 `docs/current/frontend-ui.md`。
|
||||
- 面包屑「预警平台 / 模块」且无重复大标题,符合本地约定。
|
||||
- 数据源筛选无匹配空态文案清晰(「没有符合条件的数据源」+ 重置提示):[datasources-1440x900-empty-filter-04.png](./screenshots/datasources-1440x900-empty-filter-04.png)。
|
||||
- 列表页整页不滚、表体/分页分区稳定(`viewport-metrics.json`)。
|
||||
- 报警状态色(待处理 / 已关闭)可辨,不只靠颜色词。
|
||||
- 登录提交中按钮呈「登录中」禁用,防重复提交有反馈。
|
||||
|
||||
## NOT_RUN
|
||||
|
||||
- 生产大屏 / HMI:仓库无对应交付面
|
||||
- 业务页暗色主题完整巡检
|
||||
- 新建/编辑长表单、停用确认框、报警接手/关闭写路径(未授权写操作)
|
||||
- 接口错误 / 超时 / 无权限页
|
||||
- 760px 移动断面(公司 visual-ux 要求;工业后台本轮以桌面为主)
|
||||
- 无障碍专项(axe / 完整键盘环)
|
||||
|
||||
## 修复跟踪(2026-11-19 用户确认后)
|
||||
|
||||
| ID | 处置 |
|
||||
|---|---|
|
||||
| UI-01 | 按用户指示暂不改(概览占位) |
|
||||
| UI-02 | 已修:列表「查询」降为默认按钮,「新建」保留 primary |
|
||||
| UI-03 | 已修:`formatIdentityLabel` 列表展示 serial |
|
||||
| UI-04 | 已修:默认状态/场景/时间;模块与对象进「更多筛选」 |
|
||||
| UI-05 | 已修:详情首屏状态/场景/对象;处理人 UUID 截断;原文降级 |
|
||||
| UI-06 | 已修:查询列表分页拉全量数据源名称映射 |
|
||||
| UI-07 | 已修:`element-theme.css` 焦点外环 |
|
||||
| UI-08 | 按用户指示暂不改 |
|
||||
|
||||
## 优化建议(剩余)
|
||||
|
||||
1. **概览工作台化**(UI-01):待处理报警 + 快捷入口(占位阶段可延后)。
|
||||
2. **登录/壳 token 对齐**(UI-08):不改品牌叙事,只收敛控件态。
|
||||
|
||||
## 环境备注
|
||||
|
||||
- 数据源约 387 条,大量 `mapping-ds-*` 合成名,属本地数据卫生问题,不记产品 UI 缺陷;正式演示前建议清理或加「仅启用 / 非合成」默认筛。
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"home": {
|
||||
"innerWidth": 1440,
|
||||
"innerHeight": 900,
|
||||
"scrollHeight": 900,
|
||||
"clientHeight": 900,
|
||||
"bodyScroll": true
|
||||
},
|
||||
"datasources": {
|
||||
"innerWidth": 1440,
|
||||
"innerHeight": 900,
|
||||
"scrollHeight": 900,
|
||||
"clientHeight": 900,
|
||||
"bodyScroll": true
|
||||
},
|
||||
"queries": {
|
||||
"innerWidth": 1440,
|
||||
"innerHeight": 900,
|
||||
"scrollHeight": 900,
|
||||
"clientHeight": 900,
|
||||
"bodyScroll": true
|
||||
},
|
||||
"mappings": {
|
||||
"innerWidth": 1440,
|
||||
"innerHeight": 900,
|
||||
"scrollHeight": 900,
|
||||
"clientHeight": 900,
|
||||
"bodyScroll": true
|
||||
},
|
||||
"alarms": {
|
||||
"innerWidth": 1440,
|
||||
"innerHeight": 900,
|
||||
"scrollHeight": 900,
|
||||
"clientHeight": 900,
|
||||
"bodyScroll": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"dsButtons": {
|
||||
"search": {
|
||||
"testId": "datasource-filter-search",
|
||||
"classes": "el-button",
|
||||
"isPrimary": false
|
||||
},
|
||||
"create": {
|
||||
"testId": "datasource-create",
|
||||
"classes": "el-button el-button--primary",
|
||||
"isPrimary": true
|
||||
}
|
||||
},
|
||||
"qButtons": {
|
||||
"search": {
|
||||
"testId": "query-filter-search",
|
||||
"classes": "el-button",
|
||||
"isPrimary": false
|
||||
},
|
||||
"create": {
|
||||
"testId": "query-create",
|
||||
"classes": "el-button el-button--primary",
|
||||
"isPrimary": true
|
||||
}
|
||||
},
|
||||
"focusStyles": {
|
||||
"outline": "3px none rgb(15, 23, 42)",
|
||||
"boxShadow": "rgb(2, 132, 199) 0px 0px 0px 1px inset, oklab(0.587604 -0.0652444 -0.122562 / 0.28) 0px 0px 0px 3px"
|
||||
},
|
||||
"dsCellSample": "demo-alarm-ds-3231b644",
|
||||
"alarms": {
|
||||
"moreVisible": true,
|
||||
"moduleHiddenBeforeMore": true,
|
||||
"moduleVisibleAfterMore": true,
|
||||
"objectText": "DEMO-298ce536",
|
||||
"objectTitle": "identity:v1:{\"serial\":\"DEMO-298ce536\"}",
|
||||
"identityText": "DEMO-298ce536",
|
||||
"identityTitle": "identity:v1:{\"serial\":\"DEMO-298ce536\"}",
|
||||
"handlerText": "eb4c9494…"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
# UI Recheck — Watchman 控制台(修复后)
|
||||
|
||||
## 范围与条件
|
||||
|
||||
- 对照:`docs/evidence/ui-review/2026-11-19-console-full/report.md` 中 UI-02~UI-07(UI-01 / UI-08 按用户指示不改)
|
||||
- 页面分类:`admin`
|
||||
- 环境:本地 API + Vite `127.0.0.1:5173`;真实 Casdoor 登录;Playwright Chromium
|
||||
- 视口:`1440×900`
|
||||
- 数据边界:本地库真实/演示数据;只读浏览
|
||||
- 证据:`screenshots/` + `recheck-notes.json`
|
||||
|
||||
## 方法
|
||||
|
||||
设计复评(非完整 E2E 断言、非像素基线)。对修复点做 DOM/样式/截图核对。
|
||||
|
||||
## 总评
|
||||
|
||||
**已修项均在真实登录界面上成立。** UI-02~UI-07 无明显回退。概览仍为空壳(UI-01 占位)、登录壳未动(UI-08),符合约定。未发现新的 `P0`/`P1`。
|
||||
|
||||
## Finding 闭环对照
|
||||
|
||||
| ID | 原优先级 | 复评结果 | 证据 |
|
||||
|---|---|---|---|
|
||||
| UI-02 | P2 | **CLOSED**:「查询」非 primary,「新建」为 primary(数据源/查询) | `recheck-notes.json` `dsButtons`/`qButtons`;`datasources-*-02.png`、`queries-*-04.png` |
|
||||
| UI-03 | P1 | **CLOSED**:对象列显示 `DEMO-298ce536`,title 保留完整 identity | `alarms-*-default-06.png`;notes.objectText/Title |
|
||||
| UI-04 | P2 | **CLOSED**:默认无模块/对象;点「更多筛选」后出现 | `alarms-*-default-06.png`、`alarms-*-more-07.png`;notes.moduleHidden/Visible |
|
||||
| UI-05 | P2 | **CLOSED**:详情首屏状态/场景/对象;处理人 `eb4c9494…`;原文次行 | `alarm-detail-*-08.png`;notes.identity/handler |
|
||||
| UI-06 | P2 | **CLOSED**:查询「数据源」列样例为名称 `demo-alarm-ds-3231b644`(非 UUID) | `queries-*-04.png`;notes.dsCellSample |
|
||||
| UI-07 | P2 | **CLOSED**:焦点 `box-shadow` 含 1px inset + 3px 外环(主色) | `datasources-*-focus-03.png`;notes.focusStyles |
|
||||
| UI-01 | P2 | **DEFERRED**(占位,用户要求不改) | `home-*-01.png` |
|
||||
| UI-08 | P3 | **DEFERRED**(用户要求不改) | — |
|
||||
|
||||
## 残余观察(非回归,可选后续)
|
||||
|
||||
### R1 数据源表右缘 fixed 列叠影(既有观感)
|
||||
|
||||
- 截图:`datasources-1440x900-02.png`
|
||||
- 描述:`最近测试` / `操作` 固定列附近偶发白条叠层感。
|
||||
- 优先级:P3;判断:主观;验证:SCREENSHOT_ONLY
|
||||
- 建议:单独查 `ElTable` fixed + 横向滚动样式,不纳入本轮修复验收失败。
|
||||
|
||||
### R2 已关闭状态灰标签对比偏弱
|
||||
|
||||
- 截图:`alarms-1440x900-default-06.png`
|
||||
- 描述:「已关闭 · 误报」浅灰底浅灰字,扫读弱于「待处理」。
|
||||
- 优先级:P3;判断:主观;验证:VERIFIED_BROWSER
|
||||
- 建议:关闭态可用更深 `info` 或增加图标形状区分。
|
||||
|
||||
## NOT_RUN
|
||||
|
||||
- 写操作(停用/接手/关闭)
|
||||
- 业务页完整暗色巡检
|
||||
- 760px 移动断面
|
||||
- HMI / 大屏
|
||||
|
||||
## 结论与建议
|
||||
|
||||
1. **本轮修复可验收通过**(UI-02~UI-07)。
|
||||
2. 用户确认后可收口任务或排 R1/R2 / UI-01 / UI-08。
|
||||
3. 口令勿入库;截图含显示名,外传请遮蔽。
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
|
||||
## 当前快照
|
||||
|
||||
- 当前阶段:M06 **DONE_LOCAL**。
|
||||
- 当前阶段:M06 **DONE_LOCAL**。侧线控制台 UI 评审修复(UI-02~UI-07)已关闭;UI-01/UI-08 仍延后。
|
||||
- 当前大任务:M06 已关闭。下一步是 M07,尚未开工。
|
||||
- 用户授权:D32–D40。本任务 `gatePolicy.selected=autonomous`。用户已确认最终批准、提交并推送。
|
||||
- Git:候选提交 `47d3b85`(本台账绑定见后续 docs 提交)。
|
||||
- 用户授权:D32–D40。UI 侧线 `gatePolicy.selected=autonomous`;用户已确认最终批准、提交并推送。
|
||||
- Git:见本轮 push 后 commit(控制台可读性/按钮层级/焦点/报警筛选)。
|
||||
- 下一步:M07 开工前另确认。
|
||||
|
||||
## 大任务状态
|
||||
|
||||
@@ -477,7 +477,9 @@
|
||||
"forbidden": "No permission to view alarms",
|
||||
"objectInvalid": "The object id must be a full id",
|
||||
"timeOrder": "The start time cannot be later than the end time",
|
||||
"resultSep": " · "
|
||||
"resultSep": " · ",
|
||||
"moreFilters": "More filters",
|
||||
"fewerFilters": "Fewer filters"
|
||||
},
|
||||
"columns": {
|
||||
"module": "Module",
|
||||
|
||||
@@ -477,7 +477,9 @@
|
||||
"forbidden": "ไม่มีสิทธิ์ดูการแจ้งเตือน",
|
||||
"objectInvalid": "รหัสวัตถุต้องเป็นรหัสเต็ม",
|
||||
"timeOrder": "เวลาเริ่มต้องไม่ช้ากว่าเวลาสิ้นสุด",
|
||||
"resultSep": " · "
|
||||
"resultSep": " · ",
|
||||
"moreFilters": "ตัวกรองเพิ่มเติม",
|
||||
"fewerFilters": "ย่อตัวกรอง"
|
||||
},
|
||||
"columns": {
|
||||
"module": "โมดูล",
|
||||
|
||||
@@ -478,7 +478,9 @@
|
||||
"forbidden": "没有查看报警的权限",
|
||||
"objectInvalid": "对象编号需要是完整的编号",
|
||||
"timeOrder": "开始时间不能晚于结束时间",
|
||||
"resultSep": " · "
|
||||
"resultSep": " · ",
|
||||
"moreFilters": "更多筛选",
|
||||
"fewerFilters": "收起筛选"
|
||||
},
|
||||
"columns": {
|
||||
"module": "模块",
|
||||
|
||||
@@ -477,7 +477,9 @@
|
||||
"forbidden": "沒有查看警報的權限",
|
||||
"objectInvalid": "物件編號需要是完整的編號",
|
||||
"timeOrder": "開始時間不能晚於結束時間",
|
||||
"resultSep": " · "
|
||||
"resultSep": " · ",
|
||||
"moreFilters": "更多篩選",
|
||||
"fewerFilters": "收起篩選"
|
||||
},
|
||||
"columns": {
|
||||
"module": "模組",
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* UI review evidence capture. Credentials via env only; never log password.
|
||||
* WATCHMAN_UI_USER / WATCHMAN_UI_PASSWORD
|
||||
*/
|
||||
import { chromium } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const user = process.env.WATCHMAN_UI_USER;
|
||||
const password = process.env.WATCHMAN_UI_PASSWORD;
|
||||
if (!user || !password) {
|
||||
console.error("Missing WATCHMAN_UI_USER or WATCHMAN_UI_PASSWORD");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../../");
|
||||
const outDir = path.join(root, "docs/evidence/ui-review/2026-11-19-console-full/screenshots");
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
|
||||
const routes = [
|
||||
{ key: "home", path: "/#/" },
|
||||
{ key: "datasources", path: "/#/datasources" },
|
||||
{ key: "queries", path: "/#/queries" },
|
||||
{ key: "mappings", path: "/#/mappings" },
|
||||
{ key: "alarms", path: "/#/alarms" },
|
||||
];
|
||||
|
||||
const viewports = [
|
||||
{ name: "1440x900", width: 1440, height: 900 },
|
||||
{ name: "1280x800", width: 1280, height: 800 },
|
||||
];
|
||||
|
||||
async function login(page) {
|
||||
await page.goto("http://127.0.0.1:5173/", { waitUntil: "networkidle" });
|
||||
await page.getByTestId("login-username").locator("input").fill(user);
|
||||
await page.getByTestId("login-password").locator("input").fill(password);
|
||||
await page.getByTestId("login-submit").click();
|
||||
await page.getByTestId("logout").waitFor({ timeout: 20000 });
|
||||
}
|
||||
|
||||
async function shot(page, name) {
|
||||
await page.waitForTimeout(400);
|
||||
await page.screenshot({ path: path.join(outDir, name), fullPage: false });
|
||||
}
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
||||
await page.setViewportSize(viewports[0]);
|
||||
await login(page);
|
||||
await shot(page, "home-1440x900-data-01.png");
|
||||
|
||||
// keyboard focus on home then datasources filter
|
||||
await page.goto("http://127.0.0.1:5173/#/datasources", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await shot(page, "datasources-1440x900-data-02.png");
|
||||
|
||||
const nameFilter = page.getByTestId("datasource-filter-name").locator("input");
|
||||
if (await nameFilter.count()) {
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
// focus name filter explicitly via real Tab from a known start
|
||||
await page.locator("body").click({ position: { x: 5, y: 5 } });
|
||||
for (let i = 0; i < 12; i++) {
|
||||
await page.keyboard.press("Tab");
|
||||
const active = await page.evaluate(() => {
|
||||
const el = document.activeElement;
|
||||
return {
|
||||
tag: el?.tagName,
|
||||
testid: el?.closest("[data-testid]")?.getAttribute("data-testid") || null,
|
||||
placeholder: el?.getAttribute("placeholder"),
|
||||
};
|
||||
});
|
||||
if (active.testid === "datasource-filter-name" || active.placeholder === "名称") {
|
||||
await shot(page, "datasources-1440x900-keyboard-focus-03.png");
|
||||
const styles = await page.evaluate(() => {
|
||||
const el = document.activeElement;
|
||||
const wrap = el?.closest(".el-input__wrapper") || el;
|
||||
const cs = getComputedStyle(wrap);
|
||||
return { outline: cs.outline, boxShadow: cs.boxShadow, borderColor: cs.borderColor };
|
||||
});
|
||||
fs.writeFileSync(
|
||||
path.join(outDir, "..", "focus-styles.json"),
|
||||
JSON.stringify(styles, null, 2),
|
||||
"utf8",
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await nameFilter.fill("__no_match_ui_review__");
|
||||
await page.getByRole("button", { name: "查询" }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await shot(page, "datasources-1440x900-empty-filter-04.png");
|
||||
await page.getByRole("button", { name: "重置" }).click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/queries", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await shot(page, "queries-1440x900-data-05.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/mappings", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await shot(page, "mappings-1440x900-data-06.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/alarms", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await shot(page, "alarms-1440x900-data-07.png");
|
||||
|
||||
// second viewport sweep
|
||||
await page.setViewportSize(viewports[1]);
|
||||
for (const r of routes) {
|
||||
await page.goto(`http://127.0.0.1:5173${r.path}`, { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
await shot(page, `${r.key}-1280x800-data-08.png`.replace("data-08", `data-${r.key}-08`));
|
||||
}
|
||||
|
||||
// open first datasource detail if row exists
|
||||
await page.setViewportSize(viewports[0]);
|
||||
await page.goto("http://127.0.0.1:5173/#/datasources", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
const openBtn = page.getByRole("button", { name: "打开" }).first();
|
||||
if (await openBtn.count()) {
|
||||
await openBtn.click();
|
||||
await page.waitForTimeout(700);
|
||||
await shot(page, "datasource-detail-1440x900-data-09.png");
|
||||
}
|
||||
|
||||
const alarmOpen = page.locator("a, button").filter({ hasText: /打开|详情/ }).first();
|
||||
await page.goto("http://127.0.0.1:5173/#/alarms", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
const alarmRowOpen = page.getByRole("button", { name: "打开" }).first();
|
||||
if (await alarmRowOpen.count()) {
|
||||
await alarmRowOpen.click();
|
||||
await page.waitForTimeout(700);
|
||||
await shot(page, "alarm-detail-1440x900-data-10.png");
|
||||
}
|
||||
|
||||
// scroll metrics
|
||||
const metrics = {};
|
||||
for (const r of routes) {
|
||||
await page.goto(`http://127.0.0.1:5173${r.path}`, { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(300);
|
||||
metrics[r.key] = await page.evaluate(() => ({
|
||||
innerWidth: window.innerWidth,
|
||||
innerHeight: window.innerHeight,
|
||||
scrollHeight: document.documentElement.scrollHeight,
|
||||
clientHeight: document.documentElement.clientHeight,
|
||||
bodyScroll: document.body.scrollHeight === document.body.clientHeight,
|
||||
}));
|
||||
}
|
||||
fs.writeFileSync(path.join(outDir, "..", "viewport-metrics.json"), JSON.stringify(metrics, null, 2), "utf8");
|
||||
|
||||
await browser.close();
|
||||
console.log("capture complete");
|
||||
@@ -0,0 +1,22 @@
|
||||
import { chromium } from "@playwright/test";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../../");
|
||||
const outDir = path.join(root, "docs/evidence/ui-review/2026-11-19-console-full/screenshots");
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
||||
await page.goto("http://127.0.0.1:5173/", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
await page.screenshot({ path: path.join(outDir, "login-1440x900-default-01.png"), fullPage: true });
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
await page.screenshot({ path: path.join(outDir, "login-1280x800-default-02.png"), fullPage: true });
|
||||
const theme = page.getByRole("button", { name: "切换昼夜" });
|
||||
if (await theme.count()) {
|
||||
await theme.click();
|
||||
await page.waitForTimeout(400);
|
||||
await page.screenshot({ path: path.join(outDir, "login-1280x800-dark-03.png"), fullPage: true });
|
||||
}
|
||||
await browser.close();
|
||||
console.log("login screenshots ok");
|
||||
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Post-fix UI recheck. Credentials via env only.
|
||||
* WATCHMAN_UI_USER / WATCHMAN_UI_PASSWORD
|
||||
*/
|
||||
import { chromium } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const user = process.env.WATCHMAN_UI_USER;
|
||||
const password = process.env.WATCHMAN_UI_PASSWORD;
|
||||
if (!user || !password) {
|
||||
console.error("Missing WATCHMAN_UI_USER or WATCHMAN_UI_PASSWORD");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../../");
|
||||
const outDir = path.join(root, "docs/evidence/ui-review/2026-11-19-console-recheck/screenshots");
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
|
||||
async function shot(page, name) {
|
||||
await page.waitForTimeout(350);
|
||||
await page.screenshot({ path: path.join(outDir, name), fullPage: false });
|
||||
}
|
||||
|
||||
async function buttonTone(page, testId) {
|
||||
const loc = page.getByTestId(testId);
|
||||
if ((await loc.count()) === 0) return null;
|
||||
return loc.evaluate((el) => ({
|
||||
testId: el.getAttribute("data-testid"),
|
||||
classes: el.className,
|
||||
isPrimary: el.classList.contains("el-button--primary"),
|
||||
}));
|
||||
}
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/", { waitUntil: "networkidle" });
|
||||
await page.getByTestId("login-username").locator("input").fill(user);
|
||||
await page.getByTestId("login-password").locator("input").fill(password);
|
||||
await page.getByTestId("login-submit").click();
|
||||
await page.getByTestId("logout").waitFor({ timeout: 20000 });
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/", { waitUntil: "networkidle" });
|
||||
await shot(page, "home-1440x900-01.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/datasources", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
const dsButtons = {
|
||||
search: await buttonTone(page, "datasource-filter-search"),
|
||||
create: await buttonTone(page, "datasource-create"),
|
||||
};
|
||||
await shot(page, "datasources-1440x900-02.png");
|
||||
|
||||
// keyboard focus on name filter
|
||||
await page.getByTestId("datasource-filter-name").locator("input").focus();
|
||||
await page.waitForTimeout(200);
|
||||
const focusStyles = await page.evaluate(() => {
|
||||
const el = document.activeElement;
|
||||
const wrap = el?.closest(".el-input__wrapper") || el;
|
||||
const cs = getComputedStyle(wrap);
|
||||
return { outline: cs.outline, boxShadow: cs.boxShadow };
|
||||
});
|
||||
await shot(page, "datasources-1440x900-focus-03.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/queries", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(800);
|
||||
const qButtons = {
|
||||
search: await buttonTone(page, "query-filter-search"),
|
||||
create: await buttonTone(page, "query-create"),
|
||||
};
|
||||
const dsCellSample = await page.locator("[data-testid=query-table] tbody tr").first().locator("td").nth(1).innerText().catch(() => "");
|
||||
await shot(page, "queries-1440x900-04.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/mappings", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(500);
|
||||
await shot(page, "mappings-1440x900-05.png");
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/#/alarms", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(600);
|
||||
const moreVisible = await page.getByTestId("alarm-filter-more").isVisible();
|
||||
const moduleHidden = (await page.getByTestId("alarm-filter-module").count()) === 0;
|
||||
await shot(page, "alarms-1440x900-default-06.png");
|
||||
await page.getByTestId("alarm-filter-more").click();
|
||||
await page.waitForTimeout(200);
|
||||
const moduleVisible = await page.getByTestId("alarm-filter-module").isVisible();
|
||||
await shot(page, "alarms-1440x900-more-07.png");
|
||||
|
||||
const objectText = await page.locator("[data-testid=alarm-object-label]").first().innerText().catch(() => "");
|
||||
const objectTitle = await page.locator("[data-testid=alarm-object-label]").first().getAttribute("title").catch(() => "");
|
||||
|
||||
await page.getByTestId("alarm-open").first().click();
|
||||
await page.waitForTimeout(700);
|
||||
const identityText = await page.getByTestId("alarm-identity").innerText().catch(() => "");
|
||||
const identityTitle = await page.getByTestId("alarm-identity").getAttribute("title").catch(() => "");
|
||||
const handlerText = await page.getByTestId("alarm-handler").innerText().catch(() => "");
|
||||
await shot(page, "alarm-detail-1440x900-08.png");
|
||||
|
||||
const notes = {
|
||||
dsButtons,
|
||||
qButtons,
|
||||
focusStyles,
|
||||
dsCellSample: dsCellSample.trim(),
|
||||
alarms: {
|
||||
moreVisible,
|
||||
moduleHiddenBeforeMore: moduleHidden,
|
||||
moduleVisibleAfterMore: moduleVisible,
|
||||
objectText: objectText.trim(),
|
||||
objectTitle,
|
||||
identityText: identityText.trim(),
|
||||
identityTitle,
|
||||
handlerText: handlerText.trim(),
|
||||
},
|
||||
};
|
||||
fs.writeFileSync(path.join(outDir, "..", "recheck-notes.json"), JSON.stringify(notes, null, 2), "utf8");
|
||||
console.log(JSON.stringify(notes, null, 2));
|
||||
await browser.close();
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
} from "./actions";
|
||||
import { appendProgress, claimAlarm, closeAlarm, getAlarm, listEvidence, listHistory, listOccurrences } from "./client";
|
||||
import { describeAlarmError, isAlarmConflict, isAlarmForbidden, isAlarmNotFound } from "./errors";
|
||||
import { formatDateTime } from "./format";
|
||||
import { formatDateTime, formatHandlerLabel, formatIdentityLabel } from "./format";
|
||||
import type { AlarmRecord, ClosedBasis, EvidenceBundle, HistoryEvent, OccurrenceList } from "./types";
|
||||
|
||||
const { t, te } = useI18n();
|
||||
@@ -98,6 +98,19 @@ function textOrNone(value: string | null | undefined): string {
|
||||
return value;
|
||||
}
|
||||
|
||||
function objectLabel(identityKey: string): string {
|
||||
return formatIdentityLabel(identityKey) || t("alarm.detail.fields.none");
|
||||
}
|
||||
|
||||
function handlerDisplay(subject: string | null | undefined): { label: string; title?: string } {
|
||||
const short = formatHandlerLabel(subject);
|
||||
if (!short) {
|
||||
return { label: t("alarm.detail.fields.none") };
|
||||
}
|
||||
const full = subject?.trim() ?? short;
|
||||
return { label: short, title: full !== short ? full : undefined };
|
||||
}
|
||||
|
||||
function statusText(status: string): string {
|
||||
const key = `alarm.status.${status}`;
|
||||
return te(key) ? t(key) : status;
|
||||
@@ -393,76 +406,112 @@ onMounted(() => {
|
||||
<section class="wm-form-section" data-testid="alarm-summary">
|
||||
<h3 class="mb-3 text-[14.5px] font-semibold">{{ t("alarm.detail.summary") }}</h3>
|
||||
<dl class="grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2">
|
||||
<div class="sm:col-span-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--bg-surface-soft)] p-3">
|
||||
<div class="grid grid-cols-1 gap-3 sm:grid-cols-3">
|
||||
<div>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.status") }}</dt>
|
||||
<dd class="mt-1 font-semibold text-[var(--text-primary)]">
|
||||
<ElTag :type="statusTag(alarm.status)" effect="light" data-testid="alarm-detail-status">
|
||||
{{ statusText(alarm.status) }}
|
||||
</ElTag>
|
||||
<span v-if="alarm.close_result" class="ml-1 text-[13px] font-medium">
|
||||
{{ t("alarm.list.resultSep") }}{{ named("closeResult", alarm.close_result) }}
|
||||
</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.scenario") }}</dt>
|
||||
<dd class="mt-1 text-[15px] font-semibold text-[var(--text-primary)]">{{ alarm.scenario_name }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.object") }}</dt>
|
||||
<dd
|
||||
class="mt-1 text-[15px] font-semibold text-[var(--text-primary)]"
|
||||
data-testid="alarm-identity"
|
||||
:title="alarm.identity_key"
|
||||
>
|
||||
{{ objectLabel(alarm.identity_key) }}
|
||||
</dd>
|
||||
<p
|
||||
v-if="objectLabel(alarm.identity_key) !== alarm.identity_key"
|
||||
class="mt-0.5 truncate text-[12px] text-[var(--text-muted)]"
|
||||
data-testid="alarm-identity-raw"
|
||||
:title="alarm.identity_key"
|
||||
>
|
||||
{{ alarm.identity_key }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.status") }}</dt>
|
||||
<dd>
|
||||
<ElTag :type="statusTag(alarm.status)" effect="light" data-testid="alarm-detail-status">
|
||||
{{ statusText(alarm.status) }}
|
||||
</ElTag>
|
||||
<span v-if="alarm.close_result">
|
||||
{{ t("alarm.list.resultSep") }}{{ named("closeResult", alarm.close_result) }}
|
||||
</span>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.module") }}</dt>
|
||||
<dd class="mt-0.5 font-medium text-[var(--text-primary)]">{{ alarm.module_key }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.count") }}</dt>
|
||||
<dd class="mt-0.5 font-medium text-[var(--text-primary)]">{{ alarm.occurrence_count }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.firstOccurred") }}</dt>
|
||||
<dd class="mt-0.5 font-medium text-[var(--text-primary)]">
|
||||
{{ formatDateTime(alarm.first_occurred_at) || t("alarm.detail.fields.none") }}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.scenario") }}</dt>
|
||||
<dd>{{ alarm.scenario_name }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.lastOccurred") }}</dt>
|
||||
<dd class="mt-0.5 font-medium text-[var(--text-primary)]">
|
||||
{{ formatDateTime(alarm.last_occurred_at) || t("alarm.detail.fields.none") }}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.module") }}</dt>
|
||||
<dd>{{ alarm.module_key }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.handler") }}</dt>
|
||||
<dd
|
||||
class="mt-0.5 font-medium text-[var(--text-primary)]"
|
||||
data-testid="alarm-handler"
|
||||
:title="handlerDisplay(alarm.current_handler).title"
|
||||
>
|
||||
{{ handlerDisplay(alarm.current_handler).label }}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.scenarioKey") }}</dt>
|
||||
<dd>{{ alarm.scenario_key }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.claimedAt") }}</dt>
|
||||
<dd class="mt-0.5 font-medium text-[var(--text-primary)]">
|
||||
{{ formatDateTime(alarm.claimed_at) || t("alarm.detail.fields.none") }}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.object") }}</dt>
|
||||
<dd data-testid="alarm-identity">{{ alarm.identity_key }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.closedAt") }}</dt>
|
||||
<dd class="mt-0.5 font-medium text-[var(--text-primary)]">
|
||||
{{ formatDateTime(alarm.closed_at) || t("alarm.detail.fields.none") }}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.count") }}</dt>
|
||||
<dd>{{ alarm.occurrence_count }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.openedAt") }}</dt>
|
||||
<dd class="mt-0.5 font-medium text-[var(--text-primary)]">
|
||||
{{ formatDateTime(alarm.opened_at) || t("alarm.detail.fields.none") }}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.firstOccurred") }}</dt>
|
||||
<dd>{{ formatDateTime(alarm.first_occurred_at) || t("alarm.detail.fields.none") }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.updatedAt") }}</dt>
|
||||
<dd class="mt-0.5 font-medium text-[var(--text-primary)]">
|
||||
{{ formatDateTime(alarm.updated_at) || t("alarm.detail.fields.none") }}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.lastOccurred") }}</dt>
|
||||
<dd>{{ formatDateTime(alarm.last_occurred_at) || t("alarm.detail.fields.none") }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.scenarioKey") }}</dt>
|
||||
<dd class="mt-0.5 text-[var(--text-secondary)]">{{ alarm.scenario_key }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.handler") }}</dt>
|
||||
<dd data-testid="alarm-handler">{{ textOrNone(alarm.current_handler) }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.cycle") }}</dt>
|
||||
<dd class="mt-0.5 text-[var(--text-secondary)]">{{ textOrNone(alarm.cycle_key) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.claimedAt") }}</dt>
|
||||
<dd>{{ formatDateTime(alarm.claimed_at) || t("alarm.detail.fields.none") }}</dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.event") }}</dt>
|
||||
<dd class="mt-0.5 text-[var(--text-secondary)]">{{ textOrNone(alarm.event_key) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.closedAt") }}</dt>
|
||||
<dd>{{ formatDateTime(alarm.closed_at) || t("alarm.detail.fields.none") }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.cycle") }}</dt>
|
||||
<dd>{{ textOrNone(alarm.cycle_key) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.event") }}</dt>
|
||||
<dd>{{ textOrNone(alarm.event_key) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.openedAt") }}</dt>
|
||||
<dd>{{ formatDateTime(alarm.opened_at) || t("alarm.detail.fields.none") }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.updatedAt") }}</dt>
|
||||
<dd>{{ formatDateTime(alarm.updated_at) || t("alarm.detail.fields.none") }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-[var(--text-muted)]">{{ t("alarm.detail.fields.previous") }}</dt>
|
||||
<dd>
|
||||
<dt class="text-[12px] text-[var(--text-muted)]">{{ t("alarm.detail.fields.previous") }}</dt>
|
||||
<dd class="mt-0.5">
|
||||
<ElButton
|
||||
v-if="alarm.previous_alarm_id"
|
||||
link
|
||||
@@ -472,7 +521,7 @@ onMounted(() => {
|
||||
>
|
||||
{{ alarm.previous_alarm_id }}
|
||||
</ElButton>
|
||||
<span v-else>{{ t("alarm.detail.fields.none") }}</span>
|
||||
<span v-else class="text-[var(--text-secondary)]">{{ t("alarm.detail.fields.none") }}</span>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
emptyAlarmFilters,
|
||||
type AlarmFilterDraft,
|
||||
} from "./filters";
|
||||
import { formatDateTime } from "./format";
|
||||
import { formatDateTime, formatIdentityLabel } from "./format";
|
||||
import type { AlarmRecord } from "./types";
|
||||
|
||||
const { t, te } = useI18n();
|
||||
@@ -46,6 +46,8 @@ const total = ref(0);
|
||||
const phase = ref<"loading" | "ready" | "error" | "forbidden">("loading");
|
||||
const loadError = ref("");
|
||||
const filterIssue = ref<"object" | "time-order" | null>(null);
|
||||
/** Extra filters (module / object) stay collapsed until opened or they hold draft values. */
|
||||
const moreFiltersOpen = ref(false);
|
||||
|
||||
const draft = reactive<AlarmFilterDraft>(emptyAlarmFilters());
|
||||
const applied = reactive<AlarmFilterDraft>(emptyAlarmFilters());
|
||||
@@ -124,10 +126,19 @@ function resetFilters(): void {
|
||||
copyFilters(draft, blank);
|
||||
copyFilters(applied, blank);
|
||||
filterIssue.value = null;
|
||||
moreFiltersOpen.value = false;
|
||||
page.value = 1;
|
||||
void load();
|
||||
}
|
||||
|
||||
const moreFiltersActive = computed(
|
||||
() => draft.moduleKey.trim() !== "" || draft.objectId.trim() !== "",
|
||||
);
|
||||
|
||||
function toggleMoreFilters(): void {
|
||||
moreFiltersOpen.value = !moreFiltersOpen.value;
|
||||
}
|
||||
|
||||
function onSortChange(payload: { prop: string | null; order: string | null }): void {
|
||||
const sortable = new Set(["module_key", "scenario_name", "last_occurred_at", "status"]);
|
||||
if (!payload.prop || !payload.order || !sortable.has(payload.prop)) {
|
||||
@@ -189,15 +200,16 @@ onMounted(() => {
|
||||
<ListPageShell test-id="alarm-list">
|
||||
<template #filters>
|
||||
<div data-testid="alarm-list-toolbar" class="contents">
|
||||
<div class="w-[9rem]" data-testid="alarm-filter-module">
|
||||
<ElInput v-model="draft.moduleKey" clearable :placeholder="t('alarm.list.filterModule')" />
|
||||
<div class="w-[7.5rem]" data-testid="alarm-filter-status">
|
||||
<ElSelect v-model="draft.status" clearable class="w-full" :placeholder="t('alarm.list.filterStatus')">
|
||||
<ElOption :label="t('alarm.status.pending')" value="pending" />
|
||||
<ElOption :label="t('alarm.status.processing')" value="processing" />
|
||||
<ElOption :label="t('alarm.status.closed')" value="closed" />
|
||||
</ElSelect>
|
||||
</div>
|
||||
<div class="w-[12rem]" data-testid="alarm-filter-scenario">
|
||||
<ElInput v-model="draft.scenarioName" clearable :placeholder="t('alarm.list.filterScenario')" />
|
||||
</div>
|
||||
<div class="w-[14rem]" data-testid="alarm-filter-object">
|
||||
<ElInput v-model="draft.objectId" clearable :placeholder="t('alarm.list.filterObject')" />
|
||||
</div>
|
||||
<div class="w-[12.5rem]" data-testid="alarm-filter-from">
|
||||
<ElDatePicker
|
||||
v-model="draft.from"
|
||||
@@ -214,19 +226,24 @@ onMounted(() => {
|
||||
:placeholder="t('alarm.list.filterTo')"
|
||||
/>
|
||||
</div>
|
||||
<div class="w-[7.5rem]" data-testid="alarm-filter-status">
|
||||
<ElSelect v-model="draft.status" clearable class="w-full" :placeholder="t('alarm.list.filterStatus')">
|
||||
<ElOption :label="t('alarm.status.pending')" value="pending" />
|
||||
<ElOption :label="t('alarm.status.processing')" value="processing" />
|
||||
<ElOption :label="t('alarm.status.closed')" value="closed" />
|
||||
</ElSelect>
|
||||
</div>
|
||||
<template v-if="moreFiltersOpen">
|
||||
<div class="w-[9rem]" data-testid="alarm-filter-module">
|
||||
<ElInput v-model="draft.moduleKey" clearable :placeholder="t('alarm.list.filterModule')" />
|
||||
</div>
|
||||
<div class="w-[14rem]" data-testid="alarm-filter-object">
|
||||
<ElInput v-model="draft.objectId" clearable :placeholder="t('alarm.list.filterObject')" />
|
||||
</div>
|
||||
</template>
|
||||
<ElButton type="primary" data-testid="alarm-filter-search" @click="applyFilters">
|
||||
{{ t("alarm.list.filterSearch") }}
|
||||
</ElButton>
|
||||
<ElButton data-testid="alarm-filter-reset" @click="resetFilters">
|
||||
{{ t("alarm.list.filterReset") }}
|
||||
</ElButton>
|
||||
<ElButton data-testid="alarm-filter-more" @click="toggleMoreFilters">
|
||||
{{ moreFiltersOpen ? t("alarm.list.fewerFilters") : t("alarm.list.moreFilters") }}
|
||||
<span v-if="!moreFiltersOpen && moreFiltersActive" data-testid="alarm-filter-more-dot"> ·</span>
|
||||
</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -298,7 +315,13 @@ onMounted(() => {
|
||||
min-width="160"
|
||||
sortable="custom"
|
||||
/>
|
||||
<ElTableColumn prop="identity_key" :label="t('alarm.columns.object')" min-width="140" />
|
||||
<ElTableColumn prop="identity_key" :label="t('alarm.columns.object')" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span :title="row.identity_key" data-testid="alarm-object-label">
|
||||
{{ formatIdentityLabel(row.identity_key) }}
|
||||
</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
prop="last_occurred_at"
|
||||
:label="t('alarm.columns.lastOccurred')"
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { formatHandlerLabel, formatIdentityLabel } from "./format";
|
||||
|
||||
describe("formatIdentityLabel", () => {
|
||||
it("extracts serial from identity:v1 JSON", () => {
|
||||
expect(formatIdentityLabel('identity:v1:{"serial":"DEMO-298ce536"}')).toBe("DEMO-298ce536");
|
||||
});
|
||||
|
||||
it("falls back to the raw key when JSON is absent", () => {
|
||||
expect(formatIdentityLabel("plain-object-1")).toBe("plain-object-1");
|
||||
});
|
||||
|
||||
it("returns empty for blank input", () => {
|
||||
expect(formatIdentityLabel("")).toBe("");
|
||||
expect(formatIdentityLabel(null)).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatHandlerLabel", () => {
|
||||
it("keeps short subjects", () => {
|
||||
expect(formatHandlerLabel("26110002")).toBe("26110002");
|
||||
});
|
||||
|
||||
it("truncates UUID subjects", () => {
|
||||
expect(formatHandlerLabel("550e8400-e29b-41d4-a716-446655440000")).toBe("550e8400…");
|
||||
});
|
||||
|
||||
it("returns null for empty", () => {
|
||||
expect(formatHandlerLabel(null)).toBeNull();
|
||||
expect(formatHandlerLabel(" ")).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Alarm timestamps for tables. Empty or invalid values stay blank.
|
||||
* Boundary: display only. It does not parse filter input.
|
||||
* Depends on the browser time zone.
|
||||
* Alarm timestamps and display labels for tables/detail.
|
||||
* Boundary: display only. Does not parse filter input or call APIs.
|
||||
* Depends on the browser time zone for datetime formatting.
|
||||
*/
|
||||
|
||||
function pad(value: number): string {
|
||||
@@ -19,3 +19,58 @@ export function formatDateTime(iso: string | null | undefined): string {
|
||||
}
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
}
|
||||
|
||||
const UUID_RE =
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
|
||||
/**
|
||||
* Prefer a short object id (e.g. serial) from identity keys like
|
||||
* `identity:v1:{"serial":"DEMO-1"}`. Falls back to the raw key when unknown.
|
||||
*/
|
||||
export function formatIdentityLabel(identityKey: string | null | undefined): string {
|
||||
if (!identityKey) {
|
||||
return "";
|
||||
}
|
||||
const raw = identityKey.trim();
|
||||
if (!raw) {
|
||||
return "";
|
||||
}
|
||||
const jsonStart = raw.indexOf("{");
|
||||
if (jsonStart >= 0) {
|
||||
try {
|
||||
const parsed = JSON.parse(raw.slice(jsonStart)) as unknown;
|
||||
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
||||
const record = parsed as Record<string, unknown>;
|
||||
for (const key of ["serial", "id", "code", "name"]) {
|
||||
const value = record[key];
|
||||
if (typeof value === "string" && value.trim()) {
|
||||
return value.trim();
|
||||
}
|
||||
}
|
||||
for (const value of Object.values(record)) {
|
||||
if (typeof value === "string" && value.trim()) {
|
||||
return value.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// keep raw
|
||||
}
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
/** Short label for handler subjects; full value stays available via title. */
|
||||
export function formatHandlerLabel(subject: string | null | undefined): string | null {
|
||||
if (subject === null || subject === undefined) {
|
||||
return null;
|
||||
}
|
||||
const value = subject.trim();
|
||||
if (!value) {
|
||||
return null;
|
||||
}
|
||||
if (UUID_RE.test(value)) {
|
||||
return `${value.slice(0, 8)}…`;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ onMounted(load);
|
||||
<ElOption :label="t('datasource.status.disabled')" value="disabled" />
|
||||
</ElSelect>
|
||||
</div>
|
||||
<ElButton type="primary" data-testid="datasource-filter-search" @click="applyFilters">
|
||||
<ElButton data-testid="datasource-filter-search" @click="applyFilters">
|
||||
{{ t("datasource.list.filterSearch") }}
|
||||
</ElButton>
|
||||
<ElButton data-testid="datasource-filter-reset" @click="resetFilters">
|
||||
|
||||
@@ -110,7 +110,7 @@ onMounted(() => {
|
||||
<div class="w-[12rem]">
|
||||
<ElInput v-model="query" clearable placeholder="查询" />
|
||||
</div>
|
||||
<ElButton type="primary" @click="applyFilters">查询</ElButton>
|
||||
<ElButton @click="applyFilters">查询</ElButton>
|
||||
<ElButton @click="resetFilters">重置</ElButton>
|
||||
<div class="ml-auto">
|
||||
<ElButton type="primary" @click="openCreate">新建</ElButton>
|
||||
|
||||
@@ -62,9 +62,23 @@ const switchError = ref("");
|
||||
|
||||
async function loadOptions(): Promise<void> {
|
||||
try {
|
||||
// Option lists need a wide page; not the table page size.
|
||||
const sources = await listDatasources({ page: 1, page_size: 100, sort_by: "name", sort_order: "asc" });
|
||||
datasources.value = sources.items;
|
||||
// Name map + filter options: page through the datasource API (max 100/page).
|
||||
const all: Datasource[] = [];
|
||||
let pageNo = 1;
|
||||
for (;;) {
|
||||
const sources = await listDatasources({
|
||||
page: pageNo,
|
||||
page_size: 100,
|
||||
sort_by: "name",
|
||||
sort_order: "asc",
|
||||
});
|
||||
all.push(...sources.items);
|
||||
if (all.length >= sources.total || sources.items.length === 0 || pageNo > 50) {
|
||||
break;
|
||||
}
|
||||
pageNo += 1;
|
||||
}
|
||||
datasources.value = all;
|
||||
} catch {
|
||||
datasources.value = [];
|
||||
}
|
||||
@@ -235,7 +249,7 @@ onMounted(async () => {
|
||||
<ElOption :label="t('query.status.disabled')" value="disabled" />
|
||||
</ElSelect>
|
||||
</div>
|
||||
<ElButton type="primary" data-testid="query-filter-search" @click="applyFilters">
|
||||
<ElButton data-testid="query-filter-search" @click="applyFilters">
|
||||
{{ t("query.list.filterSearch") }}
|
||||
</ElButton>
|
||||
<ElButton data-testid="query-filter-reset" @click="resetFilters">
|
||||
|
||||
@@ -54,3 +54,23 @@ html.dark {
|
||||
flex: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/*
|
||||
* Keyboard focus: EP default inset can be a 1px hue-only change.
|
||||
* Add a visible outer ring (color + shape) without fighting page styles.
|
||||
*/
|
||||
.el-input__wrapper.is-focus,
|
||||
.el-textarea__inner:focus,
|
||||
.el-select__wrapper.is-focused,
|
||||
.el-date-editor.el-input__wrapper.is-focus {
|
||||
box-shadow:
|
||||
0 0 0 1px var(--el-color-primary) inset,
|
||||
0 0 0 3px color-mix(in srgb, var(--el-color-primary) 28%, transparent) !important;
|
||||
}
|
||||
|
||||
.el-button:focus-visible,
|
||||
.el-pager li:focus-visible,
|
||||
.el-pagination button:focus-visible {
|
||||
outline: 2px solid var(--el-color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
Reference in new issue
Block a user