mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: misc fixes (#33070)
This commit is contained in:
@@ -18,6 +18,7 @@ import { useDispatch } from 'react-redux';
|
||||
import { useCleanup } from 'app/core/hooks/useCleanup';
|
||||
import { rulerRuleToFormValues, defaultFormValues } from '../../utils/rule-form';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
type Props = {
|
||||
existing?: RuleWithLocation;
|
||||
@@ -56,6 +57,7 @@ export const AlertRuleForm: FC<Props> = ({ existing }) => {
|
||||
dispatch(
|
||||
saveRuleFormAction({
|
||||
values: {
|
||||
...defaultValues,
|
||||
...values,
|
||||
annotations: values.annotations?.filter(({ key }) => !!key) ?? [],
|
||||
labels: values.labels?.filter(({ key }) => !!key) ?? [],
|
||||
@@ -70,7 +72,7 @@ export const AlertRuleForm: FC<Props> = ({ existing }) => {
|
||||
<FormContext {...formAPI}>
|
||||
<form onSubmit={handleSubmit((values) => submit(values, false))} className={styles.form}>
|
||||
<PageToolbar title="Create alert rule" pageIcon="bell" className={styles.toolbar}>
|
||||
<Link to="/alerting/list">
|
||||
<Link to={`${config.appSubUrl ?? ''}/alerting/list`}>
|
||||
<ToolbarButton variant="default" disabled={submitState.loading} type="button">
|
||||
Cancel
|
||||
</ToolbarButton>
|
||||
|
||||
Reference in New Issue
Block a user