diff --git a/.betterer.results b/.betterer.results
index b03dac144aa..4df170e7dc1 100644
--- a/.betterer.results
+++ b/.betterer.results
@@ -2387,10 +2387,8 @@ exports[`better eslint`] = {
],
"public/app/features/alerting/unified/components/rules/CloudRules.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
- [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "1"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "2"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "3"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "4"]
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "1"],
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "2"]
],
"public/app/features/alerting/unified/components/rules/EditRuleGroupModal.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
diff --git a/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx b/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx
index dee970cf598..6bbac094cbb 100644
--- a/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx
+++ b/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx
@@ -45,6 +45,10 @@ export const GroupAndNamespaceFields = ({ rulesSourceName }: Props) => {
@@ -71,7 +75,16 @@ export const GroupAndNamespaceFields = ({ rulesSourceName }: Props) => {
}}
/>
-
+
(
- New recording rule
+
+ New data source-managed recording rule
+
);
}
diff --git a/public/app/features/alerting/unified/components/rules/NoRulesCTA.tsx b/public/app/features/alerting/unified/components/rules/NoRulesCTA.tsx
index 38a4da4ce30..f33db5d9962 100644
--- a/public/app/features/alerting/unified/components/rules/NoRulesCTA.tsx
+++ b/public/app/features/alerting/unified/components/rules/NoRulesCTA.tsx
@@ -1,8 +1,65 @@
-import { EmptyState, LinkButton, Stack, TextLink } from '@grafana/ui';
-import { Trans } from 'app/core/internationalization';
+import { config } from '@grafana/runtime';
+import { Dropdown, EmptyState, LinkButton, Menu, MenuItem, Stack, TextLink } from '@grafana/ui';
+import { Trans, t } from 'app/core/internationalization';
import { useRulesAccess } from '../../utils/accessControlHooks';
+const RecordingRulesButtons = () => {
+ const { canCreateGrafanaRules, canCreateCloudRules } = useRulesAccess();
+ const grafanaRecordingRulesEnabled = config.featureToggles.grafanaManagedRecordingRules;
+ const canCreateAll = canCreateGrafanaRules && canCreateCloudRules && grafanaRecordingRulesEnabled;
+
+ // User can create Grafana and DS-managed recording rules, show a dropdown
+ if (canCreateAll) {
+ return (
+
+
+
+
+ }
+ >
+
+ New recording rule
+
+
+ );
+ }
+
+ // ...Otherwise, just show the buttons for each type of recording rule
+ // (this will just be one or the other)
+ return (
+ <>
+ {canCreateGrafanaRules && grafanaRecordingRulesEnabled && (
+
+
+ New Grafana-managed recording rule
+
+
+ )}
+ {canCreateCloudRules && (
+
+
+ New data source-managed recording rule
+
+
+ )}
+ >
+ );
+};
+
export const NoRulesSplash = () => {
const { canCreateGrafanaRules, canCreateCloudRules } = useRulesAccess();
const canCreateAnything = canCreateGrafanaRules || canCreateCloudRules;
@@ -14,17 +71,13 @@ export const NoRulesSplash = () => {
variant="call-to-action"
button={
canCreateAnything ? (
-
+
{canCreateAnything && (
New alert rule
)}
- {canCreateCloudRules && (
-
- New recording rule
-
- )}
+
) : null
}
diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json
index ee429b59821..2deedc01267 100644
--- a/public/locales/en-US/grafana.json
+++ b/public/locales/en-US/grafana.json
@@ -379,6 +379,8 @@
"list-view": {
"empty": {
"new-alert-rule": "New alert rule",
+ "new-ds-managed-recording-rule": "New data source-managed recording rule",
+ "new-grafana-recording-rule": "New Grafana-managed recording rule",
"new-recording-rule": "New recording rule",
"provisioning": "You can also define rules through file provisioning or Terraform. <2>Learn more2>"
},