Repository navigation
Conversation
On the incident page the alert sidebar got undefined for setChangeStatusAlert, setDismissModalAlert and setRunWorkflowModalAlert, and the page did not render the modals. "Change Status", "Dismiss" and "Run Workflow" closed the sidebar and did nothing. Keep the state for these actions and render the modals, as the alerts feed does. The dismiss and change-status modals revalidate only the /alert* SWR keys, so refetch the incident alerts when they close. Part of keephq#5125
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5125. Some sidebar actions are still left, see "Not in this PR".
Problem
On the incident page, open an alert from the incident's alert list. In the
alert sidebar, click "Change Status", "Dismiss" or "Run Workflow". The sidebar
closes and nothing else happens. No modal opens and no request goes to the
backend.
IncidentAlertspassesundefinedforsetChangeStatusAlert,setDismissModalAlertandsetRunWorkflowModalAlerttoAlertSidebar, and itdoes not render the modals.
AlertMenucallssetChangeStatusAlert?.(alert),which does nothing, and then closes the sidebar. The same actions work in the
alerts feed, because
alerts.tsxkeeps this state and renders the modals.Fix
IncidentAlertsnow keeps the state for the three actions and rendersManualRunWorkflowModal,AlertDismissModalandAlertChangeStatusModal, thesame way the feed does.
The dismiss and change-status modals revalidate only the
/alert*SWR keys.The incident alert list uses
/incidents/{id}/alerts, so the page callsmutateAlerts()when these modals close. Without it the list shows the oldstatus until the next poll.
Tests
incident-alerts-sidebar.test.tsx: each of the three sidebaractions opens its modal, and closing the dismiss or change-status modal
refetches the incident alerts. They fail on
mainand pass with this change.incident-alerts.test.tsxmocksManualRunWorkflowModal, so its SWR fetchdoes not add
act(...)warnings.incident page sidebar, "Change Status" sends
POST /alerts/enrich,"Dismiss" sends
POST /alerts/batch_enrich, "Run Workflow" opens its modal,and the incident alert list shows the new status.
Not in this PR
Other sidebar actions on the incident page still do nothing: "History",
"Enrich", "View Alert", provider methods and "Correlate Incident". The first
four set URL parameters that only the feed page reads, and the incident page
does not render an incident selector. They need a different fix, so I kept
this PR small.