From 34ffd01da83a9ed254f75df9d3b73de0892b53cc Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 29 Sep 2022 13:07:46 +0200 Subject: [PATCH] Move enable / disable to header (#3397) --- .../users/user_details/UserDetailsPage.ts | 5 -- apps/admin-ui/src/user/UserForm.tsx | 24 --------- apps/admin-ui/src/user/UsersTabs.tsx | 52 ++++++++++++------- 3 files changed, 32 insertions(+), 49 deletions(-) diff --git a/apps/admin-ui/cypress/support/pages/admin_console/manage/users/user_details/UserDetailsPage.ts b/apps/admin-ui/cypress/support/pages/admin_console/manage/users/user_details/UserDetailsPage.ts index 93d6428846..76983ea332 100644 --- a/apps/admin-ui/cypress/support/pages/admin_console/manage/users/user_details/UserDetailsPage.ts +++ b/apps/admin-ui/cypress/support/pages/admin_console/manage/users/user_details/UserDetailsPage.ts @@ -10,8 +10,6 @@ export default class UserDetailsPage extends PageObject { firstNameValue: string; lastNameInput: string; lastNameValue: string; - enabledSwitch: string; - enabledValue: boolean; requiredUserActions: RequiredActionAlias[]; identityProviderLinksTab: string; @@ -29,8 +27,6 @@ export default class UserDetailsPage extends PageObject { this.firstNameValue = "firstname"; this.lastNameInput = "lastName-input"; this.lastNameValue = "lastname"; - this.enabledSwitch = "user-enabled-switch"; - this.enabledValue = true; this.requiredUserActions = [RequiredActionAlias.UPDATE_PASSWORD]; this.identityProviderLinksTab = "identity-provider-links-tab"; } @@ -47,7 +43,6 @@ export default class UserDetailsPage extends PageObject { cy.findByTestId(this.emailInput).type(this.emailValue()); cy.findByTestId(this.firstNameInput).type(this.firstNameValue); cy.findByTestId(this.lastNameInput).type(this.lastNameValue); - cy.findByTestId(this.enabledSwitch).check({ force: true }); return this; } diff --git a/apps/admin-ui/src/user/UserForm.tsx b/apps/admin-ui/src/user/UserForm.tsx index 8e63e999ca..e27a2034a8 100644 --- a/apps/admin-ui/src/user/UserForm.tsx +++ b/apps/admin-ui/src/user/UserForm.tsx @@ -313,30 +313,6 @@ export const UserForm = ({ /> )} - - } - > - ( - onChange(value)} - isChecked={value} - label={t("common:on")} - labelOff={t("common:off")} - aria-label={t("common:enabled")} - /> - )} - /> - { <> - toggleImpersonateDialog()} - > - {t("impersonate")} - , - toggleDeleteDialog()} - > - {t("common:delete")} - , - ]} + ( + toggleImpersonateDialog()} + > + {t("impersonate")} + , + toggleDeleteDialog()} + > + {t("common:delete")} + , + ]} + isEnabled={value} + onToggle={(value) => { + onChange(value); + save(userForm.getValues()); + }} + /> + )} />