apache / apache/rocketmq-dashboard
[Studio][Bug] Cancelled maintenance-window dialog keeps its form values and scopes the next silence to them
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 683
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 58
Description
## Problem
The maintenance windows dialog on `/ops/system-alerts` (`web/src/pages/ops/systemAlerts.tsx`) keeps its create form mounted across open/close cycles. The cancel path (`onCancel`, line ~828) only closes the dialog: there is no `resetFields()` and no `destroyOnHidden`. The form is only reset on the create-success path (line ~424).
`openSilences` (lines 376-380) also does not reset the form when reopening.
## Evidence
1. Open the dialog, type a rule ID (`42`), a label scope (`brokerName=broker-a`) and window times.
2. Cancel (or press Esc / click the mask).
3. Reopen the dialog: the rule ID, label scope, recurrence and times are still filled.
4. Change only the times and click create: `createAlertSilence` is called with the stale `ruleId: 42` and `labels: {brokerName: 'broker-a'}` from the cancelled attempt.
A regression test demonstrating the residue and the mis-scoped payload on the unfixed code lives in the linked PR.
## Impact
The silence is created on the wrong scope: the operator believes they silenced all instance-wide alerts for the window, but only the previous attempt's rule/labels are silenced, so the alert notifications the window was meant to suppress keep firing. Residual DAILY/WEEKLY recurrence values can also create an unintended recurring silence.
## Expected behavior
Dismissing the dialog without creating resets the form to its initial values, so the next attempt starts from a clean scope.
## Related work
The create-success path already resets the form, and the other dialogs in the codebase reset on cancel (`cluster/index.tsx` NameServer create, `instance/index.tsx` create/edit, the reset-password dialog in `studio/UserManagement.tsx`) or use `destroyOnHidden`; this dialog is the only create form that keeps values across a cancel.
The open feature requests #3165, #3166 and #4052 target editing existing maintenance windows — a different gap from the cancelled-attempt residue recorded here.
## PR
Fix: #4254.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in web/src/pages/ops/systemAlerts.tsx, focusing on openSilences and the onCancel path around the referenced lines; compare them with the existing create-success reset. Review the regression test mentioned in the linked PR, then verify that dismissing and reopening starts with initial values and that the resulting createAlertSilence payload contains no cancelled-attempt rule or labels.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100