Alerting: Simplify actions (#103494)

This commit is contained in:
Torkel Ödegaard
2025-04-23 12:45:28 +02:00
committed by GitHub
parent 3923538ba4
commit dc0501e376
4 changed files with 2 additions and 19 deletions
@@ -268,19 +268,6 @@ export const AlertRuleForm = ({ existing, prefill, isManualRestore }: Props) =>
const actionButtons = (
<Stack justifyContent="flex-end" alignItems="center">
{existing && (
<Button
data-testid="save-rule"
variant="primary"
type="button"
size="sm"
onClick={handleSubmit((values) => submit(values, false), onInvalid)}
disabled={isSubmitting}
>
{isSubmitting && <Spinner className={styles.buttonSpinner} inline={true} />}
<Trans i18nKey="alerting.alert-rule-form.action-buttons.save">Save rule</Trans>
</Button>
)}
<Button
data-testid="save-rule-and-exit"
variant="primary"
@@ -116,9 +116,7 @@ describe('RuleEditor grafana managed rules', () => {
await user.type(screen.getByPlaceholderText('Enter custom annotation content...'), 'value');
// save and check what was sent to backend
await user.click(ui.buttons.save.get());
expect(screen.getByText('New folder')).toBeInTheDocument();
await user.click(ui.buttons.saveAndExit.get());
});
it('saves evaluation interval correctly', async () => {
@@ -142,7 +140,7 @@ describe('RuleEditor grafana managed rules', () => {
(req) => req.method === 'POST' && req.url.includes('/api/ruler/grafana/api/v1/rules/uuid020c61ef')
);
await user.click(ui.buttons.save.get());
await user.click(ui.buttons.saveAndExit.get());
const [request] = await capture;
const postBody = await request.json();
-1
View File
@@ -410,7 +410,6 @@
"action-buttons": {
"delete": "Delete",
"edit-yaml": "Edit YAML",
"save": "Save rule",
"save-exit": "Save rule and exit"
},
"title-delete-rule": "Delete rule"
@@ -40,7 +40,6 @@ export const ui = {
},
buttons: {
saveAndExit: byRole('button', { name: 'Save rule and exit' }),
save: byRole('button', { name: 'Save rule' }),
addAnnotation: byRole('button', { name: /Add info/ }),
addLabel: byRole('button', { name: /Add label/ }),
preview: byRole('button', { name: /^Preview$/ }),