-
-
- Data source-managed
-
- {dataSourcesLoading.length ? (
-
- ) : (
-
- )}
-
+
+
+
+
+ Data source-managed
+
+ {dataSourcesLoading.length ? (
+
+ ) : (
+
+ )}
+
+ {canMigrateToGMA && }
+
+
+
-
+
- {pageItems.map(({ group, namespace }) => {
- return (
-
- );
- })}
+ {pageItems.map(({ group, namespace }) => (
+
+ ))}
- {!hasDataSourcesConfigured &&
There are no Prometheus or Loki data sources configured.
}
- {hasDataSourcesConfigured && !hasDataSourcesLoading && !hasNamespaces &&
No rules found.
}
+ {!hasDataSourcesConfigured && (
+
+
+ There are no Prometheus or Loki data sources configured
+
+
+ )}
+ {hasDataSourcesConfigured && !hasDataSourcesLoading && !hasNamespaces && (
+
+ No rules found.
+
+ )}
{!hasSomeResults && hasDataSourcesLoading &&
}
({
export function CreateRecordingRuleButton() {
const [createCloudRuleSupported, createCloudRuleAllowed] = useAlertingAbility(AlertingAction.CreateExternalAlertRule);
-
const location = useLocation();
const canCreateCloudRules = createCloudRuleSupported && createCloudRuleAllowed;
@@ -144,3 +169,20 @@ export function CreateRecordingRuleButton() {
}
return null;
}
+
+function MigrateToGMAButton() {
+ const importUrl = createRelativeUrl('/alerting/import-datasource-managed-rules');
+ return (
+
+
+ Import to Grafana-managed rules
+
+
+
+ );
+}
diff --git a/public/app/features/alerting/unified/utils/navigation.ts b/public/app/features/alerting/unified/utils/navigation.ts
index ba103c47639..0c72f7ae8c1 100644
--- a/public/app/features/alerting/unified/utils/navigation.ts
+++ b/public/app/features/alerting/unified/utils/navigation.ts
@@ -7,9 +7,9 @@ import { createRelativeUrl } from './url';
type QueryParams = ConstructorParameters[0];
-export const createListFilterLink = (values: Array<[string, string]>) => {
+export const createListFilterLink = (values: Array<[string, string]>, options?: { skipSubPath?: boolean }) => {
const params = new URLSearchParams([['search', values.map(([key, value]) => `${key}:"${value}"`).join(' ')]]);
- return createRelativeUrl(`/alerting/list`, params);
+ return createRelativeUrl(`/alerting/list`, params, { skipSubPath: options?.skipSubPath });
};
export const alertListPageLink = (queryParams: Record = {}, options?: { skipSubPath?: boolean }) =>
diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json
index 9fb06287864..beb46edc937 100644
--- a/public/locales/en-US/grafana.json
+++ b/public/locales/en-US/grafana.json
@@ -582,6 +582,44 @@
"group-loader": {
"group-load-failed": "Failed to load rules from group {{ groupName }} in {{ namespaceName }}"
},
+ "import-from-dsrules": {
+ "description-folder-import-rules": "The folder to import the rules to"
+ },
+ "import-to-gma": {
+ "action-button": "Import",
+ "alert-rules": "Alert rules",
+ "confirm-modal": {
+ "confirm": "Yes, import",
+ "title": "Confirm import"
+ },
+ "datasource": {
+ "label": "Data source",
+ "required-message": "Please select a datasource"
+ },
+ "error": "Failed to import alert rules: {{error}}",
+ "group": {
+ "description": "Type to search for an existing group",
+ "label": "Group"
+ },
+ "import-location-and-filters": "Import location and filters",
+ "namespace": {
+ "description": "Type to search for an existing namespace",
+ "label": "Namespace"
+ },
+ "optional-settings": "Optional settings",
+ "pageTitle": "Import alert rules from a datasource to Grafana-managed rules",
+ "pause": {
+ "label": "Pause imported alerting rules"
+ },
+ "pause-recording": {
+ "label": "Pause imported recording rules"
+ },
+ "recording-rules": "Recording rules",
+ "success": "Successfully imported alert rules to Grafana-managed rules.",
+ "target-folder": {
+ "label": "Target folder"
+ }
+ },
"irm-integration": {
"connection-method": "How to connect to IRM",
"disabled-description": "Enable Grafana IRM to use this integration",
@@ -607,6 +645,8 @@
"new-recording-rule": "New recording rule",
"provisioning": "You can also define rules through file provisioning or Terraform. <2>Learn more2>"
},
+ "no-prom-or-loki-rules": "There are no Prometheus or Loki data sources configured",
+ "no-rules": "No rules found.",
"section": {
"dataSourceManaged": {
"title": "Data source-managed"
@@ -617,7 +657,8 @@
"loading": "Loading...",
"new-recording-rule": "New recording rule",
"title": "Grafana-managed"
- }
+ },
+ "loading-rules": "Loading rules from {{numberOfSources}} {{sources}}"
}
},
"manage-permissions": {
@@ -636,6 +677,10 @@
"save": "Save mute timing",
"saving": "Saving mute timing"
},
+ "namespace-and-group-filter": {
+ "select-group": "Select group",
+ "select-namespace": "Select namespace"
+ },
"notification-preview": {
"alertmanager": "Alertmanager:",
"error": "Could not load routing preview for {{alertmanager}}",
@@ -731,7 +776,7 @@
"previewCondition": "Preview alert rule condition"
},
"recording-rules": {
- "description-target-data-source": "The Prometheus data source to store the recording rule in",
+ "description-target-data-source": "The Prometheus data source to store recording rules in",
"label-target-data-source": "Target data source"
},
"rule-form": {
@@ -846,6 +891,10 @@
"no-more-results": "No more results – showing {{numberOfRules}} rules",
"no-rules-found": "No alert or recording rules matched your current set of filters."
},
+ "import-to-gma": {
+ "new-badge": "New!",
+ "text": "Import to Grafana-managed rules"
+ },
"more": "More",
"new-alert-rule": "New alert rule",
"new-datasource-recording-rule": "New Data source recording rule",
@@ -935,6 +984,12 @@
},
"threshold": {
"to": "TO"
+ },
+ "to-gma": {
+ "confirm-modal": {
+ "body": "If the target folder is not empty, some rules may be overwritten or removed. Are you sure you want to import these alert rules to Grafana-managed rules?",
+ "summary": "These are the list of rules that will be imported:"
+ }
}
},
"annotations": {