tju-yxq opened a new pull request, #3166:
URL: https://github.com/apache/rocketmq-dashboard/pull/3166
## What happened
Maintenance windows can currently only be created and ended. Once a window
exists, its schedule and scope cannot be changed.
This is inconvenient in normal operations:
- a window created too short must be ended and recreated;
- a wrong recurring time zone, weekday, or recurrence end must be recreated;
- a too-broad scope (for example, all instances instead of one) creates a
new record and loses the original creator.
The backend had no update endpoint: `AlertSilenceController` supported list,
create, and delete only.
## Change
Backend:
- Add `PUT /api/alert-silences/{id}`.
- Add `AlertSilenceService.update(...)`, which:
- rejects missing IDs;
- returns 404 when the window no longer exists;
- reuses the exact create validation for time window, recurrence, time
zone, weekdays, recurrence end, labels, and reason;
- preserves the existing ID and original creator;
- records an `UPDATE_ALERT_SILENCE` audit entry.
- Add repository `findById` and `update`; the MyBatis implementation updates
the existing row and fails if no row changes.
- Extract create/update input normalization into a shared builder so create
and edit cannot drift.
Frontend:
- Add an **Edit** action for each maintenance window.
- Prefill the existing form with domain, rule, instance, labels, start/end,
recurrence, time zone, weekdays, recurrence end, and reason.
- Reuse the same create form and validation; switching the modal to edit
mode changes the primary action to Save.
- Reset edit state when the dialog is closed or after a successful save.
- Add API/service methods and mock-mode behavior for updating a silence.
Tests:
- Service: update normalization, original creator preservation, audit write,
unknown/missing ID rejection.
- Repository: update row mapping and no-row failure.
- Controller: `PUT` request binding and response.
- API: update endpoint contract.
- UI: prefill an existing recurring window, submit the updated schedule, and
refresh the list.
## Verification
Focused backend:
```
cd server
mvn -q
'-Dtest=AlertSilenceServiceTest,MybatisPlusAlertSilenceRepositoryTest,AlertSilenceControllerTest'
test
mvn -q checkstyle:check
```
Focused frontend:
```
cd web
npm test -- SystemAlertsPage.test.tsx ops.test.ts opsService.test.ts --run
```
Result: 4 files / 60 tests passed.
Lint/build:
```
npm run lint -- --quiet
npm run build
```
Lint reported 0 errors and 10 pre-existing warnings elsewhere. The
production build completed successfully.
`git diff --check` passed before commit.
Production/config additions are 164 lines (67 backend, 97 frontend),
naturally exceeding 100 lines without unrelated padding.
Closes #3165
--
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]