@openshift-assisted/ui-lib 2.9.9-cim → 2.9.11-cim
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/cim/components/ClusterDeployment/ScaleUpForm.d.ts +1 -0
- package/build/@types/cim/components/ClusterDeployment/ScaleUpForm.d.ts.map +1 -1
- package/build/@types/cim/components/InfraEnv/utils.d.ts.map +1 -1
- package/build/@types/cim/components/modals/ScaleUpModal.d.ts +1 -0
- package/build/@types/cim/components/modals/ScaleUpModal.d.ts.map +1 -1
- package/build/@types/cim/index.d.ts +1 -0
- package/build/@types/cim/index.d.ts.map +1 -1
- package/build/@types/cim/types/k8s/agent-cluster-install.d.ts +1 -1
- package/build/@types/cim/types/k8s/agent-cluster-install.d.ts.map +1 -1
- package/build/@types/common/api/utils.d.ts +1 -1
- package/build/@types/common/api/utils.d.ts.map +1 -1
- package/build/@types/common/index.d.ts +1 -0
- package/build/@types/common/index.d.ts.map +1 -1
- package/build/@types/common/types/index.d.ts +0 -8
- package/build/@types/common/types/index.d.ts.map +1 -1
- package/build/@types/common/types/resource-ui-state.d.ts +9 -0
- package/build/@types/common/types/resource-ui-state.d.ts.map +1 -0
- package/build/@types/ocm/components/Routes.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.d.ts +1 -1
- package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.d.ts.map +1 -1
- package/build/@types/ocm/components/hosts/DeleteHostModal.d.ts.map +1 -1
- package/build/@types/ocm/config/external-features.d.ts +8 -0
- package/build/@types/ocm/config/external-features.d.ts.map +1 -0
- package/build/@types/ocm/config/index.d.ts +1 -1
- package/build/@types/ocm/config/{routeBaseBath.d.ts → routeBasePath.d.ts} +1 -1
- package/build/@types/ocm/config/routeBasePath.d.ts.map +1 -0
- package/build/@types/ocm/hooks/use-feature-detection.d.ts +3 -0
- package/build/@types/ocm/hooks/use-feature-detection.d.ts.map +1 -0
- package/build/@types/ocm/services/ClusterDetailsService.d.ts.map +1 -1
- package/build/@types/ocm/services/ClustersService.d.ts +3 -3
- package/build/@types/ocm/services/ClustersService.d.ts.map +1 -1
- package/build/@types/ocm/services/InfraEnvIdsCacheService.d.ts +2 -2
- package/build/@types/ocm/services/InfraEnvIdsCacheService.d.ts.map +1 -1
- package/build/@types/ocm/store/hooks.d.ts +17 -5
- package/build/@types/ocm/store/hooks.d.ts.map +1 -1
- package/build/@types/ocm/store/index.d.ts +1 -3
- package/build/@types/ocm/store/index.d.ts.map +1 -1
- package/build/@types/ocm/store/slices/clusters/selectors.d.ts +6 -3
- package/build/@types/ocm/store/slices/clusters/selectors.d.ts.map +1 -1
- package/build/@types/ocm/store/slices/clusters/slice.d.ts +2 -2
- package/build/@types/ocm/store/slices/clusters/slice.d.ts.map +1 -1
- package/build/@types/ocm/store/slices/current-cluster/slice.d.ts +4 -3
- package/build/@types/ocm/store/slices/current-cluster/slice.d.ts.map +1 -1
- package/build/@types/ocm/store/slices/current-user/slice.d.ts +46 -0
- package/build/@types/ocm/store/slices/current-user/slice.d.ts.map +1 -0
- package/build/@types/ocm/store/slices/feature-flags/selectors.d.ts +18 -4
- package/build/@types/ocm/store/slices/feature-flags/selectors.d.ts.map +1 -1
- package/build/@types/ocm/store/slices/feature-flags/slice.d.ts +26 -5
- package/build/@types/ocm/store/slices/feature-flags/slice.d.ts.map +1 -1
- package/build/@types/ocm/store/slices/infra-envs/selectors.d.ts +2 -1
- package/build/@types/ocm/store/slices/infra-envs/selectors.d.ts.map +1 -1
- package/build/@types/ocm/store/store-day1.d.ts +4 -2
- package/build/@types/ocm/store/store-day1.d.ts.map +1 -1
- package/build/@types/ocm/store/types/state-slice.d.ts +16 -0
- package/build/@types/ocm/store/types/state-slice.d.ts.map +1 -0
- package/build/cjs/cim/components/ClusterDeployment/ScaleUpForm.js +7 -4
- package/build/cjs/cim/components/ClusterDeployment/ScaleUpForm.js.map +1 -1
- package/build/cjs/cim/components/InfraEnv/utils.js +6 -6
- package/build/cjs/cim/components/InfraEnv/utils.js.map +1 -1
- package/build/cjs/cim/components/modals/ScaleUpModal.js +2 -2
- package/build/cjs/cim/components/modals/ScaleUpModal.js.map +1 -1
- package/build/cjs/cim/index.js +3 -1
- package/build/cjs/cim/index.js.map +1 -1
- package/build/cjs/common/index.js +3 -0
- package/build/cjs/common/index.js.map +1 -1
- package/build/cjs/common/types/index.js +0 -10
- package/build/cjs/common/types/index.js.map +1 -1
- package/build/cjs/common/types/resource-ui-state.js +13 -0
- package/build/cjs/common/types/resource-ui-state.js.map +1 -0
- package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTab.js +2 -2
- package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTab.js.map +1 -1
- package/build/cjs/ocm/components/Routes.js +3 -5
- package/build/cjs/ocm/components/Routes.js.map +1 -1
- package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js +4 -1
- package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js.map +1 -1
- package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.js +5 -2
- package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.js.map +1 -1
- package/build/cjs/ocm/components/hosts/DeleteHostModal.js +8 -7
- package/build/cjs/ocm/components/hosts/DeleteHostModal.js.map +1 -1
- package/build/cjs/ocm/config/external-features.js +10 -0
- package/build/cjs/ocm/config/external-features.js.map +1 -0
- package/build/cjs/ocm/config/index.js +1 -1
- package/build/cjs/ocm/config/{routeBaseBath.js → routeBasePath.js} +1 -1
- package/build/cjs/ocm/config/routeBasePath.js.map +1 -0
- package/build/cjs/ocm/hooks/use-feature-detection.js +14 -0
- package/build/cjs/ocm/hooks/use-feature-detection.js.map +1 -0
- package/build/cjs/ocm/services/ClusterDetailsService.js +0 -3
- package/build/cjs/ocm/services/ClusterDetailsService.js.map +1 -1
- package/build/cjs/ocm/services/ClustersService.js +19 -19
- package/build/cjs/ocm/services/ClustersService.js.map +1 -1
- package/build/cjs/ocm/services/InfraEnvIdsCacheService.js +5 -5
- package/build/cjs/ocm/services/InfraEnvIdsCacheService.js.map +1 -1
- package/build/cjs/ocm/store/hooks.js +2 -4
- package/build/cjs/ocm/store/hooks.js.map +1 -1
- package/build/cjs/ocm/store/index.js +1 -5
- package/build/cjs/ocm/store/index.js.map +1 -1
- package/build/cjs/ocm/store/slices/clusters/slice.js +9 -8
- package/build/cjs/ocm/store/slices/clusters/slice.js.map +1 -1
- package/build/cjs/ocm/store/slices/current-cluster/slice.js +14 -13
- package/build/cjs/ocm/store/slices/current-cluster/slice.js.map +1 -1
- package/build/cjs/ocm/store/slices/current-user/slice.js +109 -0
- package/build/cjs/ocm/store/slices/current-user/slice.js.map +1 -0
- package/build/cjs/ocm/store/slices/feature-flags/selectors.js +1 -4
- package/build/cjs/ocm/store/slices/feature-flags/selectors.js.map +1 -1
- package/build/cjs/ocm/store/slices/feature-flags/slice.js +79 -6
- package/build/cjs/ocm/store/slices/feature-flags/slice.js.map +1 -1
- package/build/cjs/ocm/store/slices/infra-envs/thunks.js +1 -1
- package/build/cjs/ocm/store/slices/infra-envs/thunks.js.map +1 -1
- package/build/cjs/ocm/store/store-day1.js +2 -4
- package/build/cjs/ocm/store/store-day1.js.map +1 -1
- package/build/cjs/ocm/store/types/state-slice.js +3 -0
- package/build/cjs/ocm/store/types/state-slice.js.map +1 -0
- package/lib/@types/assets.d.ts +1 -1
- package/lib/@types/global.d.ts +1 -0
- package/lib/_test-helpers/mock-container.ts +42 -0
- package/lib/_test-helpers/mock-server.ts +26 -0
- package/lib/_test-helpers/vitest-setup.ts +17 -0
- package/lib/cim/components/ClusterDeployment/ScaleUpForm.tsx +11 -5
- package/lib/cim/components/InfraEnv/utils.ts +7 -6
- package/lib/cim/components/modals/ScaleUpModal.tsx +3 -0
- package/lib/cim/index.ts +1 -0
- package/lib/cim/types/k8s/agent-cluster-install.ts +4 -7
- package/lib/common/api/utils.ts +1 -1
- package/lib/common/index.ts +1 -0
- package/lib/common/types/index.ts +0 -9
- package/lib/common/types/resource-ui-state.ts +8 -0
- package/lib/ocm/components/HostsClusterDetailTab/HostsClusterDetailTab.tsx +2 -2
- package/lib/ocm/components/Routes.tsx +3 -5
- package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.tsx +7 -2
- package/lib/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.ts +6 -1
- package/lib/ocm/components/hosts/DeleteHostModal.tsx +28 -23
- package/lib/ocm/config/external-features.ts +12 -0
- package/lib/ocm/config/index.ts +1 -1
- package/lib/ocm/hooks/_use-feature-detection.test.tsx +125 -0
- package/lib/ocm/hooks/use-feature-detection.ts +17 -0
- package/lib/ocm/services/ClusterDetailsService.ts +0 -4
- package/lib/ocm/services/ClustersService.ts +9 -9
- package/lib/ocm/services/InfraEnvIdsCacheService.ts +2 -2
- package/lib/ocm/store/hooks.ts +1 -4
- package/lib/ocm/store/index.ts +1 -3
- package/lib/ocm/store/slices/clusters/slice.ts +5 -4
- package/lib/ocm/store/slices/current-cluster/slice.ts +9 -15
- package/lib/ocm/store/slices/current-user/slice.ts +129 -0
- package/lib/ocm/store/slices/feature-flags/selectors.ts +6 -7
- package/lib/ocm/store/slices/feature-flags/slice.ts +102 -7
- package/lib/ocm/store/slices/infra-envs/thunks.ts +1 -1
- package/lib/ocm/store/store-day1.ts +2 -4
- package/lib/ocm/store/types/state-slice.ts +16 -0
- package/package.json +17 -5
- package/build/@types/ocm/config/routeBaseBath.d.ts.map +0 -1
- package/build/@types/ocm/store/store-day2.d.ts +0 -10
- package/build/@types/ocm/store/store-day2.d.ts.map +0 -1
- package/build/cjs/ocm/config/routeBaseBath.js.map +0 -1
- package/build/cjs/ocm/store/store-day2.js +0 -20
- package/build/cjs/ocm/store/store-day2.js.map +0 -1
- package/lib/ocm/store/store-day2.ts +0 -19
- /package/lib/cim/components/ClusterDeployment/{wizardTransition.test.ts → _wizardTransition.test.ts} +0 -0
- /package/lib/common/components/ui/formik/{validationSchemas.test.ts → _validationSchemas.test.ts} +0 -0
- /package/lib/ocm/components/clusterWizard/{wizardTransition.test.ts → _wizardTransition.test.ts} +0 -0
- /package/lib/ocm/config/{routeBaseBath.ts → routeBasePath.ts} +0 -0
|
@@ -15,24 +15,30 @@ type ScaleUpFormProps = {
|
|
|
15
15
|
agents: AgentK8sResource[];
|
|
16
16
|
onEditHost: AgentTableActions['onEditHost'];
|
|
17
17
|
onSetInstallationDiskId: AgentTableActions['onSetInstallationDiskId'];
|
|
18
|
+
isNutanix: boolean;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const ScaleUpForm: React.FC<ScaleUpFormProps> = ({
|
|
21
22
|
agents,
|
|
22
23
|
onEditHost,
|
|
23
24
|
onSetInstallationDiskId,
|
|
25
|
+
isNutanix,
|
|
24
26
|
}) => {
|
|
25
27
|
const { values } = useFormikContext<ScaleUpFormValues>();
|
|
26
28
|
const { autoSelectHosts } = values;
|
|
27
29
|
const availableAgents = React.useMemo(
|
|
28
30
|
() =>
|
|
29
|
-
getAgentsForSelection(agents).filter(
|
|
30
|
-
(agent)
|
|
31
|
+
getAgentsForSelection(agents).filter((agent) => {
|
|
32
|
+
if (isNutanix && agent.status?.inventory?.systemVendor?.manufacturer !== 'Nutanix') {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return (
|
|
31
36
|
!(
|
|
32
37
|
agent.spec?.clusterDeploymentName?.name || agent.spec?.clusterDeploymentName?.namespace
|
|
33
|
-
) && agent.status?.inventory.cpu?.architecture === values.cpuArchitecture
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
) && agent.status?.inventory.cpu?.architecture === values.cpuArchitecture
|
|
39
|
+
);
|
|
40
|
+
}),
|
|
41
|
+
[agents, values.cpuArchitecture, isNutanix],
|
|
36
42
|
);
|
|
37
43
|
const { t } = useTranslation();
|
|
38
44
|
return (
|
|
@@ -51,12 +51,6 @@ export const getAgentClusterInstall = ({
|
|
|
51
51
|
// @ts-ignore
|
|
52
52
|
spec: {
|
|
53
53
|
holdInstallation: true,
|
|
54
|
-
clusterDeploymentRef: clusterDeploymentName
|
|
55
|
-
? {
|
|
56
|
-
name: clusterDeploymentName,
|
|
57
|
-
namespace,
|
|
58
|
-
}
|
|
59
|
-
: {},
|
|
60
54
|
networking: {
|
|
61
55
|
clusterNetwork: [
|
|
62
56
|
{
|
|
@@ -75,6 +69,13 @@ export const getAgentClusterInstall = ({
|
|
|
75
69
|
},
|
|
76
70
|
};
|
|
77
71
|
|
|
72
|
+
if (obj.spec && clusterDeploymentName) {
|
|
73
|
+
obj.spec.clusterDeploymentRef = {
|
|
74
|
+
name: clusterDeploymentName,
|
|
75
|
+
namespace,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
78
79
|
if (obj.spec && values.sshPublicKey) {
|
|
79
80
|
obj.spec.sshPublicKey = values.sshPublicKey;
|
|
80
81
|
}
|
|
@@ -58,6 +58,7 @@ type ScaleUpModalProps = {
|
|
|
58
58
|
agents: AgentK8sResource[];
|
|
59
59
|
onChangeHostname: (agent: AgentK8sResource, hostname: string) => Promise<AgentK8sResource>;
|
|
60
60
|
onSetInstallationDiskId: AgentTableActions['onSetInstallationDiskId'];
|
|
61
|
+
isNutanix: boolean;
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const ScaleUpModal: React.FC<ScaleUpModalProps> = ({
|
|
@@ -68,6 +69,7 @@ const ScaleUpModal: React.FC<ScaleUpModalProps> = ({
|
|
|
68
69
|
agents,
|
|
69
70
|
onChangeHostname,
|
|
70
71
|
onSetInstallationDiskId,
|
|
72
|
+
isNutanix,
|
|
71
73
|
}) => {
|
|
72
74
|
const [editAgent, setEditAgent] = React.useState<AgentK8sResource | undefined>();
|
|
73
75
|
const [error, setError] = React.useState<string | undefined>();
|
|
@@ -138,6 +140,7 @@ const ScaleUpModal: React.FC<ScaleUpModalProps> = ({
|
|
|
138
140
|
agents={agents}
|
|
139
141
|
onEditHost={setEditAgent}
|
|
140
142
|
onSetInstallationDiskId={onSetInstallationDiskId}
|
|
143
|
+
isNutanix={isNutanix}
|
|
141
144
|
/>
|
|
142
145
|
</StackItem>
|
|
143
146
|
{error && (
|
package/lib/cim/index.ts
CHANGED
|
@@ -16,13 +16,10 @@ export type AgentClusterInstallStatusCondition =
|
|
|
16
16
|
|
|
17
17
|
export type AgentClusterInstallK8sResource = K8sResourceCommon & {
|
|
18
18
|
spec?: {
|
|
19
|
-
clusterDeploymentRef?:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
25
|
-
| {};
|
|
19
|
+
clusterDeploymentRef?: {
|
|
20
|
+
name: string;
|
|
21
|
+
namespace: string;
|
|
22
|
+
};
|
|
26
23
|
clusterMetadata?: {
|
|
27
24
|
adminKubeconfigSecretRef?: {
|
|
28
25
|
name: string;
|
package/lib/common/api/utils.ts
CHANGED
package/lib/common/index.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { AlertsContextProvider, FeatureGateContextProvider } from '../../../comm
|
|
|
5
5
|
import { HostsClusterDetailTabContent } from './HostsClusterDetailTabContent';
|
|
6
6
|
import { HostsClusterDetailTabProps } from './types';
|
|
7
7
|
import { storeDay1 } from '../../store';
|
|
8
|
-
import {
|
|
8
|
+
import { useFeatureDetection } from '../../hooks/use-feature-detection';
|
|
9
9
|
|
|
10
10
|
const HostsClusterDetailTab = (props: HostsClusterDetailTabProps) => {
|
|
11
|
-
|
|
11
|
+
useFeatureDetection();
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<Provider store={storeDay1}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Provider } from 'react-redux';
|
|
3
3
|
import { Switch, Route, Redirect } from 'react-router-dom';
|
|
4
4
|
import { Clusters, ClusterPage, NewClusterPage } from './clusters';
|
|
@@ -7,15 +7,13 @@ import type { FeatureListType } from '../../common/features/featureGate';
|
|
|
7
7
|
import { routeBasePath } from '../config';
|
|
8
8
|
import { AssistedUILibVersion } from './ui';
|
|
9
9
|
import { storeDay1 } from '../store';
|
|
10
|
-
import {
|
|
10
|
+
import { useFeatureDetection } from '../hooks/use-feature-detection';
|
|
11
11
|
|
|
12
12
|
export const Routes: React.FC<{ allEnabledFeatures: FeatureListType }> = ({
|
|
13
13
|
allEnabledFeatures,
|
|
14
14
|
children,
|
|
15
15
|
}) => {
|
|
16
|
-
|
|
17
|
-
storeDay1.dispatch(featureFlagsActions.setFeatureFlags(allEnabledFeatures));
|
|
18
|
-
}, [allEnabledFeatures]);
|
|
16
|
+
useFeatureDetection(allEnabledFeatures);
|
|
19
17
|
|
|
20
18
|
return (
|
|
21
19
|
<Provider store={storeDay1}>
|
package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.tsx
CHANGED
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
InfraEnv,
|
|
47
47
|
V2ClusterUpdateParams,
|
|
48
48
|
} from '@openshift-assisted/types/assisted-installer-service';
|
|
49
|
+
import { useNewFeatureSupportLevel } from '../../../../common/components/newFeatureSupportLevels';
|
|
49
50
|
|
|
50
51
|
const NetworkConfigurationForm: React.FC<{
|
|
51
52
|
cluster: Cluster;
|
|
@@ -157,10 +158,14 @@ const NetworkConfigurationPage = ({ cluster }: { cluster: Cluster }) => {
|
|
|
157
158
|
const { addAlert, clearAlerts, alerts } = useAlerts();
|
|
158
159
|
const dispatch = useDispatch();
|
|
159
160
|
const { isViewerMode } = useSelector(selectCurrentClusterPermissionsState);
|
|
160
|
-
|
|
161
161
|
const hostSubnets = React.useMemo(() => getHostSubnets(cluster, true), [cluster]);
|
|
162
|
+
const featureSupportLevelData = useNewFeatureSupportLevel();
|
|
163
|
+
const isClusterManagedNetworkingUnsupported = !featureSupportLevelData.isFeatureSupported(
|
|
164
|
+
'CLUSTER_MANAGED_NETWORKING',
|
|
165
|
+
);
|
|
162
166
|
const initialValues = React.useMemo(
|
|
163
|
-
() =>
|
|
167
|
+
() =>
|
|
168
|
+
getNetworkInitialValues(cluster, defaultNetworkValues, isClusterManagedNetworkingUnsupported),
|
|
164
169
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
165
170
|
[], // just once, Formik does not reinitialize
|
|
166
171
|
);
|
|
@@ -31,6 +31,7 @@ export const getNetworkInitialValues = (
|
|
|
31
31
|
| 'serviceNetworksIpv4'
|
|
32
32
|
| 'serviceNetworksDualstack'
|
|
33
33
|
>,
|
|
34
|
+
isClusterManagedNetworkingUnsupported: boolean,
|
|
34
35
|
): NetworkConfigurationValues => {
|
|
35
36
|
const isSNOCluster = isSNO(cluster);
|
|
36
37
|
const isDualStackType = isDualStack(cluster);
|
|
@@ -40,7 +41,11 @@ export const getNetworkInitialValues = (
|
|
|
40
41
|
ingressVips: cluster.ingressVips,
|
|
41
42
|
sshPublicKey: cluster.sshPublicKey || '',
|
|
42
43
|
vipDhcpAllocation: cluster.vipDhcpAllocation,
|
|
43
|
-
managedNetworkingType:
|
|
44
|
+
managedNetworkingType:
|
|
45
|
+
(cluster.apiVips && cluster.apiVips.length === 0 && isClusterManagedNetworkingUnsupported) ||
|
|
46
|
+
isSNOCluster
|
|
47
|
+
? 'userManaged'
|
|
48
|
+
: 'clusterManaged',
|
|
44
49
|
networkType: cluster.networkType || getDefaultNetworkType(isSNOCluster, isDualStackType),
|
|
45
50
|
machineNetworks: cluster.machineNetworks || [],
|
|
46
51
|
stackType: isDualStackType ? DUAL_STACK : IPV4_STACK,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Modal, ModalVariant, Button, ButtonVariant } from '@patternfly/react-core';
|
|
3
|
+
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
3
4
|
|
|
4
5
|
type DeleteHostModalProps = {
|
|
5
6
|
hostname?: string;
|
|
@@ -8,28 +9,32 @@ type DeleteHostModalProps = {
|
|
|
8
9
|
onDelete: () => void;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
const DeleteHostModal = ({ isOpen, hostname, onClose, onDelete }: DeleteHostModalProps) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
const DeleteHostModal = ({ isOpen, hostname, onClose, onDelete }: DeleteHostModalProps) => {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
return (
|
|
15
|
+
<Modal
|
|
16
|
+
title={t('ai:Remove host?')}
|
|
17
|
+
isOpen={isOpen}
|
|
18
|
+
onClose={onClose}
|
|
19
|
+
variant={ModalVariant.small}
|
|
20
|
+
titleIconVariant="warning"
|
|
21
|
+
actions={[
|
|
22
|
+
<Button
|
|
23
|
+
data-testid="delete-host-submit"
|
|
24
|
+
key="confirm"
|
|
25
|
+
variant={ButtonVariant.danger}
|
|
26
|
+
onClick={onDelete}
|
|
27
|
+
>
|
|
28
|
+
{t('ai:Remove host')}
|
|
29
|
+
</Button>,
|
|
30
|
+
<Button key="cancel" variant={ButtonVariant.link} onClick={onClose}>
|
|
31
|
+
{t('ai:Cancel')}
|
|
32
|
+
</Button>,
|
|
33
|
+
]}
|
|
34
|
+
>
|
|
35
|
+
{t('ai:Host {{hostname}} will be removed', { hostname: hostname || '' })}
|
|
36
|
+
</Modal>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
34
39
|
|
|
35
40
|
export default DeleteHostModal;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FeatureListType } from '../../common/features/featureGate';
|
|
2
|
+
|
|
3
|
+
type FeatureMapping = {
|
|
4
|
+
featureId: keyof FeatureListType;
|
|
5
|
+
capabilityId: string;
|
|
6
|
+
};
|
|
7
|
+
export const externalFeaturesMappings: Array<FeatureMapping> = [
|
|
8
|
+
{
|
|
9
|
+
featureId: 'ASSISTED_INSTALLER_PLATFORM_OCI',
|
|
10
|
+
capabilityId: 'capability.organization.bare_metal_installer_platform_oci',
|
|
11
|
+
},
|
|
12
|
+
];
|
package/lib/ocm/config/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './routeBasePath';
|
|
2
2
|
export * from './constants';
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { Account, Organization } from '@openshift-assisted/types/accounts-management-service';
|
|
2
|
+
import { describe, it, vi, expect } from 'vitest';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Provider } from 'react-redux';
|
|
5
|
+
import { render } from 'react-dom';
|
|
6
|
+
import { act } from 'react-dom/test-utils';
|
|
7
|
+
import { featureFlagsActions, FeatureFlagsState } from '../store/slices/feature-flags/slice';
|
|
8
|
+
import { isFeatureEnabled } from '../store/slices/feature-flags/selectors';
|
|
9
|
+
import { RootStateDay1, storeDay1 } from '../store/store-day1';
|
|
10
|
+
import { useFeatureDetection } from './use-feature-detection';
|
|
11
|
+
import { CurrentAccountApi } from '../../common/api/accounts-management-service/current-account-api';
|
|
12
|
+
import { OrganizationsApi } from '../../common/api/accounts-management-service/organizations-api';
|
|
13
|
+
import { getMockContainer } from '../../_test-helpers/mock-container';
|
|
14
|
+
|
|
15
|
+
vi.spyOn(featureFlagsActions, 'setFeatureFlag');
|
|
16
|
+
vi.spyOn(CurrentAccountApi, 'getCurrentAccount').mockImplementation(() => {
|
|
17
|
+
return Promise.resolve({
|
|
18
|
+
username: 'jdoe',
|
|
19
|
+
} as Account);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const makeSpyOn$OrganizationsApi$getOrganization = (mockResponse: Organization) =>
|
|
23
|
+
vi.spyOn(OrganizationsApi, 'getOrganization').mockImplementation(() => {
|
|
24
|
+
return Promise.resolve(mockResponse);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('use-feature-detection.ts', () => {
|
|
28
|
+
it('Sets only external features when no overrides are provided', async () => {
|
|
29
|
+
const DummyComponent: React.FC = () => {
|
|
30
|
+
useFeatureDetection();
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
33
|
+
makeSpyOn$OrganizationsApi$getOrganization({
|
|
34
|
+
capabilities: [
|
|
35
|
+
{
|
|
36
|
+
name: 'capability.organization.bare_metal_installer_platform_oci',
|
|
37
|
+
value: 'true',
|
|
38
|
+
inherited: true,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
await act(() =>
|
|
44
|
+
Promise.resolve(
|
|
45
|
+
render(
|
|
46
|
+
<Provider store={storeDay1}>
|
|
47
|
+
<DummyComponent />
|
|
48
|
+
</Provider>,
|
|
49
|
+
getMockContainer(),
|
|
50
|
+
),
|
|
51
|
+
),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
expect(
|
|
55
|
+
isFeatureEnabled(
|
|
56
|
+
storeDay1.getState() as RootStateDay1 & FeatureFlagsState,
|
|
57
|
+
'ASSISTED_INSTALLER_PLATFORM_OCI',
|
|
58
|
+
),
|
|
59
|
+
).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('Internal features override external features', async () => {
|
|
63
|
+
const featuresOverride = { ASSISTED_INSTALLER_PLATFORM_OCI: true };
|
|
64
|
+
const DummyComponent: React.FC = () => {
|
|
65
|
+
useFeatureDetection(featuresOverride);
|
|
66
|
+
return null;
|
|
67
|
+
};
|
|
68
|
+
makeSpyOn$OrganizationsApi$getOrganization({
|
|
69
|
+
capabilities: [
|
|
70
|
+
{
|
|
71
|
+
name: 'capability.organization.bare_metal_installer_platform_oci',
|
|
72
|
+
value: 'false',
|
|
73
|
+
inherited: true,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
await act(() =>
|
|
79
|
+
Promise.resolve(
|
|
80
|
+
render(
|
|
81
|
+
<Provider store={storeDay1}>
|
|
82
|
+
<DummyComponent />
|
|
83
|
+
</Provider>,
|
|
84
|
+
getMockContainer(),
|
|
85
|
+
),
|
|
86
|
+
),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
expect(
|
|
90
|
+
isFeatureEnabled(
|
|
91
|
+
storeDay1.getState() as RootStateDay1 & FeatureFlagsState,
|
|
92
|
+
'ASSISTED_INSTALLER_PLATFORM_OCI',
|
|
93
|
+
),
|
|
94
|
+
).toBe(featuresOverride.ASSISTED_INSTALLER_PLATFORM_OCI);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('Processes only features prefixed with ASSISTED_INSTALLER', async () => {
|
|
98
|
+
const featuresOverride = { NON_ASSISTED_INSTALLER_FEATURE: true };
|
|
99
|
+
const DummyComponent: React.FC = () => {
|
|
100
|
+
useFeatureDetection(featuresOverride);
|
|
101
|
+
return null;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
await act(() =>
|
|
105
|
+
Promise.resolve(
|
|
106
|
+
render(
|
|
107
|
+
<Provider store={storeDay1}>
|
|
108
|
+
<DummyComponent />
|
|
109
|
+
</Provider>,
|
|
110
|
+
getMockContainer(),
|
|
111
|
+
),
|
|
112
|
+
),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
/* Here we don't mock the call to the user organization API, therefore the
|
|
116
|
+
* capabilities in the currentUser slice should remain undefined, since the list
|
|
117
|
+
* of featuresOverride should get filtered out of features not prefixed with
|
|
118
|
+
* "ASSISTED_INSTALLER" there should be no call to setFeatureFlag.
|
|
119
|
+
*/
|
|
120
|
+
expect(featureFlagsActions.setFeatureFlag).not.toHaveBeenCalled();
|
|
121
|
+
expect(
|
|
122
|
+
storeDay1.getState().featureFlags.data['NON_ASSISTED_INSTALLER_FEATURE'],
|
|
123
|
+
).not.toBeDefined();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FeatureListType } from '../../common/features/featureGate';
|
|
2
|
+
import { featureFlagsAsyncActions } from '../store/slices/feature-flags/slice';
|
|
3
|
+
import { storeDay1 } from '../store/store-day1';
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
export function useFeatureDetection<T extends Partial<Record<string, boolean> & FeatureListType>>(
|
|
7
|
+
overrides: T | null = null,
|
|
8
|
+
) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const onlyAssistedInstallerFeatures = Object.fromEntries(
|
|
11
|
+
Object.entries(overrides ?? {}).filter(([k, _v]) => k.startsWith('ASSISTED_INSTALLER')),
|
|
12
|
+
);
|
|
13
|
+
void storeDay1.dispatch(
|
|
14
|
+
featureFlagsAsyncActions.detectFeaturesAsync(onlyAssistedInstallerFeatures),
|
|
15
|
+
);
|
|
16
|
+
}, [overrides]);
|
|
17
|
+
}
|
|
@@ -47,10 +47,6 @@ const ClusterDetailsService = {
|
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
if (!values.isCMNSupported) {
|
|
51
|
-
params.userManagedNetworking = true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
50
|
if (values.hostsNetworkConfigurationType === HostsNetworkConfigurationType.STATIC) {
|
|
55
51
|
params.staticNetworkConfig = getDummyInfraEnvField();
|
|
56
52
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import InfraEnvsService from './InfraEnvsService';
|
|
4
|
-
import { AI_UI_TAG } from '../../common';
|
|
5
|
-
import { isInOcm } from '../api';
|
|
6
|
-
import { ClusterCreateParamsWithStaticNetworking } from './types';
|
|
7
|
-
import omit from 'lodash-es/omit.js';
|
|
8
|
-
import {
|
|
1
|
+
import type { ClusterCreateParamsWithStaticNetworking } from './types';
|
|
2
|
+
import type {
|
|
9
3
|
CustomManifestValues,
|
|
10
4
|
ListManifestsExtended,
|
|
11
5
|
} from '../components/clusterConfiguration/manifestsConfiguration/data/dataTypes';
|
|
12
|
-
import {
|
|
6
|
+
import type {
|
|
13
7
|
Cluster,
|
|
14
8
|
Host,
|
|
15
9
|
InfraEnvCreateParams,
|
|
16
10
|
UpdateManifestParams,
|
|
17
11
|
V2ClusterUpdateParams,
|
|
18
12
|
} from '@openshift-assisted/types/assisted-installer-service';
|
|
13
|
+
import omit from 'lodash-es/omit.js';
|
|
14
|
+
import ClustersAPI from '../../common/api/assisted-service/ClustersAPI';
|
|
15
|
+
import HostsService from './HostsService';
|
|
16
|
+
import InfraEnvsService from './InfraEnvsService';
|
|
17
|
+
import { AI_UI_TAG } from '../../common/config/constants';
|
|
18
|
+
import { isInOcm } from '../../common/api/axiosClient';
|
|
19
19
|
|
|
20
20
|
const ClustersService = {
|
|
21
21
|
findHost(hosts: Cluster['hosts'] = [], hostId: Host['id']) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Cluster, InfraEnv } from '@openshift-assisted/types/assisted-installer-service';
|
|
2
|
+
import { CpuArchitecture, getAllCpuArchitectures } from '../../common//types/cpuArchitecture';
|
|
3
3
|
|
|
4
4
|
const CACHE_KEY = 'infra-env-ids-cache-v2';
|
|
5
5
|
|
package/lib/ocm/store/hooks.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { useDispatch, useSelector } from 'react-redux';
|
|
2
2
|
import type { TypedUseSelectorHook } from 'react-redux';
|
|
3
3
|
import type { DispatchDay1, RootStateDay1 } from './store-day1';
|
|
4
|
-
import type { DispatchDay2, RootStateDay2 } from './store-day2';
|
|
5
4
|
|
|
6
|
-
export const useDispatchDay1
|
|
5
|
+
export const useDispatchDay1 = useDispatch<DispatchDay1>;
|
|
7
6
|
export const useSelectorDay1: TypedUseSelectorHook<RootStateDay1> = useSelector;
|
|
8
|
-
export const useDispatchDay2: () => DispatchDay2 = useDispatch;
|
|
9
|
-
export const useSelectorDay2: TypedUseSelectorHook<RootStateDay2> = useSelector;
|
package/lib/ocm/store/index.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export { storeDay1 } from './store-day1';
|
|
2
|
-
export { storeDay2 } from './store-day2';
|
|
3
2
|
export type { RootStateDay1, DispatchDay1 } from './store-day1';
|
|
4
|
-
export
|
|
5
|
-
export { useSelectorDay1, useSelectorDay2, useDispatchDay1, useDispatchDay2 } from './hooks';
|
|
3
|
+
export { useSelectorDay1, useDispatchDay1 } from './hooks';
|
|
@@ -6,10 +6,11 @@ import {
|
|
|
6
6
|
AnyAction,
|
|
7
7
|
Dispatch,
|
|
8
8
|
} from '@reduxjs/toolkit';
|
|
9
|
-
import { ResourceUIState } from '../../../../common';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
|
|
9
|
+
import { ResourceUIState } from '../../../../common/types/resource-ui-state';
|
|
10
|
+
import ClustersAPI from '../../../../common/api/assisted-service/ClustersAPI';
|
|
11
|
+
import { isInOcm } from '../../../../common/api/axiosClient';
|
|
12
|
+
import type { Cluster } from '@openshift-assisted/types/assisted-installer-service';
|
|
13
|
+
import { handleApiError } from '../../../../common/api/utils';
|
|
13
14
|
|
|
14
15
|
export const fetchClustersAsync = createAsyncThunk<Cluster[] | void>(
|
|
15
16
|
'clusters/fetchClustersAsync',
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import findIndex from 'lodash-es/findIndex.js';
|
|
2
2
|
import set from 'lodash-es/set.js';
|
|
3
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
4
|
import { AxiosError } from 'axios';
|
|
5
|
+
import type { AnyAction, Dispatch, PayloadAction, ThunkDispatch } from '@reduxjs/toolkit';
|
|
6
|
+
import type { Cluster, Host } from '@openshift-assisted/types/assisted-installer-service';
|
|
7
|
+
import type { AssistedInstallerPermissionTypesListType } from '../../../../common/features/featureGate';
|
|
4
8
|
import {
|
|
5
|
-
AnyAction,
|
|
6
|
-
createAsyncThunk,
|
|
7
|
-
createSlice,
|
|
8
|
-
Dispatch,
|
|
9
|
-
PayloadAction,
|
|
10
|
-
ThunkDispatch,
|
|
11
|
-
} from '@reduxjs/toolkit';
|
|
12
|
-
import { Cluster, Host } from '@openshift-assisted/types/assisted-installer-service';
|
|
13
|
-
import {
|
|
14
|
-
AssistedInstallerPermissionTypesListType,
|
|
15
|
-
FETCH_ABORTED_ERROR_CODE,
|
|
16
|
-
getApiErrorCode,
|
|
17
|
-
getApiErrorMessage,
|
|
18
9
|
handleApiError,
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
getApiErrorMessage,
|
|
11
|
+
getApiErrorCode,
|
|
12
|
+
FETCH_ABORTED_ERROR_CODE,
|
|
13
|
+
} from '../../../../common/api/utils';
|
|
14
|
+
import { ResourceUIState } from '../../../../common/types/resource-ui-state';
|
|
21
15
|
import ClustersService from '../../../services/ClustersService';
|
|
22
16
|
|
|
23
17
|
export type FetchErrorType = {
|