Skip to content

Commit 7b7b58c

Browse files
authored
Merge branch 'master' into Add-download-kubeconfig-wizard-page
2 parents 329e21e + 3ef7508 commit 7b7b58c

File tree

13 files changed

+91
-247
lines changed

13 files changed

+91
-247
lines changed

Diff for: .github/workflows/push-to-master-disconnected.yaml

-92
This file was deleted.

Diff for: OWNERS

+5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
approvers:
2+
- ammont82
23
- batzionb
34
- celdrake
5+
- jgyselov
46
- jkilzi
57
- rawagner
68
options: {}
79
reviewers:
10+
- ammont82
811
- batzionb
912
- celdrake
13+
- ElayAharoni
14+
- jgyselov
1015
- jkilzi
1116
- rawagner

Diff for: apps/assisted-disconnected-ui/src/components/App.tsx

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
import * as React from 'react';
22
import { BrowserRouter, Routes, Route } from 'react-router-dom-v5-compat';
33
import { Brand, Masthead, MastheadBrand, MastheadMain, Page } from '@patternfly/react-core';
4-
import '../i18n';
5-
import { CreateClusterWizard, EditClusterWizard } from './Wizard';
64
import { Provider } from 'react-redux';
7-
import { Store } from '@openshift-assisted/ui-lib/ocm';
5+
import { Store, useFeatureDetection } from '@openshift-assisted/ui-lib/ocm';
6+
import { FeatureListType } from '@openshift-assisted/ui-lib/lib/common';
7+
8+
import CreateClusterWizard from './CreateClusterWizard';
9+
import ClusterPage from './ClusterPage';
10+
import '../i18n';
11+
12+
const features: FeatureListType = {
13+
ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE: true,
14+
};
15+
16+
const AppRouter = () => {
17+
useFeatureDetection(features);
18+
return (
19+
<Routes>
20+
<Route path="/" element={<CreateClusterWizard />} />
21+
<Route path="/:clusterId" element={<ClusterPage />} />
22+
</Routes>
23+
);
24+
};
825

926
export const App: React.FC = () => {
1027
const header = (
@@ -27,10 +44,7 @@ export const App: React.FC = () => {
2744
<BrowserRouter>
2845
<Provider store={Store.storeDay1}>
2946
<Page header={header} isManagedSidebar defaultManagedSidebarIsOpen={false}>
30-
<Routes>
31-
<Route path="/" element={<CreateClusterWizard />} />
32-
<Route path="/:clusterId" element={<EditClusterWizard />} />
33-
</Routes>
47+
<AppRouter />
3448
</Page>
3549
</Provider>
3650
</BrowserRouter>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { SingleClusterPage } from '@openshift-assisted/ui-lib/ocm';
2+
import { useParams } from 'react-router-dom-v5-compat';
3+
4+
const ClusterPage = () => {
5+
const { clusterId } = useParams() as { clusterId: string };
6+
return <SingleClusterPage clusterId={clusterId} />;
7+
};
8+
9+
export default ClusterPage;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { useCluster } from '../hooks/useCluster';
2+
import { AlertsContextProvider } from '@openshift-assisted/ui-lib/common';
3+
import {
4+
ClusterLoading,
5+
ClusterWizardContextProvider,
6+
OpenshiftVersionsContextProvider,
7+
NewFeatureSupportLevelProvider,
8+
NewClusterWizard,
9+
} from '@openshift-assisted/ui-lib/ocm';
10+
import { Alert, PageSection, PageSectionVariants } from '@patternfly/react-core';
11+
import { useNavigate } from 'react-router-dom-v5-compat';
12+
13+
const CreateClusterWizard = () => {
14+
const [clusterId, isLoading, error] = useCluster();
15+
const navigate = useNavigate();
16+
if (isLoading) {
17+
return <ClusterLoading />;
18+
}
19+
20+
if (error) {
21+
return (
22+
<PageSection variant={PageSectionVariants.light} isFilled>
23+
<Alert isInline variant="danger" title="Failed to fetch clusters" />
24+
</PageSection>
25+
);
26+
}
27+
28+
if (clusterId) {
29+
navigate(`/${clusterId}`);
30+
}
31+
32+
return (
33+
<AlertsContextProvider>
34+
<ClusterWizardContextProvider>
35+
<OpenshiftVersionsContextProvider>
36+
<NewFeatureSupportLevelProvider loadingUi={<ClusterLoading />}>
37+
<NewClusterWizard />
38+
</NewFeatureSupportLevelProvider>
39+
</OpenshiftVersionsContextProvider>
40+
</ClusterWizardContextProvider>
41+
</AlertsContextProvider>
42+
);
43+
};
44+
45+
export default CreateClusterWizard;

Diff for: apps/assisted-disconnected-ui/src/components/Wizard.tsx

-125
This file was deleted.

Diff for: libs/ui-lib/lib/ocm/components/clusterConfiguration/HostInventory.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ import { OcmSwitchField } from '../ui/OcmFormFields';
2424
import { selectCurrentClusterPermissionsState } from '../../store/slices/current-cluster/selectors';
2525
import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
2626
import { useFeature } from '../../hooks/use-feature';
27-
import { useClusterWizardContext } from '../clusterWizard/ClusterWizardContext';
2827

2928
const schedulableMastersTooltip =
3029
'Workloads must be run on control plane nodes when less than 5 hosts are discovered';
3130

3231
const HostInventory = ({ cluster }: { cluster: Cluster }) => {
3332
const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
34-
const { isDisconnectedMode } = useClusterWizardContext();
3533
const mastersMustRunWorkloads = selectMastersMustRunWorkloads(cluster);
3634
const { setFieldValue } = useFormikContext<HostDiscoveryValues>();
3735
const { isViewerMode } = useSelector(selectCurrentClusterPermissionsState);
@@ -46,7 +44,7 @@ const HostInventory = ({ cluster }: { cluster: Cluster }) => {
4644
<ClusterWizardStepHeader>Host discovery</ClusterWizardStepHeader>
4745
</StackItem>
4846
<StackItem>
49-
{!isViewerMode && !isSingleClusterFeatureEnabled && !isDisconnectedMode && (
47+
{!isViewerMode && !isSingleClusterFeatureEnabled && (
5048
<TextContent>
5149
<Text component="p">
5250
<DiscoveryImageModalButton

Diff for: libs/ui-lib/lib/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.tsx

+6-10
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ export const OcmClusterDetailsFormFields = ({
133133

134134
<OcmBaseDomainField managedDomains={managedDomains} clusterExists={clusterExists} />
135135

136-
{/* TODO(mlibra): For single-cluster: We will probably change this to just a static text */}
137136
{forceOpenshiftVersion ? (
138137
<OcmOpenShiftVersion
139138
versions={versions}
@@ -184,15 +183,12 @@ export const OcmClusterDetailsFormFields = ({
184183
)}
185184
<CustomManifestCheckbox clusterId={clusterId || ''} isDisabled={platform === 'external'} />
186185

187-
{
188-
// Reason: In the single-cluster flow, the Host discovery phase is replaced by a single one-fits-all ISO download
189-
!isSingleClusterFeatureEnabled && (
190-
<HostsNetworkConfigurationControlGroup
191-
clusterExists={clusterExists}
192-
isDisabled={platform === 'external'}
193-
/>
194-
)
195-
}
186+
{!isSingleClusterFeatureEnabled && (
187+
<HostsNetworkConfigurationControlGroup
188+
clusterExists={clusterExists}
189+
isDisabled={platform === 'external'}
190+
/>
191+
)}
196192

197193
<DiskEncryptionControlGroup
198194
values={values}

Diff for: libs/ui-lib/lib/ocm/components/clusterWizard/ClusterWizardContext.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export type ClusterWizardContextType = {
1818
setWizardPerPage: (perPage: number) => void;
1919
updateUISettings: (data: UISettingsValues) => Promise<void>;
2020
uiSettings?: UISettingsValues;
21-
isDisconnectedMode: boolean;
2221
};
2322

2423
export const ClusterWizardContext = React.createContext<ClusterWizardContextType | null>(null);

0 commit comments

Comments
 (0)