Repository navigation
Commit d076975
feat(console): build a new report from the design mode's Add menu item (#36657)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ89Betg8QPoUPD5NhDenSfS2)_
Fixes #36364
Clause-②: yes (widening) — three new `@object-ui/i18n` keys
(`designMode.menu.newReport`, `designMode.menu.newReportLeft`,
`report.builder.addsToMenu`) in all 11 locales; no spec, schema or
public export change
Metadata-protocol: none
repo:objectstack#1 · os-warren · session_01JQwxbXq2Dxb31zZNmSqCtz
## 维护者速读
- 用户能看到什么变化:管理员在设计模式里「添加菜单项 →
报表」,第一行是「新建报表…」,点了会占好菜单位置并打开报表搭建页;选好数据来源和指标、保存后,新报表出现在占好的位置,设计模式里的其他改动一起保存。
- 为什么做:设计模式专题卡的报表这一半,按席位定的方案:报表必须先有数据来源和指标,所以从搭建页新建,而不是只填名字。
-
出错会怎样:菜单保存失败时,刚建的报表会被删掉,设计模式和搭建页都保持打开;中途关闭搭建页或离开它,什么都不写、占位消失;可以直接撤回本次合并。
- 要你做什么:不用做什么。
## What changes
The report half of #36364, on top of the report builder (#36644), per
the seat's ruling (option A, comment 7090058961): a report needs
`dataset` and `values`, so 「New report…」 opens the builder, and the
report and its menu entry are written only when the builder saves.
- **Picker** (`DesignModeMenu.tsx`): the Reports list starts with 「New
report…」. It holds the place (the dashed row now reads 「New report…」),
offers a slot, and navigates to the app's `reports/new`. Nothing is
written.
- **The slot** (`designModeReportSlot.ts`, new): the menu lives in the
sidebar and the builder in the page, with no shared tree, so a
module-level store holds one slot `{ path, save, cancel }`. It is keyed
by the builder's address, not the app's name, because the console
addresses an app by its route segment (the showcase app is
`/apps/com.example.showcase`, its name `showcase_app`). This was found
on the live run, and a page test pins it. The menu withdraws the slot
when the place is dropped and when it unmounts (the design mode ended).
Without a slot the builder is the plain new-report page, as before.
- **The builder page** (`ReportNewPage.tsx`): when a slot waits on its
address, it says 「Saving creates this report and adds it to the menu
where you placed it, with your other design changes.」. Its Save hands
`(name, label, body)` to the slot and writes nothing itself. A refused
save keeps the builder open. Its Close cancels the place and goes back.
- **The save** (`designModeMenuCreate.ts`): `NewMenuItem` gains a
`report` arm carrying the builder's body. `saveAppMenuWithNewItem` runs
the dashboard half's order unchanged: every menu-save check first, then
the report saved and published in the menu's own package
(`saveAndPublishInPackage`, the package-bound door
`saveDashboardInPlace` now shares), then the menu written with the entry
in the held place and every other staged edit (`saveWith`). On a refused
menu the report is removed again.
- **Leaving the builder another way** (a menu link, Back) drops the held
place too, so no row waits for a builder that is gone.
- **The entry's label**: a report entry with no `label` shows its
machine name (only object, view and dashboard entries inherit their
target's label, per the cloud#2021 ruling), so the new entry carries the
report's label. The live run first showed `hui_kuan_fenxi` in the menu,
and this fixes it.
## Tests
- `pnpm --dir ui exec vitest run packages/app-shell/src/layout
packages/app-shell/src/views/ReportNewPage` at `f3021225`: `Test Files
157 passed (157)`, `Tests 1284 passed (1284)`.
`DesignModeMenu-36363.test.tsx` was rerun at head `ecbe0f66` after the
label change: `38 passed`. Earlier at `f7737e36`, `packages/i18n` gave
`1978 passed`, with the de quote-pairing count raised 128 → 129 for
`newReportLeft`'s „{{name}}“.
- New pins:
- `designModeMenuCreate-36364.test.ts`: 4 report cases. They cover the
body, the package write order (ensure → save/publish report →
save/publish app), a refused menu resetting the report, and an unlisted
package creating nothing.
- `DesignModeMenu-36363.test.tsx`: 5 report cases. They cover the picker
row holding the place and writing nothing; the builder's Save writing
the report, then the menu with the labelled entry and the other staged
edit, then leaving the mode; a refused menu; the builder's Close; and
leaving the builder.
- `ReportNewPage.menuSlot-36364.test.tsx`: 5 cases. They cover Save
going through the slot; a refused save staying open; Close cancelling
and going back; a route segment other than the app's name; and another
app's slot not being used.
- Ablations (one-shot, not kept): without the page change, the page file
went 3 failed | 1 passed. Without the menu change, all 5 menu report
cases were red.
- `tsc --noEmit` (app-shell) exit 0. ESLint on the changed files: 0
errors. `check-i18n-call-site-keys` exit 0.
## Screenshots
Taken on the live showcase example (fresh backend, console dev server,
zh-CN, deviceScaleFactor 2). They are stored with the seat's project
files (`issue-36364/`):
1. 「添加菜单项 → 报表」, with 「新建报表…」 first.
2. The builder, with the held 「新建报表…」 row under 数据分析 and the 「adds to
the menu」 line.
3. The builder filled: Invoice Metrics, grouped by status, named 回款分析.
4. After Save: the design mode is left, and 「回款分析」 sits in the held
place, open.
5. Cancel path: a second 「新建报表…」, closed from the builder. The page goes
back, no held row is left, and the mode stays on.
Checked through the API after the run:
- `report/hui_kuan_fenxi` is stored in `com.example.showcase.custom`,
the menu's package (the same item Studio lists), with
`_diagnostics.valid: true`.
- The app's menu holds `{ id: nav_item_1, type: report, reportName:
hui_kuan_fenxi, label: 回款分析 }` under `grp_analytics`.
- It is the only `hui_kuan*` report, so the cancelled build left
nothing.
## Overlap
`overlap-check`: merges cleanly with main, #36655 and #36525. With
#36629 it conflicts only in `de-quote-pairing-3876.test.ts`, because
both PRs raise the same German quote count. Whichever lands second
re-adds 1 to the count.
---
_Generated by [Claude Code](https://claude.ai/code)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9fa05c6 commit d076975
21 files changed
Lines changed: 703 additions & 45 deletions
File tree
- .changeset
- ui/packages
- app-shell/src
- layout
- __tests__
- views
- 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
59 | | - | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
160 | 164 | | |
161 | 165 | | |
162 | 166 | | |
| 167 | + | |
163 | 168 | | |
164 | 169 | | |
165 | 170 | | |
| |||
417 | 422 | | |
418 | 423 | | |
419 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
420 | 502 | | |
421 | 503 | | |
422 | 504 | | |
| |||
456 | 538 | | |
457 | 539 | | |
458 | 540 | | |
459 | | - | |
| 541 | + | |
460 | 542 | | |
461 | 543 | | |
462 | 544 | | |
| |||
477 | 559 | | |
478 | 560 | | |
479 | 561 | | |
480 | | - | |
| 562 | + | |
481 | 563 | | |
482 | 564 | | |
483 | 565 | | |
| |||
516 | 598 | | |
517 | 599 | | |
518 | 600 | | |
519 | | - | |
| 601 | + | |
520 | 602 | | |
521 | 603 | | |
522 | 604 | | |
523 | 605 | | |
524 | 606 | | |
525 | 607 | | |
| 608 | + | |
526 | 609 | | |
527 | 610 | | |
528 | 611 | | |
| |||
612 | 695 | | |
613 | 696 | | |
614 | 697 | | |
615 | | - | |
| 698 | + | |
616 | 699 | | |
617 | 700 | | |
618 | 701 | | |
619 | 702 | | |
620 | | - | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
621 | 706 | | |
622 | 707 | | |
623 | 708 | | |
| |||
811 | 896 | | |
812 | 897 | | |
813 | 898 | | |
| 899 | + | |
814 | 900 | | |
815 | 901 | | |
816 | 902 | | |
| |||
819 | 905 | | |
820 | 906 | | |
821 | 907 | | |
| 908 | + | |
| 909 | + | |
822 | 910 | | |
823 | 911 | | |
824 | 912 | | |
| |||
943 | 1031 | | |
944 | 1032 | | |
945 | 1033 | | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
946 | 1047 | | |
947 | 1048 | | |
948 | 1049 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
777 | 778 | | |
778 | 779 | | |
779 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
780 | 922 | | |
781 | 923 | | |
782 | 924 | | |
| |||
0 commit comments