Repository navigation
Commit 5727092
fix(console): the approvals inbox status filter offers Cancelled (#37003)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
Fixes #36960
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBTDAJKyXUan6fJCKsZUf5Pv)_
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
审批收件箱「我提交的」和「全部」两个页签里,状态筛选下拉框多了「已取消」一项;以前只有五种状态,已取消的审批单在列表里看得到却筛不出来,现在可以直接筛出。
- 属于审批收件箱的体验修补:替想找"没有结论就结束了"的审批单的提交人和管理员解决翻遍整页的问题。
- 出错时最坏是筛选项显示不对,用户仍可用「全部状态」浏览;改动只在前端下拉选项,可直接撤回。
- 无。
## What changes
- The approvals inbox status select (shown on **Submitted by me** and
**All**) drew five hand-typed options and had no **Cancelled**, although
cancelled rows show in the same list with their own badge and the server
answers `GET /api/v1/approvals/requests?status=cancelled`.
- The options are now one `SelectItem` per entry of the contract's
`APPROVAL_STATUSES` (`@objectstack/spec/contracts`), labelled through
the page's existing `statusLabel`. Order is unchanged for the five
existing statuses; Cancelled comes last. A status the contract adds
later is offered without a console change; `APPROVAL_STATUS_LABELS` is
already `satisfies Record<ApprovalStatus, string>`, and `statusLabel`
falls back to the raw token for a status it has no case for.
- The diff in `ApprovalsInboxPage.tsx` is confined to the option list
and one import name, so it stays clear of #36979 (the tab, filter,
search and sort state moving into the address) on the same file:
`overlap-check.mjs` answers `merges cleanly` against both `origin/main`
and #36979.
- Changeset: `@object-ui/console` patch (the published package that
ships this page; `@objectstack/console` carries its built dist in the
same fixed version group, the convention every console changeset
follows).
**Read first (by risk):**
1. `ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx`, the hunk
inside the status `SelectContent` (the `APPROVAL_STATUSES.map` block):
the one behaviour change.
2.
`ui/apps/console/src/pages/system/ApprovalsInboxPage.statusFilterCancelled-36960.test.tsx`:
the pins, with the real `approvalsApi` and a stubbed authenticated
fetch.
**Two-minute check:** `pnpm --dir ui exec vitest run
apps/console/src/pages/system/ApprovalsInboxPage.statusFilterCancelled-36960.test.tsx`
from the repo root (after building the `@objectstack/*` closure) answers
`Tests 3 passed (3)`. In the browser: Approvals Inbox, tab **All**, open
the status select: the last option is **Cancelled**, and choosing it
leaves only cancelled rows.
## Tests
New file `ApprovalsInboxPage.statusFilterCancelled-36960.test.tsx`,
mounting the real page over the real `approvalsApi`, with only
`createAuthenticatedFetch` stubbed, so the assertion is the request URL:
- the option list is exactly `All statuses` plus one option per
`APPROVAL_STATUSES` value, in contract order, with Cancelled last;
- choosing **Cancelled** sends a request-list call whose `status` query
value is `cancelled`. **Red on main, green here;**
- control: choosing **Rejected** sends `status=rejected` and no
`cancelled`. Green on both trees, so the Cancelled case cannot pass on a
select that sends nothing or the same token for every option.
## Acceptance notes
- **Other places in this page that might omit `cancelled`: none found.**
`STATUS_CLASSES` and `statusLabel` both have it. The client-side status
match (`r.status !== statusFilter`) is generic. The **Pending** tab
draws no status select and lists only `pending` by design. The two
counts (my pending, environment pending) are pending-only by design: the
contract says a cancelled request leaves the pending count. The filter's
default is `all`. The `ApprovalRequestRow.status` union includes
`cancelled`. #36979's address parser validates `status` against the same
`APPROVAL_STATUSES`, so `?status=cancelled` will round-trip once both
land.
- Observation, not filed (copy, outside the three filing classes):
`statusLabel`'s English default for `returned` is "Returned for
revision", while the contract's `APPROVAL_STATUS_LABELS.returned` is
"Returned". The page keeps its own string. This PR leaves it unchanged.
- A new test file rather than a describe in the tombstone file: the
siblings stub `approvalsApi` and read argument objects, and this pin
needs the real client so it can assert the wire URL.
- `type-check` for `@object-ui/console` was not run locally. It compiles
against every `@object-ui/*` package's built `dist/*.d.ts`, which this
worktree does not have. `Type Check UI` in CI covers it. The test file
was linted locally (0 errors, 0 warnings).
## Verification
All readings below are on `objectstack-ai/objectstack` at head
`c19a458204` unless a line names another commit.
<details><summary>New pins: green with the fix, red on main's page
source</summary>
```
with fix (c19a458): Tests 3 passed (3)
main's page file (57445a6), git restore --source=57445a6998 for the page only:
x lists "All statuses" and one option per APPROVAL_STATUSES value, Cancelled included
x choosing Cancelled asks the server for status=cancelled
Tests 2 failed | 1 passed (3) (the Rejected control passes)
restore: blob == HEAD (ab2ff7f), git diff HEAD empty
```
</details>
<details><summary>Ablation (scripts/ablation-replace.mjs)</summary>
Anchor `{APPROVAL_STATUSES.map((s) => (` was replaced with a filter that
drops `cancelled`. The page is imported from source, so there was no
dist leg.
```
anchor x1 -> x0, replacement x0 -> x1, blob ab2ff7f -> aec5f8d94a7d (mutation landed)
AssertionError: expected [ 'All statuses', 'Pending', …(4) ] to have a length of 7 but got 6
Tests 2 failed | 1 passed (3)
restored: blob == HEAD (ab2ff7f) and git diff HEAD is empty
```
This ran at 8a5d1b5. The later commit only re-typed the test's
pointer-event shim without `any` and left the assertions unchanged.
</details>
<details><summary>Sibling suites</summary>
`pnpm --dir ui exec vitest run
apps/console/src/pages/system/ApprovalsInboxPage`: `Test Files 20 passed
(20) · Tests 107 passed (107)` (lock VERDICT command-exit 0), at
8a5d1b5.
</details>
<details><summary>Derived gate families (dispatch-gates
--commands)</summary>
37 families were derived. All 36 non-vitest families were re-run at
`c19a458204` and each exited 0. `pnpm --dir ui exec vitest run scripts/`
exited 0 at 8a5d1b5 (`Test Files 172 passed | 2 skipped`).
Reconciliation: `dispatch-gates --ran: 37 derived famil(ies) accounted
for — 37 run, 0 NOT-MEASURED (a DERIVED zero)`.
`check:new-line-citations` (ui): `0 new citation(s)`. Everything else
runs in CI.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4c4a677 commit 5727092
3 files changed
Lines changed: 214 additions & 6 deletions
File tree
- .changeset
- ui/apps/console/src/pages/system
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 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 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
1920 | 1920 | | |
1921 | 1921 | | |
1922 | 1922 | | |
1923 | | - | |
1924 | | - | |
1925 | | - | |
1926 | | - | |
1927 | | - | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
1928 | 1929 | | |
1929 | 1930 | | |
1930 | 1931 | | |
| |||
0 commit comments