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/ }),
|
moreErrorsButton: byRole('button', { name: /more errors/ }),
|
||||||
editCloudGroupIcon: byTestId('edit-group'),
|
editCloudGroupIcon: byTestId('edit-group'),
|
||||||
newRuleButton: byRole('link', { name: 'Create alert rule' }),
|
newRuleButton: byRole('link', { name: 'Create alert rule' }),
|
||||||
exportButton: byRole('button', { name: /export/i }),
|
exportButton: byRole('link', { name: /export/i }),
|
||||||
editGroupModal: {
|
editGroupModal: {
|
||||||
dialog: byRole('dialog'),
|
dialog: byRole('dialog'),
|
||||||
namespaceInput: byRole('textbox', { name: /^Namespace/ }),
|
namespaceInput: byRole('textbox', { name: /^Namespace/ }),
|
||||||
|
@ -27,14 +27,13 @@ import { fetchAllPromAndRulerRulesAction } from './state/actions';
|
|||||||
import { useRulesAccess } from './utils/accessControlHooks';
|
import { useRulesAccess } from './utils/accessControlHooks';
|
||||||
import { RULE_LIST_POLL_INTERVAL_MS } from './utils/constants';
|
import { RULE_LIST_POLL_INTERVAL_MS } from './utils/constants';
|
||||||
import { getAllRulesSourceNames } from './utils/datasource';
|
import { getAllRulesSourceNames } from './utils/datasource';
|
||||||
|
import { createUrl } from './utils/url';
|
||||||
|
|
||||||
const VIEWS = {
|
const VIEWS = {
|
||||||
groups: RuleListGroupView,
|
groups: RuleListGroupView,
|
||||||
state: RuleListStateView,
|
state: RuleListStateView,
|
||||||
};
|
};
|
||||||
|
|
||||||
const onExport = () => window.open('/api/v1/provisioning/alert-rules/export?download=true&format=yaml');
|
|
||||||
|
|
||||||
const RuleList = withErrorBoundary(
|
const RuleList = withErrorBoundary(
|
||||||
() => {
|
() => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -111,9 +110,17 @@ const RuleList = withErrorBoundary(
|
|||||||
</div>
|
</div>
|
||||||
<Stack direction="row" gap={0.5}>
|
<Stack direction="row" gap={0.5}>
|
||||||
{canReadProvisioning && (
|
{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
|
Export
|
||||||
</Button>
|
</LinkButton>
|
||||||
)}
|
)}
|
||||||
{(canCreateGrafanaRules || canCreateCloudRules) && (
|
{(canCreateGrafanaRules || canCreateCloudRules) && (
|
||||||
<LinkButton
|
<LinkButton
|
||||||
|
Loading…
Reference in New Issue
Block a user