diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts
index 3982bdc33e5..35c6ca4b682 100644
--- a/packages/grafana-data/src/types/featureToggles.gen.ts
+++ b/packages/grafana-data/src/types/featureToggles.gen.ts
@@ -813,6 +813,10 @@ export interface FeatureToggles {
* Enables less memory intensive Elasticsearch result parsing
*/
elasticsearchImprovedParsing?: boolean;
+ /**
+ * Enables creating alert rules from a panel using a drawer UI
+ */
+ createAlertRuleFromPanel?: boolean;
/**
* Shows defined connections for a data source in the plugins detail page
*/
diff --git a/public/app/features/alerting/unified/components/panel-alerts-tab/NewRuleFromPanelButton.tsx b/public/app/features/alerting/unified/components/panel-alerts-tab/NewRuleFromPanelButton.tsx
index ccd057e4526..44224012093 100644
--- a/public/app/features/alerting/unified/components/panel-alerts-tab/NewRuleFromPanelButton.tsx
+++ b/public/app/features/alerting/unified/components/panel-alerts-tab/NewRuleFromPanelButton.tsx
@@ -1,9 +1,11 @@
+import { useState } from 'react';
import { useLocation } from 'react-router-dom-v5-compat';
import { useAsync } from 'react-use';
import { urlUtil } from '@grafana/data';
import { Trans, t } from '@grafana/i18n';
-import { Alert, Button, LinkButton } from '@grafana/ui';
+import { config } from '@grafana/runtime';
+import { Alert, Button, Drawer, LinkButton } from '@grafana/ui';
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
import { useSelector } from 'app/types/store';
@@ -29,6 +31,7 @@ export const NewRuleFromPanelButton = ({ dashboard, panel, className }: Props) =
// Templating variables are required to update formValues on each variable's change. It's used implicitly by the templating engine
[panel, dashboard, templating]
);
+ const [isOpen, setIsOpen] = useState(false);
if (loading) {
return (
@@ -59,6 +62,44 @@ export const NewRuleFromPanelButton = ({ dashboard, panel, className }: Props) =
returnTo: location.pathname + location.search,
});
+ const shouldUseDrawer = config.featureToggles.createAlertRuleFromPanel;
+
+ if (shouldUseDrawer) {
+ if (isOpen) {
+ return (
+ <>
+
+ setIsOpen(false)}
+ >
+ Content coming soon...
+
+ >
+ );
+ }
+
+ return (
+
+ );
+ }
+
return (
scenesPanelToRuleFormValues(panel), [panel]);
+ const [isOpen, setIsOpen] = useState(false);
if (loading) {
return (
@@ -55,6 +57,34 @@ export const ScenesNewRuleFromPanelButton = ({ panel, className }: ScenesNewRule
locationService.push(ruleFormUrl);
};
+ const shouldUseDrawer = config.featureToggles.createAlertRuleFromPanel;
+
+ if (shouldUseDrawer) {
+ return (
+ <>
+
+ {isOpen && (
+ setIsOpen(false)}
+ >
+ Content coming soon...
+
+ )}
+ >
+ );
+ }
+
return (