Repository navigation
Commit 5064289
fix(console): word a closed record apart from one in approval, and save a closing header last (ADR-0162 item 4) (#38994)
Part of #37773: this PR lands the grid, the line grid and the
closing-header-last save. The record-page half stays open on the card
and waits on #38995.
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
控制台表格和明细表格里已关闭的行(如已付款发票及其明细行)编辑时提示“已关闭,无法更改”,不再提供编辑和删除;审批中的行与今天一样;记录页本身暂不变。
- 属于“记录关闭态锁”这一组工作(ADR-0162 第 4 项),让用户分清“已关闭”和“审批中”,并让同时改明细和关单的一次保存整单成功。
- 出错时表格里可能显示错误的锁原因,或关单保存被整单拒绝;改动只在控制台和一段文档,可直接撤回。
- 无
## What changes
ADR-0162 item 4, the grid half: the grid and the line grid ask the data
layer's one lock read (D9, landed in #38913) for a row's edit and delete
affordances, and word the reason from its `lockReason`. The
master-detail form writes a closing header last.
- **Grid and line grid**
(`ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts`): the
on-demand page read now goes to `POST /api/v1/data/OBJECT/locks`,
chunked at `RECORD_LOCKS_MAX_RECORD_IDS`. It is gated on `routes.data`
in discovery (not on the approvals service), and the 501 latch is kept.
Each answer keeps `lockReason`. New members `closed(id)` and
`deleteRefused(id)`; `heldByMaster` is gone. `deleteRefused` is true on
`closed_state` for either source, and on `approval` only for
`lockSource: 'master'`, which is the published rule. Same request count
as before.
- **Grid wording** (`objectGridCellFacts.ts`, `ObjectGrid.tsx`,
`objectGridTranslations.ts`): a new `closedLocked` read-only kind,
checked before `approvalLocked`. A cell on a closed row opens no editor
and says "This record is closed, so it can't be changed."; a closed row
that is also held reads as closed.
- **Row menu** (`objectGridActionsColumn.tsx`): Edit and Delete read the
same answer, so a closed row offers neither. Greying Edit instead of
hiding it is #38996.
- **Master-detail save**
(`ui/packages/plugin-form/src/masterDetailTx.ts`,
`MasterDetailForm.tsx`): an edit save whose header data sets a value the
header object lists in `closedStates` puts the header update after every
line write (ADR-0162 D4). Otherwise the header stays first. The form
reads `closedStates` from the header's own served definition, and the
result mapping finds the parent by object and id, not by index 0. Create
stays parent-first, because its lines point at operation 0.
- **Strings**: `grid.readOnlyReason.closedLocked` in all eleven console
locales; zh-Hant is generated from zh-Hans.
- **Docs** (`content/docs/data-modeling/closed-states.mdx`, § Line edits
go before the closing write): the passage that said the console's
master-detail form saves the header first now says it writes a closing
header last, so such a save lands whole. Only that passage changes.
- `userActions` predicates and action buttons are untouched: the lock
read hides no action.
## Tests
- New: `plugin-form/src/masterDetailTx.closingHeaderLast-37773.test.ts`
(7) and `MasterDetailForm.closingHeaderLast-37773.test.tsx` (2). The
second drives the real form: it picks `paid`, edits a line, and pins
`['update invoice_line', 'update invoice']`. A second save diffs against
what the first wrote, and the control keeps the header first.
- New blocks: `rowMenuApprovalLock-36911.test.tsx` (2: closed own and
closed line offer neither Edit nor Delete, own approval keeps Delete)
and `ObjectGrid.cellSelection-35684.test.tsx` (closed wording; closed
and held reads as closed).
- Moved to the data door: the grid lock pins (36911, 35684, 35685,
27365, the row CRUD verdict, discovery 38849).
- app-shell is unchanged from main. Its one-request record-open pins
(27627, 28470, 12701, 13010, 28737) pass unedited against this grid.
<details><summary>Ablations (one per fix, each restored)</summary>
- Save order: forcing `closing = false` in `buildMasterDetailEditBatch`
turns 3 of the 9 new plugin-form tests red.
- Grid: dropping `closed_state` from `deleteRefused` and `closed` turns
the three closed pins in 36911 and 35684 red (42 of 45 still pass).
</details>
## Acceptance notes
- **The record-page half waits on #38995** (a data-lock part on the
record-page payload, so a record open stays one request). The removed
record-page work is pushed, with no PR, on
`claude/issue-37773-record-page-half-wip` at `ca71605f`. Its record-page
files, against main:
`ui/packages/app-shell/src/hooks/useRecordApprovals.ts`,
`views/RecordDetailView.tsx`, `views/recordDeleteHeldByMaster.ts`, the
tests `useRecordApprovals.lockSource-37195`,
`RecordDetailView.approvalLock-25934`, `RecordDetailView.harness` (§
closedLock-37773) and `AppContent.editDialogApprovalLock-27138`, and the
strings `detail.lockedClosed` / `detail.lockedClosedTooltip`. Until it
lands, the record page reads the approvals lock as main does: a closed
record there still shows Edit (the server refuses the write), with no
closed wording.
- **Greying the grid row menu's Edit** with the closed sentence, instead
of hiding it, is #38996.
- **The record page's edit-state save order and the full-record edit
dialog's closed lock** are #38997.
- Main's `recordDeleteHeldByMaster.ts` header comment still names
`useRowApprovalLocks.heldByMaster`, which this PR removes. The comment
only; the record-page half rewrites that file.
- A reader who may not see the state field gets the closed wording from
the lock answer alone; the grid reads no field for it.
## Verification
Browser, on the showcase (paid invoice from #38917) through this
branch's console source:
https://claude.ai/artifact/1WWaA6gcswQuZHN2yJDnW8 (private until
shared). For this PR, the grid frame applies: an edit on the paid row
INV-1003 opens no editor and shows the closed sentence. The record-page
frames there show the half that moved to #38995.
Two-minute check: in the showcase, open Invoices, select the Owner Email
cell of a paid invoice and press Enter. Expect "This record is closed,
so it can't be changed." and no editor; a draft invoice's cell opens its
editor.
<details><summary>Local readings</summary>
- plugin-grid full suite, in three parts: 323 files, 2,850 tests passed.
plugin-form and i18n full suites: green after the zh-Hant regeneration.
- app-shell: the five one-request pin files plus the four test files
back on main, with i18n: 119 files, 2,031 passed, 13 skipped.
- `dispatch-gates --ran` on the final tree (73 derived, the docs
families included): 73 run, all exit 0, 0 NOT-MEASURED.
- ui `check:spec-symbols`, `check:i18n-keys`, `check:i18n-drift` and
`check:new-line-citations`: exit 0. `overlap-check`: clean against
origin/main.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzhKEbEnW8pwZRgK2gJ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent fc7534a commit 5064289
28 files changed
Lines changed: 665 additions & 143 deletions
File tree
- .changeset
- content/docs/data-modeling
- ui/packages
- i18n/src/locales
- plugin-form/src
- plugin-grid/src
- __tests__
- hooks
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
312 | | - | |
313 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
314 | 315 | | |
315 | 316 | | |
316 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
621 | 621 | | |
622 | 622 | | |
623 | 623 | | |
| 624 | + | |
624 | 625 | | |
625 | 626 | | |
626 | 627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| 590 | + | |
590 | 591 | | |
591 | 592 | | |
592 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
866 | 866 | | |
867 | 867 | | |
868 | 868 | | |
| 869 | + | |
869 | 870 | | |
870 | 871 | | |
871 | 872 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
| 602 | + | |
602 | 603 | | |
603 | 604 | | |
604 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
597 | 598 | | |
598 | 599 | | |
599 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| 590 | + | |
590 | 591 | | |
591 | 592 | | |
592 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| 590 | + | |
590 | 591 | | |
591 | 592 | | |
592 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
597 | 598 | | |
598 | 599 | | |
599 | 600 | | |
| |||
0 commit comments