Frun1na opened a new pull request, #6783:
URL: https://github.com/apache/rocketmq-dashboard/pull/6783
### Which Issue(s) This PR Fixes
- Fixes #6782
### Brief Description
The audit page cannot name five operation codes and one resource type the
server writes, so they render through the English-only title-cased fallback
with the `default`/`other` presentation instead of a localized name.
`AclService.java:394` writes `PUSH_ACL_TO_BROKER` (added with the ACL push in
#6693) and `NotificationOutboxService.java:265`, `:400` and `:580` write
`DELIVER_ALERT_NOTIFICATION`, `RETRY_ALERT_NOTIFICATION`,
`FAIL_ALERT_NOTIFICATION` and `RETRY_ALERT_NOTIFICATION_MANUALLY`; those rows
carry the resource type `ALERT_NOTIFICATION`
(`NotificationOutboxService.java:586`). `auditPresentation.ts` maps 45
operation codes and 17 resource types — all of them named in both languages —
but none of these six, so on a Chinese-locale deployment their rows read `Push
Acl To Broker` / `Deliver Alert Notification` while every neighbouring row
reads 创建 Topic / 更新集群配置. This adds the six entries with their categories (the
ACL push with the other `security` operatio
ns, the notification operations with the other `alerts` operations) and the
matching `audit.op.*` / `audit.res.*` entries in both languages.
### How Did You Test This Change?
```
$ ./wb test --tree worktrees/rocketmq-dashboard/audit-operation-names
--filter src/pages/ops/__tests__/auditPresentation.test.ts
✓ npx eslint src/i18n/translations.ts
src/pages/ops/__tests__/auditPresentation.test.ts
src/pages/ops/auditPresentation.ts
✓ npx prettier --check src/i18n/translations.ts
src/pages/ops/__tests__/auditPresentation.test.ts
src/pages/ops/auditPresentation.ts
✓ npx vitest run src/pages/ops/__tests__/auditPresentation.test.ts
✓ npx tsc -b
$ npx vitest run src/pages/ops/__tests__/auditPresentation.test.ts
Test Files 1 passed (1)
Tests 13 passed (13)
```
`npx vitest run src/i18n/__tests__/translations.test.ts` also passes with
the six new key pairs (it gates that every key carries both languages).
The new test fails without the fix:
```
$ npx vitest run src/pages/ops/__tests__/auditPresentation.test.ts
FAIL src/pages/ops/__tests__/auditPresentation.test.ts > audit
presentation helpers >
namesAndLocalizesTheOperationsTheServerWritesOutsideTheToolCatalogTest
Expected: "audit.op.PUSH_ACL_TO_BROKER"
Received: undefined
❯ src/pages/ops/__tests__/auditPresentation.test.ts:130:37
expect(presentation.labelKey).toBe(`audit.op.${code}`);
Test Files 1 failed (1)
Tests 1 failed | 12 passed (13)
```
The assertion reads each presentation's `labelKey` and the matching
`audit.op.*` entry in both languages: with the map entries removed the lookup
falls back to `formatAuditCode`, so `labelKey` is `undefined` and the assertion
flips to red — which is exactly the path the page renders (`audit.tsx:241`
prints `presentation.label` when there is no `labelKey`).
### Other consumers
The same two maps feed the operation column (`audit.tsx:241`), the
operation-type filter options (`audit.tsx:461`), the resource column and its
filter options, `describeAuditRecord` (the CSV export and record descriptions)
and `isControlPlaneAuditRecord`'s category — all of them are fixed by the map
entries, and all of them were verified by the assertion on
`labelKey`/`category`.
Not changed here: the `VERB_RESOURCE` codes the AI tool filter writes
(`ToolAuditFilter.java:54` through `ToolExecutionContext.operationType()`), 43
distinct codes today such as `LIST_TOPIC`. They keep the title-cased fallback
in this PR. That namespace is generated from the tool catalog's
`cli.verb`/`cli.resource` pairs, so it should be derived from the catalog (and
re-checked when the catalog changes) rather than hand-listed here — a separate
change from naming the six hand-written codes above.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [ ] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]