Skip to content

MGMT-17155: Remove error helper duplicated in SecurityFields in Networking Page #2518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import * as React from 'react';
import { useFormikContext } from 'formik';
import {
Checkbox,
FormGroup,
FormHelperText,
HelperText,
HelperTextItem,
} from '@patternfly/react-core';
import { Checkbox, FormGroup, HelperText, HelperTextItem } from '@patternfly/react-core';

import { RenderIf } from '../ui/RenderIf';
import { getFieldId, TextAreaField, trimSshPublicKey, ExternalLink } from '../ui';
Expand Down Expand Up @@ -46,11 +40,9 @@ const SecurityFields = ({
//clusterSshKey updating causes the textarea to disappear when the user clears it to edit it
const defaultShareSshKey = !!imageSshKey && (clusterSshKey === imageSshKey || !clusterSshKey);
const [shareSshKey, setShareSshKey] = React.useState(defaultShareSshKey);
const { values, setFieldValue, errors, touched } =
const { values, setFieldValue } =
useFormikContext<Pick<NetworkConfigurationValues, 'sshPublicKey'>>();

const errorMsg = errors.sshPublicKey;

const handleSshKeyBlur = () => {
if (values.sshPublicKey) {
setFieldValue('sshPublicKey', trimSshPublicKey(values.sshPublicKey));
Expand Down Expand Up @@ -90,15 +82,6 @@ const SecurityFields = ({
isDisabled={isDisabled}
/>
</RenderIf>
{errorMsg && (
<FormHelperText>
<HelperText>
<HelperTextItem variant={touched && errorMsg ? 'error' : 'default'}>
{errorMsg ? errorMsg : ''}
</HelperTextItem>
</HelperText>
</FormHelperText>
)}
</FormGroup>
</>
);
Expand Down
Loading