mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Allow downloading alert rules from subpath (#64136)
This commit is contained in:
parent
4a7fbea7a4
commit
3468804ff5
@ -117,7 +117,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: {
|
||||
dialog: byRole('dialog'),
|
||||
namespaceInput: byRole('textbox', { name: /^Namespace/ }),
|
||||
|
@ -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(
|
||||
</div>
|
||||
<Stack direction="row" gap={0.5}>
|
||||
{canReadProvisioning && (
|
||||
<Button icon="download-alt" type="button" onClick={onExport}>
|
||||
<LinkButton
|
||||
href={createUrl('/api/v1/provisioning/alert-rules/export', {
|
||||
download: 'true',
|
||||
format: 'yaml',
|
||||
})}
|
||||
icon="download-alt"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
Export
|
||||
</Button>
|
||||
</LinkButton>
|
||||
)}
|
||||
{(canCreateGrafanaRules || canCreateCloudRules) && (
|
||||
<LinkButton
|
||||
|
Loading…
Reference in New Issue
Block a user