You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 994c7d6
Browse filesBrowse the repository at this point in the historyBrowse files
fix(app-shell): the approval request's "As submitted" summary draws the submitted file fields, and each file opens (#32963)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoShPRwR7m6qzdXdZvptvrJg)_Fixes#32854
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:审批申请页「提交时的内容」现在会画出提交时的附件字段(`file`
单个与多个、`image`、`avatar`、`video`、`audio`),每个文件是可点开的链接,图片是可点开的缩略图;其余对象/列表型字段(地址、位置、json、多选、多值引用等)按一条写明的规则继续不画。
- **为什么改**:原来所有对象或数组值一律跳过,报销单的「电子发票」(多文件字段)在审批页看不到,审批人看不到自己要批的发票。
- **风险与回滚**:只改前端一个摘要组件,不改服务端、不加下载通道(链接走平台已有的
`/api/v1/storage/files/ID`,权限由该端点自己判);附件行不占 6 行上限。回滚即 revert 本 PR。
-
**先看**:`snapshotSummaryPlan.ts`(附件分支在对象跳过之前)、`RecordSnapshotSummary.tsx`(头注释里的规则与附件区块)、`RecordSnapshotSummary.test.tsx`(新增
pin)。
- **两分钟验证**:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/approval-decision/RecordSnapshotSummary.test.tsx`,预期
36/36 通过;或打开一张带电子发票的报销审批,「提交时的内容」下方出现「电子发票」及每个文件的链接。
- **需要你做的**:无,席位落地。
-
**席位意见**:席位(domain:ui#4)审过。附件类字段(文件、图片、头像、音视频)用记录页同一个字段单元格画出,打开走平台已有的下载接口,由接口判权限,没有新增下载通道;不占
6 行上限。其它对象或列表值按 PR 写明的规则不画,审批人点开记录可看全。只改审批页摘要,不碰服务端,没有新增文案键。CI 全绿后按队列落地。
## What changes
`planSnapshotSummary` gains an `attachments` list. A declared field
whose type is in the spec's media family `FILE_REFERENCE_TYPES`
(imported from `@objectstack/spec/data`, not copied) is routed there
before the object/list skip, when it holds a file.
`RecordSnapshotSummary` draws those fields full width after the business
rows, under the same "As submitted" heading, each through the field's
own cell (`getCellRenderer`, the record page's face): `FileCellRenderer`
for `file` / `video` / `audio`, `ImageCellRenderer` for `image` /
`avatar`. No new widget, no new download channel, no server change;
`ui/packages/fields/**` is read only.
### The rule: object and list values, kind by kind
| Kind | Drawn? | How / why |
|---|---|---|
| `file`, `multiple: true` | drawn | one link per file, each opening the
platform download endpoint (`FileValueAffordance`, `target=_blank`) |
| `file`, single | drawn | one link that opens the file; a stored bare
id already passed the old skip as a grid row, it now moves to the
attachment block |
| `image`, `avatar` | drawn | thumbnail from the download endpoint; a
click opens the image lightbox (the record page's cell) |
| `video`, `audio` | drawn | same link face as `file` (the registry maps
them to `FileCellRenderer`) |
| any of the above, empty (`null`, blank id, empty list, empty object) |
left out | nothing was submitted; the scalar rule's "empty gets no row"
applied to attachments |
| `address`, `location` / `geolocation` | left out | a multi-line block
or a map; a one-line glance row would cut it |
| `json` / `object`, `composite`, `record`, `repeater`, `grid`, `vector`
| left out | structured faces (key lists, tables) that a glance row
cannot hold |
| `multiselect`, `checkboxes`, `tags` (list values) | left out | a chip
list a truncated row would cut; the record shows it whole |
| multi-value reference (`lookup` / `user` with `multiple`) | left out |
a list of record ids, a chip list a truncated row would cut; the record
shows it whole |
| any other object or list value | left out | the rule is by value
shape: only the media family is drawn |
**Row cap:** attachments are not counted against `SNAPSHOT_SUMMARY_ROWS`
(6) and are never cut by it, because the attachment is what the approver
decides on. The lead and the six business rows are chosen exactly as
before. Every existing filter still applies first: undeclared keys,
`hidden: true`, framework-managed columns, and fields the reader may not
read (`withoutDeniedFields`) get no attachment row.
**What the snapshot holds (measured):** the approvals service stores the
flow's `$record` (the engine's write result, file fields in stored form,
the bare `sys_file` id) and serves it redacted per reader, with no file
expansion. `readFileValue` turns a bare id into
`/api/v1/storage/files/ID`, the stable endpoint that judges access and
redirects to a signed URL, and reads the expanded `{ id, name, url }`
and refused `{ id, metadataRefused }` forms too. So the value carries
what opening needs; no server change.
## Why
The plan skipped every object or array value (`value == null || typeof
value === 'object'`), and a multi-file field's value is an array, so the
e-invoices field never showed on the approval page while the same
claim's own page showed both files.
## Tests
`RecordSnapshotSummary.test.tsx`, new blocks `planSnapshotSummary:
object and list values (objectstack#32854)` and `RecordSnapshotSummary:
attachments are drawn and open (objectstack#32854)`:
- `multiple` file: each file drawn as a link with the download href and
`target=_blank`, after the five business rows, outside a cap of 2 in the
plan pin, never the lead.
- single file (stored id and expanded form), `image`, `avatar`, `video`,
`audio`: one pin each (plan + render).
- CONTROL: address, location, json, multiselect and a multi-value lookup
stay out (plan and render), and the scalar rows are unchanged.
- CONTROL: empty, hidden and undeclared attachment fields take no row.
- The eight existing plan assertions gained `attachments: []`; their
rows, lead and summed values are unchanged.
## Acceptance notes
- Ablation (on-disk proof via `scripts/ablation-replace.mjs`, anchor 1
to 0, restored blob equals HEAD): restoring the object skip ahead of the
attachment arm turns 8 pins red, every multi-file, expanded-object and
list-valued attachment pin; the string-id pins stay green because a
bare-id string already passed the old skip as a scalar row.
- The surface grep for `ruling|Ruling-ref|maintainer|⛔` hits the summary
header's name-guess ban and the two #27502 ruling records (the "As
submitted" heading); attachments sit under that same heading, so both
hold.
- No i18n key added (labels are the declared field labels; the file name
fallback is the cell's existing `fields.file.fileFallback`), so Clause-②
stays `no`.
## Verification
Head `499a94e2` (one `origin/main` merge before opening; nothing merged
touches this surface or its dependencies' sources).
<details><summary>Tests</summary>
- `pnpm --dir ui exec vitest run
packages/app-shell/src/views/approval-decision/RecordSnapshotSummary.test.tsx`:
36/36 passed.
- Every test that imports the changed modules (6 app-shell files + the
console's `servedPageSummary-12483` and
`servedPageSummaryAmount-12534`): 8 files, 105/105 passed before the
merge; the 6 app-shell files 81/81 after it.
- `pnpm --filter @object-ui/app-shell run type-check`: exit 0.
- eslint on the three changed source files: exit 0.
- `pnpm --dir ui run check:new-line-citations`: 0 new citations.
</details>
<details><summary>Gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 36 families; all 36 ran locally with
exit 0, including `node scripts/check-sdui-manifest.mjs` and its
`--self-test`, and `pnpm --dir ui exec vitest run scripts/` (171 files
passed, 2 skipped). `--ran` reconciliation: 36 derived, 36 run, 0
NOT-MEASURED (a derived zero, every line carries its exit code). The
full farm is CI's.
</details>
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (changed files linted;
the repo-wide run is CI's)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English. (the 维护者速读 section is
in Chinese by the dispatch rule)
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibxxCyVEdcKEJFrY3XH)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L9qibxxCyVEdcKEJFrY3XH
<!-- signed: domain:ui#4 · os-tesla · session_01L9qibvZYR36KAJUv44oXZw
-->
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(app-shell): an approval request's "As submitted" summary draws the submitted file fields, and each file opens
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
The summary used to leave out every field whose value is an object or a list, so a `file` field with `multiple: true` (an expense claim's e-invoices) never showed, and the approver could not see the files they were approving. Now a field whose type is in the spec's media family (`file`, single or `multiple`, `image`, `avatar`, `video`, `audio`) is drawn through its own field cell after the business rows: each file is a link to the platform's download endpoint, each image a thumbnail that opens. These attachment rows are not counted against the six-row cap. Every other object or list value (an address, a location, `json`, a composite, a repeater, a multi-value option list or reference) is still left out, by a rule stated in `RecordSnapshotSummary.tsx`'s header. The scalar rows are unchanged.
0 commit comments