-
Notifications
You must be signed in to change notification settings - Fork 63
MGMT-20743 | [Staging] [UI] - Machine network CIDR value should be mandatory #3122
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5666501
[Staging] [UI] - Machine network CIDR value should be mandatory
asmasarw dbe03bd
Run Prettier on changes
asmasarw 94d2bd4
ABI: Above sea level (#2971)
rawagner c19801b
Remove ABI check (#3118)
rawagner 0373b92
Remove back button from first page (#3120)
rawagner 807ea89
Revert "Run Prettier on changes"
asmasarw 768c9f9
Revert "[Staging] [UI] - Machine network CIDR value should be mandatory"
asmasarw 7709896
MGMT-20743 | [Staging] [UI] - Machine network CIDR value should be ma…
asmasarw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 17 additions & 1 deletion
18
libs/ui-lib/lib/ocm/components/clusterWizard/NewClusterWizard.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
libs/ui-lib/lib/ocm/components/clusterWizard/disconnected/BasicStep.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import * as React from 'react'; | ||
| import { | ||
| ClusterWizardStep, | ||
| DeveloperPreview, | ||
| ExternalLink, | ||
| OCP_RELEASES_PAGE, | ||
| StaticTextField, | ||
| useTranslation, | ||
| } from '../../../../common'; | ||
| import { | ||
| Switch, | ||
| Split, | ||
| SplitItem, | ||
| TextContent, | ||
| Text, | ||
| TextVariants, | ||
| Grid, | ||
| GridItem, | ||
| Form, | ||
| } from '@patternfly/react-core'; | ||
| import { Formik } from 'formik'; | ||
| import OcmOpenShiftVersion from '../../clusterConfiguration/OcmOpenShiftVersion'; | ||
| import { useClusterWizardContext } from '../ClusterWizardContext'; | ||
| import ClusterWizardFooter from '../ClusterWizardFooter'; | ||
| import ClusterWizardNavigation from '../ClusterWizardNavigation'; | ||
| import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary'; | ||
|
|
||
| const BasicStep = () => { | ||
| const { t } = useTranslation(); | ||
| const { installDisconnected, setInstallDisconnected, moveNext } = useClusterWizardContext(); | ||
|
|
||
| return ( | ||
| <Formik | ||
| initialValues={{}} | ||
| onSubmit={() => { | ||
| // nothing to do | ||
| }} | ||
| > | ||
| <ClusterWizardStep | ||
| navigation={<ClusterWizardNavigation />} | ||
| footer={<ClusterWizardFooter onNext={moveNext} />} | ||
| > | ||
| <WithErrorBoundary title="Failed to load Basic step"> | ||
| <Grid hasGutter> | ||
| <GridItem> | ||
| <Split> | ||
| <SplitItem> | ||
| <TextContent> | ||
| <Text component={TextVariants.h2}>Basic information</Text> | ||
| </TextContent> | ||
| </SplitItem> | ||
| <SplitItem> | ||
| <DeveloperPreview /> | ||
| </SplitItem> | ||
| </Split> | ||
| </GridItem> | ||
| <GridItem> | ||
| <Switch | ||
| id="disconnected-install-switch" | ||
| label="I'm installing on a disconnected/air-gapped/secured environment" | ||
| isChecked={installDisconnected} | ||
| onChange={(_, checked) => setInstallDisconnected(checked)} | ||
| ouiaId="DisconnectedInstall" | ||
| /> | ||
| </GridItem> | ||
| <GridItem> | ||
| <Form id="wizard-cluster-basic-info__form"> | ||
| <OcmOpenShiftVersion openshiftVersion="4.19" withPreviewText withMultiText> | ||
| <ExternalLink href={`${window.location.origin}/${OCP_RELEASES_PAGE}`}> | ||
| <span data-ouia-id="openshift-releases-link"> | ||
| {t('ai:Learn more about OpenShift releases')} | ||
| </span> | ||
| </ExternalLink> | ||
| </OcmOpenShiftVersion> | ||
| <StaticTextField name="cpuArchitecture" label="CPU architecture" isRequired> | ||
| x86_64 | ||
| </StaticTextField> | ||
| </Form> | ||
| </GridItem> | ||
| </Grid> | ||
| </WithErrorBoundary> | ||
| </ClusterWizardStep> | ||
| </Formik> | ||
| ); | ||
| }; | ||
|
|
||
| export default BasicStep; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Toggling to connected flow when IDs are not ready can leave currentStepId invalid
When disabling disconnected mode, connectedWizardStepIds may still be undefined. In that case, currentStepId remains a disconnected step and navigation functions will fail (indexOf returns -1).
Compute the connected steps (and set them) before switching, and always set a valid current step.
Apply this diff:
setInstallDisconnected: (enabled: boolean) => { setInstallDisconnected(enabled); if (enabled) { onSetCurrentStepId(disconnectedSteps[0]); } else { - connectedWizardStepIds?.length && onSetCurrentStepId(connectedWizardStepIds[0]); + // Build the connected step list deterministically and move to its first step + const staticIpInfo = infraEnv ? getStaticIpInfo(infraEnv) : undefined; + const nextSteps = getWizardStepIds( + connectedWizardStepIds, + staticIpInfo?.view, + customManifestsStep, + isSingleClusterFeatureEnabled, + ); + setWizardStepIds(nextSteps); + onSetCurrentStepId(nextSteps[0]); } },📝 Committable suggestion