Repository navigation
Commit 5b17215
fix(plugin-detail): the record highlights strip draws a boolean as one neutral chip (#27935)
domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg4i9JiKjEjwtuVzd4gKy9hB)_
## 维护者速读
-
改了什么:记录页顶部的「亮点条」(record:highlights)里,布尔字段不再是「是=绿、否=琥珀」两种颜色,统一画成一个中性的小标签,只显示「是
/ 否」字样。
- 为什么改:HotCRM 发现「SLA
已违约:否」被画成警告色,其实「否」才是好事;元数据并没有说哪个值是好的,详情区本来就只画一个中性的词,亮点条应与它一致。
- 风险与回滚:只改一个渲染分支的样式类,不动数据和元数据;回滚即还原这一个提交。
- 先看:`ui/packages/plugin-detail/src/HeaderHighlight.tsx`
布尔分支;`HeaderHighlight.booleanNeutral-27434.test.tsx`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/plugin-detail/src/__tests__/HeaderHighlight.booleanNeutral-27434.test.tsx`,预期
3 个用例全绿。
- 需要你做的:无,席位落地。
Fixes #27434
Clause-②: no
Metadata-protocol: none
## What changes
Card #27434 lists seven gaps HotCRM measured on 18.2.0. Each row was
re-measured on `main` at e41642d. This PR takes row 4; the other rows
are answered below, and the rows that need a new key, a spec change or a
change outside `ui/` go to cards of their own, now filed by the seat:
#27944 (row 2), #27945 (row 3), #27946 (row 5), #27947 (row 6) and
#27948 (rows 7 and 1). With every row taken or carded, this PR closes
the card.
**Row 4 (taken).** `HeaderHighlight` drew a boolean `true` as an emerald
"✓ Yes" chip and `false` as an amber "× No" chip, whatever the field
means. Both values now share one neutral chip (`bg-muted`,
`text-foreground`, `ring-border`), carrying the locale's Yes / No word
from `useBooleanValueLabel` and no glyph. That matches the details body,
which draws the same read-only field as the plain word. The now-unused
`Check` and `X` icon imports are dropped. A field-level key that says
which value is the bad one is not invented here: that is a spec question
(see Acceptance notes).
| Row | Bucket | Reading on `main` |
|---|---|---|
| 1 | Already done; the residual joins row 7 | The row reaches the
dialog from both doors. The record header (`page:header`
`dispatchHeaderAction`) and a list row's menu
(`objectGridActionsColumn`) both stash it under `params._rowRecord`.
Both param-collection handlers seed `defaultFromRow` from it (by the
param's `field`, else its `name`). The runner's `interpolate` fills
`${record.x}` in `description` and `helpText` on both doors
(objectui#12967, shipped in 18.0.0). What prints raw is a `{{ record.x
}}` hole. Measured through the runner: `Email {{ record.display_name }}
/ ${record.display_name}` reads `Email {{ record.display_name }} / Acme`
from both doors. That is the hole-syntax split of row 7. |
| 2 | Card (spec + ui) | No action key names the dialog's submit verb;
the footer reads `actionDialog.confirm`. |
| 3 | Card (spec + form) | A form has no lookup-pick autofill. The only
one is the line-item grid column's `autofill`, which copies same-named
fields and exists only in that grid. |
| 4 | Taken here | See above. |
| 5 | Card (spec) | `ActionSchema` has no per-reader `active` /
`pressed` predicate. |
| 6 | Card (server) | `resolveRef` in the import runner
(`@objectstack/core`) still tries `id`, `displayField`, the title field,
then `name`/`title`/`label`/`full_name`/`email`/`username`. It never
tries the target's `unique` fields. |
| 7 | Card (spec + runtime), with row 1's residual |
`composeSuccessMessage` fills `outcomeMessages` through
`substituteScopeTokens` (`${result.x}`), and `successMessage` through
`fillTemplateHoles` (`{{ }}`). The param dialog's `description` and
`helpText` read `${…}` through the evaluator. `confirmText` reads `{{
}}`, and the spec tells an author with params to move the confirm
question onto `description`, where the same `{{ record.x }}` hole stops
filling. |
## Tests
- New `HeaderHighlight.booleanNeutral-27434.test.tsx` (3 cases): neither
chip carries a state colour class or a glyph; the `true` and `false`
chips share one class list and differ only by the word; a control that
the strip drew its non-boolean value.
- Ablation, run twice against the committed fix and restored from `HEAD`
each time (`git hash-object` matched the HEAD blob after both):
- The file restored to `origin/main`: 2 of 3 cases red.
- Through `scripts/ablation-replace.mjs`, `rounded-full bg-muted px-2`
replaced by `rounded-full bg-amber-500/10 px-2` (anchor 1 to 0, blob
changed): case 1 red.
- Every `plugin-detail` highlights, record page and summary-chip test
file (22 files; `HeaderHighlight.booleanLocale-11689` included): 21
passed, 1 skipped, 177 tests passed.
- `@object-ui/plugin-detail` `type-check` (`tsc --noEmit && tsc -p
tsconfig.test.json`): exit 0.
## Acceptance notes
- Row 4's "a field-level key saying which value is the bad one" is the
spec half of that row. It is not built here; the neutral default is what
the details body already does.
- Out of scope, for the seat to file as cards: rows 2, 3, 5 and 6, and
row 7 together with row 1's `{{ }}` residual. Titles, bodies, landing
sites and dedupe words are in the os-dev report on #27434.
- No i18n string changed: the chip reads the existing
`useBooleanValueLabel` words.
## Verification
Each command was run on 189ad8a, with its exit code captured before any
pipe. The derived gate list was reconciled with `dispatch-gates --ran`;
the full list is in the report on #27434.
Co-authored-by: Claude <noreply@anthropic.com>1 parent dd9921e commit 5b17215
3 files changed
Lines changed: 104 additions & 12 deletions
File tree
- .changeset
- ui/packages/plugin-detail/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
416 | 415 | | |
417 | 416 | | |
418 | 417 | | |
| |||
| 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 | + | |
0 commit comments