Alerting: Rule history restore feature (#100609)

* Restore feature: wip

* Refactor modal to separate component

* fix restoring from the drawer

* rename components folder to version-history, and move version-utils.file there

* skip fetching rule when uid is empty, add returnTo when restoring manually

* Fix drawer fetching infinitely

* Move drawer to separate file

* add tracking for restore success and restore failure

* Fix name of error interaction

* Add `compare` to each row in version history

* Add warning when manually restoring and trigger form validation

* Fix initial validation for contact point selector

* Wait for successful fetch before potential error

* Add disabled state when loading

* Fix loading check for contact point selector

* Fix typo

* Move hook to separate file and move other method into utils

* Update imports and remove manual state management

* Fix infinite render

* Remove onError from dep array

* Use separate flag for showing manual restore alert

* Rename to createdAt

* add and use ability to restore to check if retore is allowed

* Fix test and add isGrafanaManagedAlertRule to the ability check

* Address PR feedback

* Change to isManualRestore for trigger check

* udpate AlertRuleAction.Restore ability

* make the alertingRuleVersionHistoryRestore ff , enabled by default

* fix ff

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
This commit is contained in:
Sonia Aguilar
2025-02-28 13:14:23 +02:00
committed by GitHub
co-authored by Tom Ratcliffe
parent ae2074ef55
commit e73b78a134
24 changed files with 558 additions and 175 deletions
+2 -1
View File
@@ -1752,10 +1752,11 @@ var (
Name: "alertingRuleVersionHistoryRestore",
Description: "Enables the alert rule version history restore feature",
FrontendOnly: true,
Stage: FeatureStageExperimental,
Stage: FeatureStageGeneralAvailability,
Owner: grafanaAlertingSquad,
HideFromAdminPage: true,
HideFromDocs: true,
Expression: "true", // enabled by default
},
{
Name: "newShareReportDrawer",
+1 -1
View File
@@ -232,6 +232,6 @@ newLogsPanel,experimental,@grafana/observability-logs,false,false,true
grafanaconThemes,experimental,@grafana/grafana-frontend-platform,false,true,false
pluginsCDNSyncLoader,experimental,@grafana/plugins-platform-backend,false,false,false
alertingJiraIntegration,experimental,@grafana/alerting-squad,false,false,true
alertingRuleVersionHistoryRestore,experimental,@grafana/alerting-squad,false,false,true
alertingRuleVersionHistoryRestore,GA,@grafana/alerting-squad,false,false,true
newShareReportDrawer,experimental,@grafana/sharing-squad,false,false,false
rendererDisableAppPluginsPreload,experimental,@grafana/sharing-squad,false,false,true
1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
232 grafanaconThemes experimental @grafana/grafana-frontend-platform false true false
233 pluginsCDNSyncLoader experimental @grafana/plugins-platform-backend false false false
234 alertingJiraIntegration experimental @grafana/alerting-squad false false true
235 alertingRuleVersionHistoryRestore experimental GA @grafana/alerting-squad false false true
236 newShareReportDrawer experimental @grafana/sharing-squad false false false
237 rendererDisableAppPluginsPreload experimental @grafana/sharing-squad false false true
+5 -4
View File
@@ -405,19 +405,20 @@
{
"metadata": {
"name": "alertingRuleVersionHistoryRestore",
"resourceVersion": "1738831836776",
"resourceVersion": "1740740039764",
"creationTimestamp": "2025-01-16T14:08:12Z",
"annotations": {
"grafana.app/updatedTimestamp": "2025-02-06 08:50:36.776739 +0000 UTC"
"grafana.app/updatedTimestamp": "2025-02-28 10:53:59.764894 +0000 UTC"
}
},
"spec": {
"description": "Enables the alert rule version history restore feature",
"stage": "experimental",
"stage": "GA",
"codeowner": "@grafana/alerting-squad",
"frontend": true,
"hideFromAdminPage": true,
"hideFromDocs": true
"hideFromDocs": true,
"expression": "true"
}
},
{