diff --git a/e b/e index a4d6a1bd409a4..be16ae9db268c 160000 --- a/e +++ b/e @@ -1 +1 @@ -Subproject commit a4d6a1bd409a400befb4f69f231f3f48324bab66 +Subproject commit be16ae9db268c1a691719fc1f0f1504e6ebb56f9 diff --git a/web/packages/teleport/src/Roles/RoleEditor/RequiresResetToStandard.tsx b/web/packages/teleport/src/Roles/RoleEditor/RequiresResetToStandard.tsx index 9b0b33bc4710f..67780c3e4ecbc 100644 --- a/web/packages/teleport/src/Roles/RoleEditor/RequiresResetToStandard.tsx +++ b/web/packages/teleport/src/Roles/RoleEditor/RequiresResetToStandard.tsx @@ -17,16 +17,13 @@ */ import { Info } from 'design/Alert/Alert'; -import { ButtonSecondary, Text } from 'design'; +import { Text } from 'design'; -export const RequiresResetToStandard = ({ reset }: { reset(): void }) => ( +export const RequiresResetToStandard = () => ( - Some fields were not readable by the standard editor. To continue editing, - go back to YAML editor or reset the affected fields to standard settings. + This role is too complex to be edited in the standard editor. To continue + editing, go back to YAML editor. - - Reset to Standard Settings - ); diff --git a/web/packages/teleport/src/Roles/RoleEditor/RoleEditor.test.tsx b/web/packages/teleport/src/Roles/RoleEditor/RoleEditor.test.tsx index ab8fc3871a1b8..5e9337ef43364 100644 --- a/web/packages/teleport/src/Roles/RoleEditor/RoleEditor.test.tsx +++ b/web/packages/teleport/src/Roles/RoleEditor/RoleEditor.test.tsx @@ -129,9 +129,7 @@ test('rendering and switching tabs for a non-standard role', async () => { expect(screen.getByRole('button', { name: 'Save Changes' })).toBeDisabled(); await user.click(getStandardEditorTab()); - expect( - screen.getByRole('button', { name: 'Reset to Standard Settings' }) - ).toBeVisible(); + expect(screen.getByText(/This role is too complex/)).toBeVisible(); expect(screen.getByLabelText('Role Name')).toHaveValue('some-role'); expect(screen.getByLabelText('Description')).toHaveValue(''); expect(screen.getByRole('button', { name: 'Save Changes' })).toBeDisabled(); @@ -139,21 +137,6 @@ test('rendering and switching tabs for a non-standard role', async () => { await user.click(getYamlEditorTab()); expect(fromFauxYaml(await getTextEditorContents())).toEqual(originalRole); expect(screen.getByRole('button', { name: 'Save Changes' })).toBeDisabled(); - - // Switch once again, reset to standard - await user.click(getStandardEditorTab()); - expect(screen.getByRole('button', { name: 'Save Changes' })).toBeDisabled(); - await user.click( - screen.getByRole('button', { name: 'Reset to Standard Settings' }) - ); - expect(screen.getByRole('button', { name: 'Save Changes' })).toBeEnabled(); - await user.type(screen.getByLabelText('Description'), 'some description'); - - await user.click(getYamlEditorTab()); - const editorContents = fromFauxYaml(await getTextEditorContents()); - expect(editorContents.metadata.description).toBe('some description'); - expect(editorContents.spec.deny).toEqual({}); - expect(screen.getByRole('button', { name: 'Save Changes' })).toBeEnabled(); }); test('switching tabs triggers validation', async () => { @@ -192,9 +175,7 @@ test('switching tabs ignores standard model validation for a non-standard role', ); expect(getYamlEditorTab()).toHaveAttribute('aria-selected', 'true'); await user.click(getStandardEditorTab()); - expect( - screen.getByText(/Some fields were not readable by the standard editor/) - ).toBeVisible(); + expect(screen.getByText(/This role is too complex/)).toBeVisible(); await user.click(getYamlEditorTab()); // Proceed, even though our validation would consider the data invalid. expect(getYamlEditorTab()).toHaveAttribute('aria-selected', 'true'); diff --git a/web/packages/teleport/src/Roles/RoleEditor/StandardEditor.tsx b/web/packages/teleport/src/Roles/RoleEditor/StandardEditor.tsx index 6b46ba8a61f19..49c5c5e30feb8 100644 --- a/web/packages/teleport/src/Roles/RoleEditor/StandardEditor.tsx +++ b/web/packages/teleport/src/Roles/RoleEditor/StandardEditor.tsx @@ -165,18 +165,6 @@ export const StandardEditor = ({ }); } - /** - * Resets the standard editor back into viewable state. The existing model - * has been already stripped from unsupported features by the parsing - * attempt, the only thing left to do is to set the `requiresReset` flag. - */ - function resetForStandardEditor() { - handleChange({ - ...standardEditorModel.roleModel, - requiresReset: false, - }); - } - function addAccessSpec(kind: AccessSpecKind) { handleChange({ ...standardEditorModel.roleModel, @@ -223,7 +211,7 @@ export const StandardEditor = ({ <> {roleModel.requiresReset && ( - + )}