tidy up and fix navigation

This commit is contained in:
laurenashleigh
2026-01-12 14:48:21 +00:00
parent d7d07a627a
commit c6275e7229
3 changed files with 6 additions and 17 deletions
@@ -128,7 +128,6 @@ export function RuleConditionSection() {
const base = useStyles2(getStyles);
const { watch, setValue, getValues } = useFormContext<RuleFormValues>();
const evaluateFor = watch('evaluateFor') || '0s';
const queries = watch('queries');
watch('folder');
const [simpleCondition, setSimpleCondition] = useState<LocalSimpleCondition>({
@@ -2,10 +2,9 @@ import { useState } from 'react';
import { useLocation } from 'react-router-dom-v5-compat';
import { useAsync } from 'react-use';
import { urlUtil } from '@grafana/data';
import { Trans, t } from '@grafana/i18n';
import { config } from '@grafana/runtime';
import { Alert, Button, LinkButton } from '@grafana/ui';
import { Alert, Button } from '@grafana/ui';
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
import { useSelector } from 'app/types/store';
@@ -91,17 +90,13 @@ export const NewRuleFromPanelButton = ({ dashboard, panel, className }: Props) =
}
return (
<LinkButton
<Button
icon="bell"
onClick={onContinueInAlertingButton}
href={urlUtil.renderUrl('alerting/new', {
defaults: JSON.stringify(formValues),
returnTo: location.pathname + location.search,
})}
className={className}
data-testid="create-alert-rule-button"
>
<Trans i18nKey="alerting.new-rule-from-panel-button.new-alert-rule">New alert rule</Trans>
</LinkButton>
</Button>
);
};
@@ -2,11 +2,10 @@ import { useState } from 'react';
import { useLocation } from 'react-router-dom-v5-compat';
import { useAsync } from 'react-use';
import { urlUtil } from '@grafana/data';
import { Trans, t } from '@grafana/i18n';
import { config } from '@grafana/runtime';
import { VizPanel } from '@grafana/scenes';
import { Alert, Button, LinkButton } from '@grafana/ui';
import { Alert, Button } from '@grafana/ui';
import { LogMessages, logInfo } from 'app/features/alerting/unified/Analytics';
import { AlertRuleDrawerForm } from 'app/features/alerting/unified/components/AlertRuleDrawerForm';
import { createPanelAlertRuleNavigation } from 'app/features/alerting/unified/utils/navigation';
@@ -78,17 +77,13 @@ export const ScenesNewRuleFromPanelButton = ({ panel, className }: ScenesNewRule
}
return (
<LinkButton
<Button
icon="bell"
onClick={onContinueInAlertingButton}
href={urlUtil.renderUrl('alerting/new', {
defaults: JSON.stringify(formValues),
returnTo: location.pathname + location.search,
})}
className={className}
data-testid="create-alert-rule-button"
>
<Trans i18nKey="alerting.new-rule-from-panel-button.new-alert-rule">New alert rule</Trans>
</LinkButton>
</Button>
);
};