-
Notifications
You must be signed in to change notification settings - Fork 63
OCPBUGS-76280: Next button is disabled on Optional configurations page #3384
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,11 @@ | ||
| import * as React from 'react'; | ||
| import { Formik, useFormikContext } from 'formik'; | ||
| import { Formik } from 'formik'; | ||
| import { TFunction } from 'i18next'; | ||
| import * as Yup from 'yup'; | ||
| import { | ||
| ClusterWizardStep, | ||
| TechnologyPreview, | ||
| sshPublicKeyValidationSchema, | ||
| pullSecretValidationSchema, | ||
| getFormikErrorFields, | ||
| httpProxyValidationSchema, | ||
| noProxyValidationSchema, | ||
|
|
@@ -16,15 +15,14 @@ import { | |
| AdditionalNTPSourcesField, | ||
| ProxyFieldsType, | ||
| } from '../../../../common'; | ||
| import { Split, SplitItem, Grid, GridItem, Form, Content, Checkbox } from '@patternfly/react-core'; | ||
| import { Split, SplitItem, Grid, GridItem, Form, Content } from '@patternfly/react-core'; | ||
| import { useClusterWizardContext } from '../ClusterWizardContext'; | ||
| import ClusterWizardFooter from '../ClusterWizardFooter'; | ||
| import ClusterWizardNavigation from '../ClusterWizardNavigation'; | ||
| import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary'; | ||
| import UploadSSH from '../../../../common/components/clusterConfiguration/UploadSSH'; | ||
| import PullSecretField from '../../../../common/components/ui/formik/PullSecretField'; | ||
| import { ProxyInputFields } from '../../../../common/components/clusterConfiguration/ProxyFields'; | ||
| import { isInOcm, handleApiError, getApiErrorMessage } from '../../../../common/api'; | ||
| import { handleApiError, getApiErrorMessage } from '../../../../common/api'; | ||
| import { useAlerts } from '../../../../common/components/AlertsContextProvider'; | ||
| import { AlertVariant } from '@patternfly/react-core'; | ||
| import InfraEnvsService from '../../../services/InfraEnvsService'; | ||
|
|
@@ -49,7 +47,6 @@ const DISCONNECTED_IMAGE_TYPE = 'disconnected-iso' as const; | |
|
|
||
| type OptionalConfigurationsFormValues = ProxyFieldsType & { | ||
| sshPublicKey?: string; | ||
| pullSecret: string; | ||
| enableNtpSources: boolean; | ||
| additionalNtpSources?: string; | ||
| hostsNetworkConfigurationType: HostsNetworkConfigurationType; | ||
|
|
@@ -105,7 +102,7 @@ const buildInfraEnvParams = (values: OptionalConfigurationsFormValues) => { | |
| const hasProxy = Object.keys(proxy).length > 0; | ||
|
|
||
| return { | ||
| pullSecret: values.pullSecret, | ||
| // pullSecret, | ||
| ...(values.sshPublicKey && { sshAuthorizedKey: values.sshPublicKey }), | ||
| ...(hasProxy && { proxy }), | ||
| ...(values.additionalNtpSources && { | ||
|
|
@@ -124,7 +121,6 @@ const getValidationSchema = (t: TFunction) => | |
| Yup.lazy((values: OptionalConfigurationsFormValues) => | ||
| Yup.object().shape({ | ||
| sshPublicKey: sshPublicKeyValidationSchema(t), | ||
| pullSecret: pullSecretValidationSchema(t).required('Required field'), | ||
| enableProxy: Yup.boolean().required(), | ||
| httpProxy: httpProxyValidationSchema({ | ||
| values, | ||
|
|
@@ -154,26 +150,11 @@ const getValidationSchema = (t: TFunction) => | |
| }), | ||
| ); | ||
|
|
||
| const PullSecretSync = () => { | ||
| const defaultPullSecret = usePullSecret(); | ||
| const { | ||
| setFieldValue, | ||
| values: { pullSecret }, | ||
| } = useFormikContext<OptionalConfigurationsFormValues>(); | ||
|
|
||
| React.useEffect(() => { | ||
| if (defaultPullSecret !== undefined && pullSecret === '') { | ||
| setFieldValue('pullSecret', defaultPullSecret); | ||
| } | ||
| }, [defaultPullSecret, pullSecret, setFieldValue]); | ||
|
|
||
| return null; | ||
| }; | ||
|
|
||
| const OptionalConfigurationsStep = () => { | ||
| const { clusterId } = useParams<{ clusterId: string }>(); | ||
| const [cluster, setCluster] = React.useState<Cluster | null>(null); | ||
| const { t } = useTranslation(); | ||
| const defaultPullSecret = usePullSecret(); | ||
|
|
||
| const { | ||
| moveNext, | ||
|
|
@@ -208,9 +189,17 @@ const OptionalConfigurationsStep = () => { | |
| void fetchCluster(); | ||
| }, [clusterId, addAlert, t]); | ||
|
|
||
| const initialValues: OptionalConfigurationsFormValues = disconnectedInfraEnv | ||
| ? infraEnvToFormValues(disconnectedInfraEnv, disconnectedFormPullSecret) | ||
| : DEFAULT_INITIAL_VALUES; | ||
| const initialValues: OptionalConfigurationsFormValues = { | ||
| sshPublicKey: '', | ||
| enableProxy: false, | ||
| httpProxy: '', | ||
| httpsProxy: '', | ||
| noProxy: '', | ||
| enableNtpSources: false, | ||
| additionalNtpSources: '', | ||
| hostsNetworkConfigurationType: HostsNetworkConfigurationType.DHCP, | ||
| rendezvousIp: '', | ||
| }; | ||
|
|
||
| return ( | ||
| <Formik | ||
|
|
@@ -258,6 +247,7 @@ const OptionalConfigurationsStep = () => { | |
| openshiftVersion: cluster.openshiftVersion, | ||
| cpuArchitecture: DEFAULT_CPU_ARCHITECTURE, | ||
| imageType: DISCONNECTED_IMAGE_TYPE, | ||
| pullSecret: defaultPullSecret ?? '', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Risk of creating InfraEnv with an empty pull secret.
Disable "Next" until a valid pull secret is available: Proposed fix- isNextDisabled={!isValid || !cluster}
+ isNextDisabled={!isValid || !cluster || !defaultPullSecret}This also covers the error/empty-data cases from Also applies to: 239-239 🤖 Prompt for AI Agents |
||
| ...commonParams, | ||
| }; | ||
| const createdInfraEnv = await InfraEnvsService.create(createParams); | ||
|
|
@@ -306,7 +296,6 @@ const OptionalConfigurationsStep = () => { | |
| } | ||
| > | ||
| <WithErrorBoundary title="Failed to load Optional Configurations step"> | ||
| <PullSecretSync /> | ||
| <Grid hasGutter> | ||
| <GridItem> | ||
| <Split> | ||
|
|
@@ -332,17 +321,6 @@ const OptionalConfigurationsStep = () => { | |
| /> | ||
|
|
||
| <UploadSSH /> | ||
| <Checkbox | ||
| label={t('ai:Edit pull secret')} | ||
| isChecked={ | ||
| disconnectedFormEditPullSecret ?? !!disconnectedInfraEnv?.pullSecretSet | ||
| } | ||
| onChange={(_, checked) => setDisconnectedFormEditPullSecret(checked)} | ||
| id="edit-pull-secret-checkbox" | ||
| /> | ||
| {(disconnectedFormEditPullSecret ?? !!disconnectedInfraEnv?.pullSecretSet) && ( | ||
| <PullSecretField isOcm={isInOcm} /> | ||
| )} | ||
|
|
||
| {/* Proxy Settings */} | ||
| <CheckboxField | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.