Skip to content

Commit

Permalink
Wrap all password/token fields (with hidden content option) with Inpu…
Browse files Browse the repository at this point in the history
…tGroup item.

Reference: https://issues.redhat.com/browse/MTV-1572

After migrating to Patternfly 5, all the password/token fields in all forms that include
the 'hidden content button' field, were splitted into 2 lines.
The button was pushed to next line.

For fixing, need to wrap the field's entries with the InputGroup item.

Signed-off-by: Sharon Gratch <[email protected]>
  • Loading branch information
sgratch committed Oct 7, 2024
1 parent d75d0d4 commit 671dffa
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import { CertificateUpload } from 'src/modules/Providers/utils/components/Certif
import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n';

import { FormGroupWithHelpText } from '@kubev2v/common';
import { Button, Divider, Form, Popover, Switch, TextInput } from '@patternfly/react-core';
import {
Button,
Divider,
Form,
InputGroup,
Popover,
Switch,
TextInput,
} from '@patternfly/react-core';
import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
Expand Down Expand Up @@ -158,23 +166,25 @@ export const EsxiCredentialsEdit: React.FC<EditComponentProps> = ({ secret, onCh
helperTextInvalid={state.validation.password.msg}
validated={state.validation.password.type}
>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
aria-label="Password input"
onChange={(e, v) => onChangePassword(v, e)}
value={password}
validated={state.validation.password.type}
/>
<Button
variant="control"
onClick={onClickTogglePassword}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
<InputGroup>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
aria-label="Password input"
onChange={(e, v) => onChangePassword(v, e)}
value={password}
validated={state.validation.password.type}
/>
<Button
variant="control"
onClick={onClickTogglePassword}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
</InputGroup>
</FormGroupWithHelpText>

<Divider />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import { CertificateUpload } from 'src/modules/Providers/utils/components/Certif
import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n';

import { FormGroupWithHelpText } from '@kubev2v/common';
import { Button, Divider, Form, Popover, Switch, TextInput } from '@patternfly/react-core';
import {
Button,
Divider,
Form,
InputGroup,
Popover,
Switch,
TextInput,
} from '@patternfly/react-core';
import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
Expand Down Expand Up @@ -133,23 +141,25 @@ export const OpenshiftCredentialsEdit: React.FC<EditComponentProps> = ({ secret,
helperTextInvalid={state.validation.token.msg}
validated={state.validation.token.type}
>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
aria-label="Token input"
onChange={(e, v) => onChangeToken(v, e)}
value={token}
validated={state.validation.token.type}
/>
<Button
variant="control"
onClick={onClickTogglePassword}
aria-label={state.passwordHidden ? 'Show token' : 'Hide token'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
<InputGroup>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
aria-label="Token input"
onChange={(e, v) => onChangeToken(v, e)}
value={token}
validated={state.validation.token.type}
/>
<Button
variant="control"
onClick={onClickTogglePassword}
aria-label={state.passwordHidden ? 'Show token' : 'Hide token'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
</InputGroup>
</FormGroupWithHelpText>

<Divider />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { openstackSecretFieldValidator, safeBase64Decode } from 'src/modules/Pro
import { useForkliftTranslation } from 'src/utils/i18n';

import { FormGroupWithHelpText } from '@kubev2v/common';
import { Button, TextInput } from '@patternfly/react-core';
import { Button, InputGroup, TextInput } from '@patternfly/react-core';
import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';

Expand Down Expand Up @@ -113,24 +113,26 @@ export const ApplicationCredentialNameSecretFieldsFormGroup: React.FC<EditCompon
helperTextInvalid={state.validation.applicationCredentialSecret.msg}
validated={state.validation.applicationCredentialSecret.type}
>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
id="applicationCredentialSecret"
name="applicationCredentialSecret"
value={applicationCredentialSecret}
onChange={(e, v) => onChangeFactory('applicationCredentialSecret')(v, e)}
validated={state.validation.applicationCredentialSecret.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
<InputGroup>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
id="applicationCredentialSecret"
name="applicationCredentialSecret"
value={applicationCredentialSecret}
onChange={(e, v) => onChangeFactory('applicationCredentialSecret')(v, e)}
validated={state.validation.applicationCredentialSecret.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
</InputGroup>
</FormGroupWithHelpText>

<FormGroupWithHelpText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { openstackSecretFieldValidator, safeBase64Decode } from 'src/modules/Pro
import { useForkliftTranslation } from 'src/utils/i18n';

import { FormGroupWithHelpText } from '@kubev2v/common';
import { Button, TextInput } from '@patternfly/react-core';
import { Button, InputGroup, TextInput } from '@patternfly/react-core';
import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';

Expand Down Expand Up @@ -109,24 +109,26 @@ export const ApplicationWithCredentialsIDFormGroup: React.FC<EditComponentProps>
helperTextInvalid={state.validation.applicationCredentialSecret.msg}
validated={state.validation.applicationCredentialSecret.type}
>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
id="applicationCredentialSecret"
name="applicationCredentialSecret"
value={applicationCredentialSecret}
onChange={(e, v) => onChangeFactory('applicationCredentialSecret')(v, e)}
validated={state.validation.applicationCredentialSecret.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
<InputGroup>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
id="applicationCredentialSecret"
name="applicationCredentialSecret"
value={applicationCredentialSecret}
onChange={(e, v) => onChangeFactory('applicationCredentialSecret')(v, e)}
validated={state.validation.applicationCredentialSecret.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
</InputGroup>
</FormGroupWithHelpText>

<FormGroupWithHelpText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { openstackSecretFieldValidator, safeBase64Decode } from 'src/modules/Pro
import { useForkliftTranslation } from 'src/utils/i18n';

import { FormGroupWithHelpText } from '@kubev2v/common';
import { Button, TextInput } from '@patternfly/react-core';
import { Button, InputGroup, TextInput } from '@patternfly/react-core';
import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';

Expand Down Expand Up @@ -105,23 +105,25 @@ export const PasswordSecretFieldsFormGroup: React.FC<EditComponentProps> = ({
helperTextInvalid={state.validation.password.msg}
validated={state.validation.password.type}
>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
aria-label="Password input"
value={password}
onChange={(e, v) => onChangeFactory('password')(v, e)}
validated={state.validation.password.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
<InputGroup>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
aria-label="Password input"
value={password}
onChange={(e, v) => onChangeFactory('password')(v, e)}
validated={state.validation.password.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
</InputGroup>
</FormGroupWithHelpText>

<FormGroupWithHelpText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { openstackSecretFieldValidator, safeBase64Decode } from 'src/modules/Pro
import { useForkliftTranslation } from 'src/utils/i18n';

import { FormGroupWithHelpText } from '@kubev2v/common';
import { Button, TextInput } from '@patternfly/react-core';
import { Button, InputGroup, TextInput } from '@patternfly/react-core';
import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';

Expand Down Expand Up @@ -82,24 +82,26 @@ export const TokenWithUserIDSecretFieldsFormGroup: React.FC<EditComponentProps>
helperTextInvalid={state.validation.token.msg}
validated={state.validation.token.type}
>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
id="token"
name="token"
value={token}
onChange={(e, v) => onChangeFactory('token')(v, e)}
validated={state.validation.token.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
<InputGroup>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
id="token"
name="token"
value={token}
onChange={(e, v) => onChangeFactory('token')(v, e)}
validated={state.validation.token.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
</InputGroup>
</FormGroupWithHelpText>

<FormGroupWithHelpText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { openstackSecretFieldValidator, safeBase64Decode } from 'src/modules/Pro
import { useForkliftTranslation } from 'src/utils/i18n';

import { FormGroupWithHelpText } from '@kubev2v/common';
import { Button, TextInput } from '@patternfly/react-core';
import { Button, InputGroup, TextInput } from '@patternfly/react-core';
import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';

Expand Down Expand Up @@ -84,24 +84,26 @@ export const TokenWithUsernameSecretFieldsFormGroup: React.FC<EditComponentProps
helperTextInvalid={state.validation.token.msg}
validated={state.validation.token.type}
>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
id="token"
name="token"
value={token}
onChange={(e, v) => onChangeFactory('token')(v, e)}
validated={state.validation.token.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
<InputGroup>
<TextInput
spellCheck="false"
className="pf-u-w-75"
isRequired
type={state.passwordHidden ? 'password' : 'text'}
id="token"
name="token"
value={token}
onChange={(e, v) => onChangeFactory('token')(v, e)}
validated={state.validation.token.type}
/>
<Button
variant="control"
onClick={togglePasswordHidden}
aria-label={state.passwordHidden ? 'Show password' : 'Hide password'}
>
{state.passwordHidden ? <EyeIcon /> : <EyeSlashIcon />}
</Button>
</InputGroup>
</FormGroupWithHelpText>

<FormGroupWithHelpText
Expand Down
Loading

0 comments on commit 671dffa

Please sign in to comment.