Frun1na opened a new pull request, #6801:
URL: https://github.com/apache/rocketmq-dashboard/pull/6801
### Which Issue(s) This PR Fixes
- Fixes #6800
### Brief Description
`GET /api/audit-logs` takes `startDate` and `endDate` as independent
optional parameters (`AuditController.queryLogs`) and both filter builders
already emit a single end (`buildAuditFilters` in `audit.tsx:79-87`,
`buildTimelineFilter` in `ResourceOperationTimelineModal.tsx:69-70`), but the
two `DatePicker.RangePicker` controls had no `allowEmpty`: Ant Design defaults
it to `[false, false]`, so the range stays pending until both ends are set and
a one-sided "everything since that day" filter cannot be entered on the audit
page (`audit.tsx:498`) or in the resource timeline modal
(`ResourceOperationTimelineModal.tsx:174`). Both pickers now accept one
boundary, the treatment #6637 applied to the system alerts page and #6792
applied to the deliveries filter. No behaviour changes for a complete range.
### How Did You Test This Change?
```
$ ./wb test --tree worktrees/rocketmq-dashboard/audit-open-time-filters
✓ npx eslint src/pages/ops/ResourceOperationTimelineModal.tsx
src/pages/ops/__tests__/AuditPage.test.tsx
src/pages/ops/__tests__/ResourceOperationTimelineModal.test.tsx
src/pages/ops/audit.tsx
✓ npx prettier --check …
✓ npx vitest related --run …
✓ npx tsc -b
Test Files 3 passed (3)
Tests 33 passed (33)
```
The new cases pick a single start day in the rendered picker (audit page:
calendar cell → confirm → blur; timeline: type the date → Enter → blur) and
assert the service receives `startDate` with no `endDate`.
The new tests fail without the fix:
```
$ npx vitest run src/pages/ops/__tests__/AuditPage.test.tsx
FAIL src/pages/ops/__tests__/AuditPage.test.tsx > Audit page >
appliesASingleDateBoundaryToTheAuditFilterTest
AssertionError: expected last "vi.fn()" call to have been called with [
ObjectContaining{…} ]
❯ src/pages/ops/__tests__/AuditPage.test.tsx:325:43
$ npx vitest run
src/pages/ops/__tests__/ResourceOperationTimelineModal.test.tsx
FAIL src/pages/ops/__tests__/ResourceOperationTimelineModal.test.tsx >
ResourceOperationTimelineModal >
appliesASingleDateBoundaryToTheTimelineQueryTest
AssertionError: expected last "vi.fn()" call to have been called with [ {
page: 1, pageSize: 20, …(4) } ]
❯ src/pages/ops/__tests__/ResourceOperationTimelineModal.test.tsx:254:43
```
Both assertions read the arguments of the last `listAuditRecords` call, and
in both the diff is the missing `startDate`: without `allowEmpty` the picker
never commits the single boundary, so the query the assertions expect is never
issued and the comparison flips to red.
### Other consumers
The two remaining range pickers in the console that carry a time panel are
already fixed: the system alerts page (#6637) and the deliveries filter
(#6792). The DLQ page's two windows (`dlq.tsx:711`, `:842`) are not in this
family: their state is a required `[Dayjs, Dayjs]` pair with a default window
and both ends are always sent, which is the intended bound for a destructive
resend and for the matching export. No other filter in `web/src` hands a
one-sided boundary to an endpoint that accepts independent ends.
### 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`
- [ ] 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]