Alerting: Simplify actions (#103494)
This commit is contained in:
-13
@@ -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();
|
||||
|
||||
@@ -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$/ }),
|
||||
|
||||
Reference in New Issue
Block a user