Move enable / disable to header (#3397)
This commit is contained in:
parent
283390dee9
commit
34ffd01da8
3 changed files with 32 additions and 49 deletions
|
@ -10,8 +10,6 @@ export default class UserDetailsPage extends PageObject {
|
||||||
firstNameValue: string;
|
firstNameValue: string;
|
||||||
lastNameInput: string;
|
lastNameInput: string;
|
||||||
lastNameValue: string;
|
lastNameValue: string;
|
||||||
enabledSwitch: string;
|
|
||||||
enabledValue: boolean;
|
|
||||||
requiredUserActions: RequiredActionAlias[];
|
requiredUserActions: RequiredActionAlias[];
|
||||||
identityProviderLinksTab: string;
|
identityProviderLinksTab: string;
|
||||||
|
|
||||||
|
@ -29,8 +27,6 @@ export default class UserDetailsPage extends PageObject {
|
||||||
this.firstNameValue = "firstname";
|
this.firstNameValue = "firstname";
|
||||||
this.lastNameInput = "lastName-input";
|
this.lastNameInput = "lastName-input";
|
||||||
this.lastNameValue = "lastname";
|
this.lastNameValue = "lastname";
|
||||||
this.enabledSwitch = "user-enabled-switch";
|
|
||||||
this.enabledValue = true;
|
|
||||||
this.requiredUserActions = [RequiredActionAlias.UPDATE_PASSWORD];
|
this.requiredUserActions = [RequiredActionAlias.UPDATE_PASSWORD];
|
||||||
this.identityProviderLinksTab = "identity-provider-links-tab";
|
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.emailInput).type(this.emailValue());
|
||||||
cy.findByTestId(this.firstNameInput).type(this.firstNameValue);
|
cy.findByTestId(this.firstNameInput).type(this.firstNameValue);
|
||||||
cy.findByTestId(this.lastNameInput).type(this.lastNameValue);
|
cy.findByTestId(this.lastNameInput).type(this.lastNameValue);
|
||||||
cy.findByTestId(this.enabledSwitch).check({ force: true });
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,30 +313,6 @@ export const UserForm = ({
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
<FormGroup
|
|
||||||
label={t("common:enabled")}
|
|
||||||
fieldId="kc-enabled"
|
|
||||||
labelIcon={
|
|
||||||
<HelpItem helpText="users-help:disabled" fieldLabelId="enabled" />
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Controller
|
|
||||||
name="enabled"
|
|
||||||
defaultValue={true}
|
|
||||||
control={control}
|
|
||||||
render={({ onChange, value }) => (
|
|
||||||
<Switch
|
|
||||||
data-testid="user-enabled-switch"
|
|
||||||
id={"kc-user-enabled"}
|
|
||||||
onChange={(value) => onChange(value)}
|
|
||||||
isChecked={value}
|
|
||||||
label={t("common:on")}
|
|
||||||
labelOff={t("common:off")}
|
|
||||||
aria-label={t("common:enabled")}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("requiredUserActions")}
|
label={t("requiredUserActions")}
|
||||||
fieldId="kc-required-user-actions"
|
fieldId="kc-required-user-actions"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
TabTitleText,
|
TabTitleText,
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { Controller, FormProvider, useForm } from "react-hook-form";
|
||||||
|
|
||||||
import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
|
import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
|
||||||
import type GroupRepresentation from "@keycloak/keycloak-admin-client/lib/defs/groupRepresentation";
|
import type GroupRepresentation from "@keycloak/keycloak-admin-client/lib/defs/groupRepresentation";
|
||||||
|
@ -150,6 +150,11 @@ const UsersTabs = () => {
|
||||||
<>
|
<>
|
||||||
<ImpersonateConfirm />
|
<ImpersonateConfirm />
|
||||||
<DeleteConfirm />
|
<DeleteConfirm />
|
||||||
|
<Controller
|
||||||
|
name="enabled"
|
||||||
|
control={userForm.control}
|
||||||
|
defaultValue={true}
|
||||||
|
render={({ onChange, value }) => (
|
||||||
<ViewHeader
|
<ViewHeader
|
||||||
titleKey={user?.id ? user.username! : t("createUser")}
|
titleKey={user?.id ? user.username! : t("createUser")}
|
||||||
divider={!id}
|
divider={!id}
|
||||||
|
@ -169,6 +174,13 @@ const UsersTabs = () => {
|
||||||
{t("common:delete")}
|
{t("common:delete")}
|
||||||
</DropdownItem>,
|
</DropdownItem>,
|
||||||
]}
|
]}
|
||||||
|
isEnabled={value}
|
||||||
|
onToggle={(value) => {
|
||||||
|
onChange(value);
|
||||||
|
save(userForm.getValues());
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
<PageSection variant="light" className="pf-u-p-0">
|
<PageSection variant="light" className="pf-u-p-0">
|
||||||
<FormProvider {...userForm}>
|
<FormProvider {...userForm}>
|
||||||
|
|
Loading…
Reference in a new issue