diff --git a/public/app/features/alerting/unified/RuleList.test.tsx b/public/app/features/alerting/unified/RuleList.test.tsx index fccb1899192..8ddc8283721 100644 --- a/public/app/features/alerting/unified/RuleList.test.tsx +++ b/public/app/features/alerting/unified/RuleList.test.tsx @@ -122,7 +122,7 @@ const ui = { moreErrorsButton: byRole('button', { name: /more errors/ }), editCloudGroupIcon: byTestId('edit-group'), newRuleButton: byRole('link', { name: 'Create alert rule' }), - exportButton: byRole('button', { name: /export/i }), + exportButton: byRole('link', { name: /export/i }), editGroupModal: { namespaceInput: byRole('textbox', { hidden: true, name: /namespace/i }), ruleGroupInput: byRole('textbox', { name: 'Evaluation group', exact: true }), diff --git a/public/app/features/alerting/unified/RuleList.tsx b/public/app/features/alerting/unified/RuleList.tsx index 56437196652..feb0c0d79bf 100644 --- a/public/app/features/alerting/unified/RuleList.tsx +++ b/public/app/features/alerting/unified/RuleList.tsx @@ -27,14 +27,13 @@ import { fetchAllPromAndRulerRulesAction } from './state/actions'; import { useRulesAccess } from './utils/accessControlHooks'; import { RULE_LIST_POLL_INTERVAL_MS } from './utils/constants'; import { getAllRulesSourceNames } from './utils/datasource'; +import { createUrl } from './utils/url'; const VIEWS = { groups: RuleListGroupView, state: RuleListStateView, }; -const onExport = () => window.open('/api/v1/provisioning/alert-rules/export?download=true&format=yaml'); - const RuleList = withErrorBoundary( () => { const dispatch = useDispatch(); @@ -111,9 +110,17 @@ const RuleList = withErrorBoundary( {canReadProvisioning && ( - + )} {(canCreateGrafanaRules || canCreateCloudRules) && (