Commit bc30638
authored
fix(inference): official legend X works with overlay loaded + explicit hide/show affordances / 修复叠加层下图例移除按钮并明确隐藏/恢复操作提示 (#597)
* fix(inference): make official legend X work while an unofficial overlay is loaded
With an unofficial-run overlay active, the chart reads official series
visibility from `localOfficialOverride` (the unified overlay-mode selection),
but the legend's "X" (remove) button routed straight to InferenceContext's
`removeHwType`, which mutates `activeHwTypes` — a set the chart ignores in
overlay mode. Clicking an official SKU's X therefore appeared to do nothing,
while the same click worked on official-only charts. The legend row TOGGLE
already had the overlay-aware split (`unifiedToggle` → commitUnifiedSelection);
the X now shares it: `handleRemoveHwType` commits the removal through the
unified selection when an overlay is loaded and delegates to the context's
`removeHwType` otherwise. Context state stays untouched in overlay mode, so
dismissing the overlay restores the pre-overlay official selection — same
semantics as the toggle path.
Also lifts the overlay e2e fixtures (real run-29682242847 values, intercepts,
countVisible) into cypress/support/overlay-fixtures.ts, shared by the existing
overlay-optimal-only spec and the new overlay-legend-remove regression spec
(which fails without the fix). Assertions in both specs now use retryable
`.should()` callbacks — the dots' 150ms opacity transition made one-shot
`.then()` counts racy.
中文:修复加载非官方运行叠加层时,图例中官方 SKU 的"X"(移除)按钮无效的问题。
叠加层激活时图表从 `localOfficialOverride`(叠加模式的统一选择集)读取官方系列
可见性,而图例的 X 按钮直接调用 InferenceContext 的 `removeHwType` 修改
`activeHwTypes`——该集合在叠加模式下被图表忽略,因此点击官方 SKU 的 X 看似无效,
而在纯官方图表上正常。图例行的切换(toggle)已有叠加感知分支(`unifiedToggle`),
现在 X 与其共用:加载叠加层时 `handleRemoveHwType` 通过统一选择集提交移除,否则
委托给 context 的 `removeHwType`;叠加模式下不触碰 context 状态,关闭叠加层即恢复
之前的官方选择,与切换路径语义一致。同时将叠加层 e2e 测试夹具(fixtures)提取到
cypress/support/overlay-fixtures.ts,由既有 overlay-optimal-only 与新增的
overlay-legend-remove 回归测试(未修复时失败)共享;两个测试的断言改用可重试的
`.should()` 回调(数据点 150ms 的透明度过渡使一次性 `.then()` 计数存在竞态)。
* feat(legend): explicit hide/show affordances on legend rows
Make the two legend actions visually explicit: hovering an ACTIVE row swaps
the color dot for the "Hide <label>" X (now with a matching tooltip), and
hovering an INACTIVE row swaps the dimmed dot for a "+" with a "Show <label>"
tooltip — signaling that clicking the SKU name brings the series back. The
"+" is decorative (aria-hidden): the row's label/checkbox remains the single
click target, so behavior is unchanged; only the affordance is new.
Legend-item strings now go through a component-local locale dict (en/zh) per
the site's bilingual-UI rule; the English strings are byte-identical to the
previous literals. e2e assertions added: active row exposes the Hide tooltip,
removed row exposes the Show "+" indicator and no Hide X.
中文:让图例行的两种操作在视觉上更明确:悬停"激活"行时,颜色圆点切换为"隐藏
<label>"的 X(新增对应 tooltip);悬停"未激活"行时,变暗的圆点切换为"+"并带
"显示 <label>" tooltip——明确提示点击 SKU 名称即可恢复该系列。"+" 为装饰性元素
(aria-hidden):行的 label/checkbox 仍是唯一点击目标,行为不变,仅新增视觉提示。
图例项字符串按站点双语规则改经组件内 locale 字典(en/zh)处理,英文字符串与原
字面量逐字节一致。新增 e2e 断言:激活行暴露隐藏 tooltip,被移除的行暴露"+"恢复
指示且无隐藏 X。1 parent c40c77b commit bc30638
5 files changed
Lines changed: 263 additions & 114 deletions
File tree
- packages/app
- cypress
- e2e
- support
- src/components
- inference/ui
- ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
16 | 12 | | |
17 | 13 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
91 | 20 | | |
92 | 21 | | |
93 | 22 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 23 | + | |
115 | 24 | | |
116 | 25 | | |
117 | 26 | | |
| |||
136 | 45 | | |
137 | 46 | | |
138 | 47 | | |
139 | | - | |
| 48 | + | |
140 | 49 | | |
141 | 50 | | |
142 | 51 | | |
143 | | - | |
| 52 | + | |
144 | 53 | | |
145 | 54 | | |
146 | 55 | | |
147 | 56 | | |
148 | 57 | | |
149 | 58 | | |
150 | 59 | | |
151 | | - | |
| 60 | + | |
152 | 61 | | |
153 | 62 | | |
154 | 63 | | |
155 | 64 | | |
156 | 65 | | |
157 | 66 | | |
158 | 67 | | |
159 | | - | |
| 68 | + | |
160 | 69 | | |
161 | 70 | | |
162 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
590 | 610 | | |
591 | 611 | | |
592 | 612 | | |
| |||
2820 | 2840 | | |
2821 | 2841 | | |
2822 | 2842 | | |
2823 | | - | |
| 2843 | + | |
2824 | 2844 | | |
2825 | 2845 | | |
2826 | 2846 | | |
| |||
0 commit comments