@mingfuyun/star-allinone 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/shared/design-to-page/SKILL.md +4 -4
- package/skills/shared/design-to-page/references/tracking.md +21 -41
- package/skills/shared/project-conventions/references/review-checklist.md +1 -1
- package/skills/shared/review-and-submit/references/ai-review.md +1 -1
- package/skills/shared/review-and-submit/references/verify.md +1 -1
- package/skills/shared/tracking/SKILL.md +93 -42
package/package.json
CHANGED
|
@@ -52,7 +52,7 @@ Add `--permission-create`, `--permission-edit`, `--permission-delete` when codes
|
|
|
52
52
|
3. The CLI fills columns and drawer fields from the OpenAPI schema (required, enum → `ProFormSelect`, dates/numbers). Review labels and permission codes; do not recreate the file tree. See [references/list-page-template.md](references/list-page-template.md).
|
|
53
53
|
4. If `src/components/Page/Container/config.tsx` exists, `gen page` writes a Container `index.tsx`, puts the table in `components/List.tsx`, and registers a Tab with `loader: () => import(...)`. Do not invent a second page shell.
|
|
54
54
|
5. Do not overwrite existing page files. Tell the user the CLI refused, then edit in place.
|
|
55
|
-
6. **Tracking:** When the project has tracking configured, `gen page` auto-wires default button tracking.
|
|
55
|
+
6. **Tracking:** When the project has tracking configured, `gen page` auto-wires default button tracking. Agent must scan and wire **all** in-scope buttons per [references/tracking.md](references/tracking.md) and `$shared-tracking` (permission, drawer/modal footers, action column, ProForm, copy)—do not leave manual steps for the user. If tracking is not set up yet, tell the user to run `$shared-tracking` first; do not invent a second tracking helper.
|
|
56
56
|
|
|
57
57
|
## Design path
|
|
58
58
|
|
|
@@ -65,7 +65,7 @@ For non-standard layouts:
|
|
|
65
65
|
5. API-backed pages include types, `MFRequest` methods, aggregate exports, and page consumption in the same change. Use `.agents/skills/shared-api-to-service/SKILL.md` for missing services. Use `.agents/skills/shared-api-to-service/references/mock.md` for extra mock scenarios. Do not embed production fake data.
|
|
66
66
|
6. Compare desktop and narrow layouts against the design. Fix structure and spacing before decoration.
|
|
67
67
|
7. Run focused verification. Do not claim visual fidelity without inspecting the rendered page.
|
|
68
|
-
8. When tracking is enabled,
|
|
68
|
+
8. When tracking is enabled, Agent applies [references/tracking.md](references/tracking.md) for every toolbar, action, copy, drawer, confirm, form submit, and standalone permission button on the page.
|
|
69
69
|
|
|
70
70
|
## Hard rules
|
|
71
71
|
|
|
@@ -79,7 +79,7 @@ For non-standard layouts:
|
|
|
79
79
|
- Do not use `Modal.confirm` or feature-level Ant Design `Modal` / `Drawer` shells.
|
|
80
80
|
- Do not add a UI library, state library, or CSS-in-JS system without approval.
|
|
81
81
|
- Do not refactor unrelated code.
|
|
82
|
-
- When `src/utils/tracking/index.ts` exists,
|
|
82
|
+
- When `src/utils/tracking/index.ts` exists, Agent wires `getTrackData` on every button covered by [references/tracking.md](references/tracking.md) (including copy). Do not call `track()` in handlers. Do not ask the user to add tracks manually.
|
|
83
83
|
|
|
84
84
|
## Verification
|
|
85
85
|
|
|
@@ -90,7 +90,7 @@ pnpm typecheck
|
|
|
90
90
|
|
|
91
91
|
Run `pnpm lint` for broad or shared changes. Run the project's documented build command when routes, entry, or multiple pages change.
|
|
92
92
|
|
|
93
|
-
When tracking is configured, scan changed page files: toolbar `track`, action `track`, drawer `cancelTrack` / `okTrack` or custom-footer `data-track`, confirm modal
|
|
93
|
+
When tracking is configured, scan changed page files: toolbar `track`, action `track`, copy `track`, drawer `cancelTrack` / `okTrack` or custom-footer `data-track`, confirm modal buttons, ProForm submitters, and standalone permission buttons. Agent fixes missing wiring before calling the page done; do not defer to the user.
|
|
94
94
|
|
|
95
95
|
## User-facing output
|
|
96
96
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Page tracking
|
|
2
2
|
|
|
3
|
-
Apply when the business project already has `src/utils/tracking/index.ts` (or the path documented in project conventions). Full SDK setup
|
|
3
|
+
Apply when the business project already has `src/utils/tracking/index.ts` (or the path documented in project conventions). Full SDK setup and **Agent 全站批量补齐规则** live in `.agents/skills/shared-tracking/SKILL.md`. This file covers **page / 生成场景**。
|
|
4
|
+
|
|
5
|
+
**Agent 规则:** 生成或修改页面时,由 Agent 写入全部按钮埋点,**不要**留给用户手工补。与「接入埋点」同一套五类扫描标准(含复制按钮)。
|
|
4
6
|
|
|
5
7
|
Import:
|
|
6
8
|
|
|
@@ -10,18 +12,20 @@ import { getTrackData } from '@/utils/tracking';
|
|
|
10
12
|
|
|
11
13
|
Click reporting uses `data-track` JSON from `getTrackData`. Do not call `track()` in business handlers.
|
|
12
14
|
|
|
13
|
-
## Required on every new page
|
|
15
|
+
## Required on every new or changed page
|
|
14
16
|
|
|
15
17
|
| Surface | Where | Pattern |
|
|
16
18
|
| --- | --- | --- |
|
|
17
|
-
| Toolbar
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
19
|
+
| Toolbar / batch / search extras | `const.tsx` or page `toolBarRender` | `track: getTrackData(..., { key: 'toolbar', name: '工具栏' })` |
|
|
20
|
+
| Permission buttons | `withAuth(Button)` / `AccessButton` | `data-track={getTrackData(...)}` |
|
|
21
|
+
| Row actions | `const.tsx` → `actionColumn` / `TablePermissionActions` | `track: getTrackData(..., { key: 'action', name: '操作' })` |
|
|
22
|
+
| Copy actions | action column / toolbar / custom footer | `getTrackData('copy', '复制', …)` or `复制IP` |
|
|
23
|
+
| Drawer default footer | `<Feature>Drawer.tsx` | `cancelTrack` / `okTrack` on `CustomDrawer` |
|
|
24
|
+
| Drawer / Modal custom footer | each `Button` | `data-track={getTrackData(...)}` |
|
|
25
|
+
| Confirm dialog | `BaseModal` | custom footer + `data-track` when button props unavailable |
|
|
26
|
+
| Inline form submit | `ProForm` / `Form` | `submitButtonProps` / `resetButtonProps` |
|
|
23
27
|
|
|
24
|
-
`MFProTable` query and reset are handled inside the table (`filter_query` / `查询`, `filter_reset` / `重置`). Do not duplicate
|
|
28
|
+
`MFProTable` query and reset are handled inside the table (`filter_query` / `查询`, `filter_reset` / `重置`). Do not duplicate in page code.
|
|
25
29
|
|
|
26
30
|
## Drawer with `submitter={false}`
|
|
27
31
|
|
|
@@ -36,48 +40,24 @@ Submit lives on `CustomDrawer`. Do not add a second submit track on `ProForm`.
|
|
|
36
40
|
/>
|
|
37
41
|
```
|
|
38
42
|
|
|
39
|
-
Use the page menu title or feature name for `name`. Keep `key: 'editor'` for create/edit drawers.
|
|
40
|
-
|
|
41
|
-
## Confirm modal
|
|
42
|
-
|
|
43
|
-
```tsx
|
|
44
|
-
<BaseModal
|
|
45
|
-
cancelButtonProps={{
|
|
46
|
-
'data-track': getTrackData('cancel', '取消', { key: 'confirm', name: '确认' }),
|
|
47
|
-
}}
|
|
48
|
-
okButtonProps={{
|
|
49
|
-
'data-track': getTrackData('confirm', '确定', { key: 'confirm', name: '确认' }),
|
|
50
|
-
}}
|
|
51
|
-
onCancel={handleCancel}
|
|
52
|
-
onOk={handleOk}
|
|
53
|
-
/>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
43
|
## Custom footer
|
|
57
44
|
|
|
58
|
-
|
|
45
|
+
Every business `Button` in custom `footer` needs `data-track`. Do not replace the default footer only to add tracking.
|
|
59
46
|
|
|
60
47
|
## Do not track
|
|
61
48
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
49
|
+
- Column settings only.
|
|
50
|
+
- Table overflow 「更多」 ellipsis icon (menu items inside still need `track`).
|
|
64
51
|
- Buttons hidden by permission (no render → no track).
|
|
65
52
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
When `src/utils/tracking/index.ts` exists, `gen page` already wires:
|
|
53
|
+
**Copy buttons must be tracked** — see shared-tracking §5.
|
|
69
54
|
|
|
70
|
-
|
|
71
|
-
- `cancelTrack` / `okTrack` on `CustomDrawer`
|
|
72
|
-
- `cancelButtonProps` / `okButtonProps` on `BaseModal`
|
|
55
|
+
## After `gen page`
|
|
73
56
|
|
|
74
|
-
|
|
57
|
+
When `src/utils/tracking/index.ts` exists, `gen page` wires toolbar, action edit/delete, drawer, and modal by default. Agent still reviews and adds tracking for extra buttons (copy, batch, custom footer, ProForm). Pass `--no-tracking` only when user explicitly asks.
|
|
75
58
|
|
|
76
|
-
For pages
|
|
59
|
+
For pages **not** from `gen page`, Agent scans and wires the full set per shared-tracking — not a user manual task.
|
|
77
60
|
|
|
78
61
|
## Verification
|
|
79
62
|
|
|
80
|
-
Static scan changed
|
|
81
|
-
|
|
82
|
-
- Every rendered toolbar / action / drawer / confirm button listed above has `track`, `cancelTrack`, `okTrack`, or `data-track`.
|
|
83
|
-
- No `data-track` on excluded controls.
|
|
63
|
+
Static scan changed files: every toolbar / action / copy / drawer / modal / form button has `track`, `cancelTrack`, `okTrack`, or `data-track`.
|
|
@@ -36,7 +36,7 @@ Apply when the project has `src/utils/tracking/index.ts` (or the path in project
|
|
|
36
36
|
- `CustomDrawer` with the default footer needs `cancelTrack` and `okTrack`; custom footers need `data-track` on each business button.
|
|
37
37
|
- `BaseModal` confirm dialogs need `cancelButtonProps` / `okButtonProps` with `'data-track'`.
|
|
38
38
|
- `ProForm` with a visible default submitter needs submit/reset button props; when `submitter={false}`, tracking belongs on the overlay footer only.
|
|
39
|
-
-
|
|
39
|
+
- Require tracking on copy actions; do not require tracking on column settings, table overflow ellipsis icon, or buttons hidden by permission.
|
|
40
40
|
- Missing in-scope button tracking on a changed page is **P1**.
|
|
41
41
|
|
|
42
42
|
## Shared components and regression
|
|
@@ -15,7 +15,7 @@ If `.agents/project/review-rules.md` exists, apply extra domain checks only; do
|
|
|
15
15
|
1. React Hooks: stale closures, incomplete dependencies, request races, updates after unmount, unnecessary rerenders.
|
|
16
16
|
2. API contracts: method/path/params, response unwrapping, pagination, nullability, enum drift, error handling, DTO mismatch.
|
|
17
17
|
3. Permissions: route access, button visibility, mutation authorization, client-only enforcement.
|
|
18
|
-
4. **Tracking** (when `src/utils/tracking/index.ts` or project equivalent exists): scan changed pages for missing `track` / `cancelTrack` / `okTrack` / `data-track` on in-scope buttons—toolbar, action column, permission buttons, drawer and confirm footers, inline form submitters. Flag missing wiring as **P1**. Do not require tracking on
|
|
18
|
+
4. **Tracking** (when `src/utils/tracking/index.ts` or project equivalent exists): scan changed pages for missing `track` / `cancelTrack` / `okTrack` / `data-track` on in-scope buttons—toolbar, action column, permission buttons, drawer and confirm footers (default and custom), inline form submitters, and **copy** actions. Flag missing wiring as **P1**. Do not require tracking on column settings, table overflow ellipsis icon, or permission-hidden buttons. Do not flag handlers that call `track()` when `data-track` is the project standard.
|
|
19
19
|
5. Forms/tables: validation, reset, duplicate submit, refresh after mutation, column-state, long text, empty/error.
|
|
20
20
|
6. Performance (hard checks):
|
|
21
21
|
- New or changed files must not statically `import 'xlsx'`, `@uiw/react-codemirror`, `@codemirror/*`, `echarts`, `@ant-design/charts`, or `react-json-view` at module top level. Those must be `import()`.
|
|
@@ -19,7 +19,7 @@ Do not auto-fix. If `.agents/project/review-rules.md` exists, apply extra domain
|
|
|
19
19
|
5. Empty table values, duplicate-submit guards, permission wrappers, and narrow-screen overflow.
|
|
20
20
|
6. Heavy deps (`xlsx`, editors, charts) are `import()`; nothing new lands in `src/app.ts`.
|
|
21
21
|
7. No `MFTablePro` / table-from-package imports; overlays come from `@mingfuyun/star-allinone`.
|
|
22
|
-
8. **Tracking** (when tracking is configured): every in-scope button has `track`, `cancelTrack`, `okTrack`, or `data-track` per `.agents/skills/shared-tracking/SKILL.md` and `.agents/skills/shared-design-to-page/references/tracking.md`. Check toolbar items, action column entries, standalone permission buttons, drawer default or custom footers, confirm modals,
|
|
22
|
+
8. **Tracking** (when tracking is configured): every in-scope button has `track`, `cancelTrack`, `okTrack`, or `data-track` per `.agents/skills/shared-tracking/SKILL.md` and `.agents/skills/shared-design-to-page/references/tracking.md`. Check toolbar items, action column entries, standalone permission buttons, drawer default or custom footers, confirm modals, inline `ProForm` submitters, and **copy** buttons. Missing wiring is **P1** when the button is user-visible and in scope. Excluded controls (column settings, table overflow ellipsis icon) must not be flagged. Permission-hidden buttons may omit tracking.
|
|
23
23
|
|
|
24
24
|
## Commands
|
|
25
25
|
|
|
@@ -9,6 +9,56 @@ description: User-facing. Connect a galaxy admin app to the shared tracking SDK.
|
|
|
9
9
|
|
|
10
10
|
先确认埋点平台已登记本项目的 `appId`。测试用 `test-<project>`,生产用 `<project>`。不一致时只改配置,不改包。
|
|
11
11
|
|
|
12
|
+
## Agent 必须做的事(不要留给用户手工补)
|
|
13
|
+
|
|
14
|
+
用户说「接入埋点」「补齐埋点」「全部补齐」时,**Agent 负责扫描业务仓库并写入全部按钮埋点**。不要把 wiring 清单丢给用户,不要说「请你在各页 const.tsx 里手动加 track」。
|
|
15
|
+
|
|
16
|
+
完成标准:
|
|
17
|
+
|
|
18
|
+
1. 基础设施(SDK、`tracking/index.ts`、`app.tsx`、请求封装)已就绪。
|
|
19
|
+
2. **全站**下列五类可点击按钮均已带 `track` / `cancelTrack` / `okTrack` / `data-track`(无权限未渲染的除外)。
|
|
20
|
+
3. `pnpm typecheck` 通过。
|
|
21
|
+
4. 向用户汇报已覆盖的文件范围,而不是留 TODO 让用户自己改。
|
|
22
|
+
|
|
23
|
+
### 必须扫描并补齐的五类按钮
|
|
24
|
+
|
|
25
|
+
| # | 范围 | 扫描位置 | 写法 |
|
|
26
|
+
| --- | --- | --- | --- |
|
|
27
|
+
| 1 | **权限相关按钮** | `withAuth` / `AccessButton`;`TableSearchType` 带 `permission`;`TablePermissionActions` | `data-track` 或 `track:` |
|
|
28
|
+
| 2 | **CustomDrawer / HocModal** | 所有 `CustomDrawer`、`BaseModal`(含 `HocModal` 包裹) | 默认底部:`cancelTrack`/`okTrack`;**自定义 footer 每个 Button** 带 `data-track` |
|
|
29
|
+
| 3 | **MFProTable 操作列** | `actionColumn`、`listActionColumn`、`TableActions`、`TablePermissionActions` | `ActionItem.track` |
|
|
30
|
+
| 4 | **ProForm / Form** | `submitter` 默认栏、`submitter.render`、antd `Form` 提交/重置 | `submitButtonProps` / `resetButtonProps` 的 `data-track` |
|
|
31
|
+
| 5 | **复制相关按钮** | 文案含「复制」「一键复制」、`key` 含 `copy`;含复制 IP | `getTrackData('copy', '…', …)` |
|
|
32
|
+
|
|
33
|
+
另需覆盖(同属 Agent 批量任务):
|
|
34
|
+
|
|
35
|
+
- 工具栏 / 批量底部 / 搜索附加按钮(`toolBarRender`、`multiFooter`、`searchButton`)
|
|
36
|
+
- `MFProTable` 查询/重置(表格组件内已处理则不要重复)
|
|
37
|
+
- 抽屉 `submitter={false}` 时,提交在 Drawer 底部,不在 Form 重复
|
|
38
|
+
|
|
39
|
+
### 扫描命令(Agent 自行执行)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
rg "CustomDrawer|BaseModal|HocModal" src/pages src/components -g "*.tsx"
|
|
43
|
+
rg "toolBarRender|actionColumn|listActionColumn|TablePermissionActions" src/pages -g "*.{tsx,ts}"
|
|
44
|
+
rg "withAuth|AccessButton" src/pages -g "*.tsx"
|
|
45
|
+
rg "ProForm|submitter" src/pages -g "*.tsx"
|
|
46
|
+
rg "复制|copy|Copy" src/pages src/components -g "*.tsx"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
对每个命中文件:**打开、判断是否在五类范围内、补全、保存**。历史页与 `gen page` 新页同一标准。
|
|
50
|
+
|
|
51
|
+
### 不要做的「半套接入」
|
|
52
|
+
|
|
53
|
+
- ❌ 只建 `tracking/index.ts` 和 SDK,不扫页面按钮
|
|
54
|
+
- ❌ 只改一两个示例页,告诉用户「其余页按同样方式手动加」
|
|
55
|
+
- ❌ 在组件层做 track 自动推断(不改 `withAuth` / `TableActions` 自动生成 track)
|
|
56
|
+
- ❌ 把复制按钮排除在补齐范围外
|
|
57
|
+
|
|
58
|
+
仍不上报:**列设置**、表格 **「更多」省略号**(仅展开菜单的 icon;菜单内各项仍要 track)。
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
12
62
|
## 1. 更新能力包
|
|
13
63
|
|
|
14
64
|
依赖至少 `0.4.0`。这一版才有 `createTracking`、`TRACKING_REPORT_URLS`,以及 `CustomDrawer` 的 `cancelTrack` / `okTrack`。
|
|
@@ -99,17 +149,15 @@ Umi:
|
|
|
99
149
|
|
|
100
150
|
在项目自己的请求封装里,业务 `code` 非 0 或 HTTP 失败时调用 `reportApiTracking`。成功不报。字段:去掉 query 的 `url`、大写 `method`、`duration`、`success: false`、`status`、`errorMessage`。保留原来的 `message.error`。页面不要直接调 axios。
|
|
101
151
|
|
|
102
|
-
###
|
|
152
|
+
### 按钮写法(Agent 批量写入业务代码)
|
|
103
153
|
|
|
104
|
-
`getTrackData(action, name, { key, name })` 生成 `data-track` JSON。`id` 用下划线,展示名用 `-` 连接。点击由 SDK 监听 `data-track`,业务代码不要再调 `track`。
|
|
154
|
+
`getTrackData(action, name, { key, name })` 生成 `data-track` JSON。`id` 用下划线,展示名用 `-` 连接。点击由 SDK 监听 `data-track`,业务代码不要再调 `track()`。
|
|
105
155
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
#### 权限按钮
|
|
156
|
+
#### 1. 权限相关按钮
|
|
109
157
|
|
|
110
158
|
`withAuth` 会把除 `permission`、`fallback` 以外的 props 传给原按钮。无权限时组件不渲染,不会上报。
|
|
111
159
|
|
|
112
|
-
|
|
160
|
+
工具栏、批量底部、搜索附加按钮走 `TableSearchType.track`,`MFProTable` 把它写成 `data-track`:
|
|
113
161
|
|
|
114
162
|
```tsx
|
|
115
163
|
{
|
|
@@ -122,7 +170,7 @@ Umi:
|
|
|
122
170
|
}
|
|
123
171
|
```
|
|
124
172
|
|
|
125
|
-
页面上单独的 `withAuth(Button)
|
|
173
|
+
页面上单独的 `withAuth(Button)`:
|
|
126
174
|
|
|
127
175
|
```tsx
|
|
128
176
|
<AccessButton
|
|
@@ -135,11 +183,13 @@ Umi:
|
|
|
135
183
|
</AccessButton>
|
|
136
184
|
```
|
|
137
185
|
|
|
138
|
-
|
|
186
|
+
`TablePermissionActions` 的 `actionList` 每项加 `track`。
|
|
187
|
+
|
|
188
|
+
#### 2. CustomDrawer、HocModal
|
|
139
189
|
|
|
140
190
|
`HocModal` 只控制显隐,不渲染按钮。埋点写在它包住的 `CustomDrawer` 或 `BaseModal` 上。
|
|
141
191
|
|
|
142
|
-
|
|
192
|
+
**默认底部** — 用 `cancelTrack` / `okTrack`,不要整段替换 `footer`:
|
|
143
193
|
|
|
144
194
|
```tsx
|
|
145
195
|
<CustomDrawer
|
|
@@ -150,49 +200,33 @@ Umi:
|
|
|
150
200
|
/>
|
|
151
201
|
```
|
|
152
202
|
|
|
153
|
-
|
|
203
|
+
**自定义 footer** — 每个业务 Button 带 `data-track`(取消、确定、关闭、预览、复制 IP 等)。
|
|
154
204
|
|
|
155
|
-
`BaseModal`
|
|
205
|
+
`BaseModal` 若无 `cancelButtonProps` 类型,用**自定义 footer** + `data-track`。
|
|
156
206
|
|
|
157
|
-
|
|
158
|
-
<BaseModal
|
|
159
|
-
cancelButtonProps={{
|
|
160
|
-
'data-track': getTrackData('cancel', '取消', { key: 'confirm', name: '确认' }),
|
|
161
|
-
}}
|
|
162
|
-
okButtonProps={{
|
|
163
|
-
'data-track': getTrackData('confirm', '确定', { key: 'confirm', name: '确认' }),
|
|
164
|
-
}}
|
|
165
|
-
onCancel={handleCancel}
|
|
166
|
-
onOk={handleOk}
|
|
167
|
-
/>
|
|
168
|
-
```
|
|
207
|
+
#### 3. MFProTable 操作列
|
|
169
208
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
`actionColumn` 的配置在页面 `const.tsx`。给 `ActionItem` 增加 `track?: string`,和 `permission` 放在一起。模块固定 `{ key: 'action', name: '操作' }`,`action` 用该项的 `key`,`name` 用按钮文案。
|
|
209
|
+
`actionColumn` 在页面 `const.tsx`。给 `ActionItem` 增加 `track`:
|
|
173
210
|
|
|
174
211
|
```tsx
|
|
175
212
|
{
|
|
176
|
-
key: '
|
|
177
|
-
permission: FULL_MENU.example.
|
|
178
|
-
track: getTrackData('
|
|
179
|
-
getText: () => '
|
|
180
|
-
onClick:
|
|
213
|
+
key: 'edit',
|
|
214
|
+
permission: FULL_MENU.example.edit,
|
|
215
|
+
track: getTrackData('edit', '编辑', { key: 'action', name: '操作' }),
|
|
216
|
+
getText: () => '编辑',
|
|
217
|
+
onClick: handleEdit,
|
|
181
218
|
}
|
|
182
219
|
```
|
|
183
220
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
- 行内 `<a>` 加 `data-track={action.track}`。
|
|
187
|
-
- 超出 `maxCount` 收进下拉时,菜单项 `label` 用 `<span data-track={action.track}>`。不要给「更多」省略号按钮加埋点。
|
|
221
|
+
业务仓 `TableActions` 已支持 `data-track={action.track}`。不要给「更多」省略号 icon 加埋点;下拉菜单内各项仍要 `track`。
|
|
188
222
|
|
|
189
|
-
|
|
223
|
+
查询/重置:`MFProTable` 内为 `filter_query`/`查询`、`filter_reset`/`重置`(ProTable 重置 key 为 `rest`)。
|
|
190
224
|
|
|
191
|
-
#### ProForm、Form
|
|
225
|
+
#### 4. ProForm、Form
|
|
192
226
|
|
|
193
|
-
|
|
227
|
+
抽屉内 `ProForm` 若 `submitter={false}`,提交在 `CustomDrawer` 底部,按上一节写,**不要在 Form 里重复**。
|
|
194
228
|
|
|
195
|
-
|
|
229
|
+
默认提交栏:
|
|
196
230
|
|
|
197
231
|
```tsx
|
|
198
232
|
<ProForm
|
|
@@ -207,9 +241,24 @@ Umi:
|
|
|
207
241
|
/>
|
|
208
242
|
```
|
|
209
243
|
|
|
210
|
-
`submitter.render`
|
|
244
|
+
`submitter.render` 或 antd `Form` 自定义按钮:每个提交/重置 Button 单独 `data-track`。
|
|
211
245
|
|
|
212
|
-
|
|
246
|
+
#### 5. 复制相关按钮
|
|
247
|
+
|
|
248
|
+
**必须上报**。含操作列「复制」、群看板「一键复制」、复制 IP 等。
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
{
|
|
252
|
+
key: 'action-copy',
|
|
253
|
+
track: getTrackData('copy', '复制', { key: 'action', name: '操作' }),
|
|
254
|
+
getText: () => '复制',
|
|
255
|
+
onClick: handleCopy,
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
track: getTrackData('copy', '复制IP', { key: 'toolbar', name: '群看板' })
|
|
261
|
+
```
|
|
213
262
|
|
|
214
263
|
## 不要做的事
|
|
215
264
|
|
|
@@ -218,6 +267,8 @@ antd `Form` 的提交、重置按钮同样写 `data-track`。只上报会触发
|
|
|
218
267
|
- 不要在包外重写队列。上限 50 条、失败补报已经在 `createTracking` 里。
|
|
219
268
|
- 不要上报成功请求。
|
|
220
269
|
- 不要为了埋点改用户接口或请求错误提示。
|
|
270
|
+
- **不要**在组件层做 track 自动推断。
|
|
271
|
+
- **不要**只完成基础设施就把按钮埋点留给用户。
|
|
221
272
|
|
|
222
273
|
## 验证
|
|
223
274
|
|
|
@@ -226,6 +277,6 @@ antd `Form` 的提交、重置按钮同样写 `data-track`。只上报会触发
|
|
|
226
277
|
1. 页面请求了 OSS 上的脚本,并且出现 `window.TrackingSDK`。
|
|
227
278
|
2. 进入业务页、初始状态完成后存在 `window.__tracker`。`/` 上可以还没有。
|
|
228
279
|
3. 一次失败请求发出事件名 `api_request`。
|
|
229
|
-
4.
|
|
280
|
+
4. 五类按钮(含复制)带 `data-track` / `cancelTrack` / `okTrack`。
|
|
230
281
|
|
|
231
282
|
`appId` 与平台不一致时,只改 `src/utils/tracking/index.ts`。
|