Repository navigation
Commit b4f4781
feat(console): the install note says how many sample records an install loaded, and clears them in place (#30537)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuSy5eNPdVfiKwQVEHz8MX4y)_
Part of #30323
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:在应用市场详情页把应用安装到本运行时后,安装结果里会写明「本次安装载入了 N
条示例记录」,旁边直接有「清除示例数据」按钮;清除改用控制台自己的确认框(不再是浏览器原生弹窗),本次会话装过的应用会写明「最多删除 N
条」;离开详情页进入应用后,页面顶部有一条横幅提示该应用有示例数据,点「清除示例数据」会回到详情页并直接打开确认框;重装时说明示例数据会重新载入;「应该已经出现在应用切换器中」改成确定的说法。10
种语言。
- 为什么改:示例数据默认保留(维护者裁决),但客户不知道去哪里清,假客户、假收入会一直留在仪表盘上。
- 风险与回滚:只读安装应答里已有的 `seeded`
计数,不改服务端、不改清除规则(只删带示例记录键的行,用户新增和改过键的记录保留);横幅只在本次浏览器会话内有效;回滚即还原本 PR。
-
先看:`ui/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx`
的 `doInstallLocal` 与
`purgeConfirmDialog`;`SampleDataLeaveBanner.tsx`(离页时发横幅);`sampleDataNotice.ts`(计数读取与会话记录)。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.sampleDataNotice-30323.test.tsx`,预期
12 个用例全绿(需先建 `@object-ui/app-shell` 的依赖闭包)。
- 需要你做的:无,席位落地。
## What changes
Card #30323, the console half that the install answer already supports.
Maintainer ruling on the card, verbatim:
「我觉得安装应用市场应用的时候是需要有初始数据的,这样客户才能看得到效果,但是呢,应该有界面功能能够帮助他清理数据」. Sample data
stays on by default; this PR makes the cleanup easy to find.
- **Premise, measured.** `POST /api/v1/marketplace/install-local`
answers `data.seeded` with the seed run's counts (`mode: 'inline'`,
`inserted`, `updated`, `skipped`, `errors`), so the claim's stop
condition does not apply. Read live on base `70981e63`: a fresh install
answered `inserted: 3`, a reinstall over live sample data `skipped: 3`,
the purge `deleted: 3`, and a reinstall after the purge `inserted: 3`
again (the card's "reinstalling reseeds").
- **The install note** (`doInstallLocal`). After a managed install, the
result note says how many sample records the install left in place
(`inserted + updated + skipped` of an `inline` run; `skipped` there
means the row was already in the database), with a "Purge sample data"
button in place. An install over an existing one adds that installing
again loads the sample data again, including any that was cleared. No
line for `skipped` / `refused` / `replayer` runs, an unmanaged copy, or
an answer without `seeded`.
- **Definite success sentence.** `marketplace.install.localSuccess`
(shown only when the answer says `hotLoaded: true`) now reads "… is now
in the app switcher." instead of "should now appear", in all 10 packs.
- **The console's own confirm.** Both purge paths (local and cloud, from
the note or the ⋯ menu) open an `AlertDialog` in place of
`window.confirm`. When this session knows the install's count, the
dialog says at most that many sample records go (the purge deletes only
rows carrying a seed record's key, so the install's count is an upper
bound). The purge rule and its doors are unchanged.
- **A reach from the app's own pages**, through an existing generic
block: the console's `banner` notification (`NotificationBanners`, drawn
by `ConsoleLayout` above every page). `SampleDataLeaveBanner` raises it
when the installer leaves the package page, for a package this session
recorded loading sample data into. Its "Purge sample data" action
navigates back to the package page, which opens the confirm once the
listing says the sample data is still there. Clearing withdraws the
banner; coming back to the page withdraws it while the page's own note
speaks.
- **Session record** (`sampleDataNotice.ts`): the reader
`sampleRecordsLoaded()` and an in-memory map from manifest id to the
count, name and page path, used by the confirm and the banner. A reseed
from the ⋯ menu records its own count the same way.
- **Types.** `LocalManagedInstallResult` and
`LocalUnmanagedInstallResult` gain the optional `seeded`
(`LocalInstallSeeded`) in `marketplaceApi.ts`.
- **i18n.** New in all 10 packs under `marketplace.detail`:
`sampleDataLoaded` and `purgeConfirmAtMost` (count families with each
language's CLDR slots, as `purgeSuccess`), `sampleDataReloaded`,
`sampleDataBannerTitle`, `sampleDataBannerMessage`. The banner and the
note's button reuse `purgeSampleData`.
- **Changeset.** `.changeset/30323-install-note-sample-data.md`,
`@object-ui/app-shell` and `@object-ui/i18n` patch.
Branch: the harness-assigned `claude/project-thread-6nrbkq`, not
`claude/issue-30323-*`; the card is #30323.
## Tests
- New `MarketplacePackagePage.sampleDataNotice-30323.test.tsx` (12
cases, the real `marketplaceApi` over one stubbed `fetch`,
`window.confirm` stubbed to throw): the 369-record note with the
definite sentence and the clear; inserted + updated + skipped over live
data with the reinstall line; reinstall after clearing; CONTROL:
`skipped`, `refused`, an inline run that left nothing, and no `seeded`
draw no line; the note's clear opens the dialog with the count and its
confirm purges and drops the clear; Cancel purges nothing; the ⋯ menu's
purge on a visit with no install this session shows the dialog without a
count; the banner is absent on the page, raised on leaving, its action
navigates back and the page opens the confirm, clearing leaves no
banner; CONTROL: no banner when nothing was loaded.
- Moved pins: `MarketplacePackagePage.offlineLocalMenu-11627.test.tsx`
and `MarketplacePackagePage.sampleDataRefusal-10432.test.tsx` click the
dialog's confirm after the menu item (the purge now asks in the
console's dialog).
`ui/packages/i18n/src/__tests__/de-quote-pairing-3876.test.ts` counts
one more matched „…“ span (104 to 105) for `sampleDataBannerTitle`.
## Acceptance notes
- **Left open on the card (why `Part of`).** "The confirm says how many
records will go" holds only for an install made in this console session.
After a reload nothing serves a count: the purge door has no dry run and
the install-local listing's `withSampleData` is presence only
(`sampleDataInScope` reads `firstOnly`). A count after the fact needs
the server to answer it, in `packages/cloud-connection`, outside this
claim's surface. For the same reason the banner lasts for the console
session, not across reloads; a standing per-app reach would need a mount
outside `console/marketplace/**`.
- The cloud install path (`installPackage`) answers no sample-data
count, so its install note is unchanged; its purge confirm is the new
dialog without a count.
- Live UI screenshots: NOT MEASURED. This rig has no cloud marketplace
(`cloudUrl` empty), so the package page cannot install from a catalog
here; the page is covered by the tests above, on the answer shape the
live server returned.
## Verification
<details><summary>Live install-local readings (examples/app-showcase,
objectstack dev --fresh, base 70981e6)</summary>
Manifest `com.acme.rig` with one object `rig_note` and one dataset of
three records keyed by `title`:
- install: `seeded: {mode: "inline", inserted: 3, updated: 0, skipped:
0, errors: 0}`, `upgradedFrom: null`, `hotLoaded: true`
- install again: `seeded: {mode: "inline", inserted: 0, updated: 0,
skipped: 3, errors: 0}`, `upgradedFrom: "previous-marketplace-version"`
- purge: `{deleted: 3, skipped: 0, errors: 0, withSampleData: false}`;
the listing then answers `withSampleData: false`
- install after the purge: `seeded: {mode: "inline", inserted: 3, ...}`
</details>
<details><summary>Tests, type-check, lint</summary>
- `pnpm --dir ui exec vitest run
packages/app-shell/src/console/marketplace packages/i18n
packages/app-shell/src/views/metadata-admin/PackagesPage`: Test Files
164 passed (164), Tests 2028 passed, 13 skipped.
- `pnpm --filter @object-ui/app-shell --filter @object-ui/i18n run
type-check`: both Done, exit 0.
- `eslint --no-inline-config` on the changed files: 0 errors (warnings
are the files' existing `no-explicit-any` and one unused `code`).
- `check:i18n-keys`, `check:i18n-drift`, `check:i18n-dead-keys` (ui):
exit 0 each; drift: every changed `en` value followed by all nine packs.
</details>
<details><summary>Ablations (scripts/ablation-replace.mjs, restored to
HEAD each time)</summary>
- `sampleRecordsLoaded` returns `null`: 6 of 12 red (every count case),
6 controls green.
- `openLocalPurgeConfirm` purges without the dialog: 3 red (note clear,
Cancel, ⋯ menu dialog).
- `SampleDataLeaveBanner` raises nothing on leaving: 1 red (the banner
case).
</details>
<details><summary>Derived gates (dispatch-gates --commands, 35
families)</summary>
All 35 derived families ran on `1470c715` with exit 0; `dispatch-gates
--ran` answered 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN. `pnpm
check:changeset-fixed` (its roster is under `.changeset`) exit 0. After
merging `origin/main` (head `eaf46b57`, which brought locale-pack edits
from other PRs and merged cleanly), the derivation is the same
35-command list, and these were run again with exit 0: the marketplace +
i18n + PackagesPage tests (164 files, 2028 passed), app-shell and i18n
type-check, `check:i18n-keys`, `check:i18n-drift`,
`check:type-check-coverage`, `check:type-check-debt`, `check:nul-bytes`,
`check:published-files`, `check-empty-changeset`,
`check-changeset-no-major`.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgVKAj6nUY3DxWKsvXb)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 67d5d53 commit b4f4781
19 files changed
Lines changed: 771 additions & 25 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/console/marketplace
- __tests__
- i18n/src
- __tests__
- locales
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
52 | | - | |
| 60 | + | |
53 | 61 | | |
54 | 62 | | |
55 | 63 | | |
| |||
84 | 92 | | |
85 | 93 | | |
86 | 94 | | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
88 | 98 | | |
89 | 99 | | |
| |||
273 | 283 | | |
274 | 284 | | |
275 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
276 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
277 | 296 | | |
278 | 297 | | |
279 | 298 | | |
| |||
305 | 324 | | |
306 | 325 | | |
307 | 326 | | |
308 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
309 | 335 | | |
310 | 336 | | |
311 | 337 | | |
| |||
602 | 628 | | |
603 | 629 | | |
604 | 630 | | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
605 | 634 | | |
606 | 635 | | |
607 | 636 | | |
| |||
611 | 640 | | |
612 | 641 | | |
613 | 642 | | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
614 | 652 | | |
615 | 653 | | |
616 | 654 | | |
| |||
640 | 678 | | |
641 | 679 | | |
642 | 680 | | |
643 | | - | |
644 | | - | |
| 681 | + | |
| 682 | + | |
645 | 683 | | |
646 | 684 | | |
647 | 685 | | |
| |||
650 | 688 | | |
651 | 689 | | |
652 | 690 | | |
653 | | - | |
| 691 | + | |
654 | 692 | | |
655 | 693 | | |
656 | 694 | | |
657 | 695 | | |
658 | 696 | | |
| 697 | + | |
659 | 698 | | |
660 | 699 | | |
661 | 700 | | |
| |||
762 | 801 | | |
763 | 802 | | |
764 | 803 | | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | 804 | | |
769 | 805 | | |
770 | 806 | | |
| |||
801 | 837 | | |
802 | 838 | | |
803 | 839 | | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
804 | 847 | | |
805 | 848 | | |
806 | 849 | | |
| |||
817 | 860 | | |
818 | 861 | | |
819 | 862 | | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | 863 | | |
824 | 864 | | |
825 | 865 | | |
826 | 866 | | |
827 | 867 | | |
828 | 868 | | |
829 | 869 | | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
830 | 874 | | |
831 | 875 | | |
832 | 876 | | |
| |||
854 | 898 | | |
855 | 899 | | |
856 | 900 | | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
857 | 908 | | |
858 | 909 | | |
859 | 910 | | |
| |||
910 | 961 | | |
911 | 962 | | |
912 | 963 | | |
913 | | - | |
| 964 | + | |
914 | 965 | | |
915 | 966 | | |
916 | 967 | | |
| |||
944 | 995 | | |
945 | 996 | | |
946 | 997 | | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
947 | 1036 | | |
948 | 1037 | | |
949 | 1038 | | |
| |||
1009 | 1098 | | |
1010 | 1099 | | |
1011 | 1100 | | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1012 | 1124 | | |
1013 | 1125 | | |
1014 | 1126 | | |
| |||
1100 | 1212 | | |
1101 | 1213 | | |
1102 | 1214 | | |
| 1215 | + | |
| 1216 | + | |
1103 | 1217 | | |
1104 | 1218 | | |
1105 | 1219 | | |
| |||
1395 | 1509 | | |
1396 | 1510 | | |
1397 | 1511 | | |
1398 | | - | |
| 1512 | + | |
1399 | 1513 | | |
1400 | 1514 | | |
1401 | 1515 | | |
| |||
1415 | 1529 | | |
1416 | 1530 | | |
1417 | 1531 | | |
| 1532 | + | |
| 1533 | + | |
1418 | 1534 | | |
1419 | 1535 | | |
1420 | 1536 | | |
| |||
| 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 | + | |
0 commit comments