@openshift-assisted/ui-lib 2.9.10-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/index.d.ts +1 -0
- package/build/@types/cim/index.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/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/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/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/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/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/index.ts +1 -0
- 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/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/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 +12 -4
- 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
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 = {
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { PayloadAction, SerializedError } from '@reduxjs/toolkit';
|
|
2
|
+
import type { Account, Capability } from '@openshift-assisted/types/accounts-management-service';
|
|
3
|
+
import type { StateSliceWithMeta } from '../../types/state-slice';
|
|
4
|
+
import type { RootStateDay1 } from '../../store-day1';
|
|
5
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
6
|
+
import { CurrentAccountApi } from '../../../../common/api/accounts-management-service/current-account-api';
|
|
7
|
+
import { OrganizationsApi } from '../../../../common/api/accounts-management-service/organizations-api';
|
|
8
|
+
|
|
9
|
+
const currentUserAsyncActions = {
|
|
10
|
+
getAccountAsync: createAsyncThunk('currentUser/getAccountAsync', async (_, thunkApi) => {
|
|
11
|
+
const account = await CurrentAccountApi.getCurrentAccount();
|
|
12
|
+
if (account) {
|
|
13
|
+
thunkApi.dispatch(currentUserActions.setAccount(account));
|
|
14
|
+
} else {
|
|
15
|
+
thunkApi.rejectWithValue({
|
|
16
|
+
message: 'No account data available',
|
|
17
|
+
} as SerializedError);
|
|
18
|
+
}
|
|
19
|
+
}),
|
|
20
|
+
|
|
21
|
+
getUserOrganizationWithCapabilitiesAsync: createAsyncThunk(
|
|
22
|
+
'currentUser/getUserOrganizationWithCapabilitiesAsync',
|
|
23
|
+
async (orgId: string, thunkApi) => {
|
|
24
|
+
const organization = await OrganizationsApi.getOrganization(orgId);
|
|
25
|
+
if (organization) {
|
|
26
|
+
thunkApi.dispatch(
|
|
27
|
+
currentUserActions.setOrganizationCapabilities(organization.capabilities ?? []),
|
|
28
|
+
);
|
|
29
|
+
} else {
|
|
30
|
+
thunkApi.rejectWithValue({
|
|
31
|
+
message: 'No organization data found',
|
|
32
|
+
} as SerializedError);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
),
|
|
36
|
+
|
|
37
|
+
getCapabilitiesAsync: createAsyncThunk(
|
|
38
|
+
'currentUser/getCapabilitiesAsync',
|
|
39
|
+
async (_, thunkApi) => {
|
|
40
|
+
await thunkApi.dispatch(currentUserAsyncActions.getAccountAsync());
|
|
41
|
+
const { currentUser } = thunkApi.getState() as RootStateDay1;
|
|
42
|
+
const orgId = currentUser.data?.organization_id;
|
|
43
|
+
if (orgId) {
|
|
44
|
+
await thunkApi.dispatch(
|
|
45
|
+
currentUserAsyncActions.getUserOrganizationWithCapabilitiesAsync(orgId),
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
thunkApi.rejectWithValue({
|
|
49
|
+
message: 'Account has no organization ID',
|
|
50
|
+
} as SerializedError);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type AsyncThunkActions = (typeof currentUserAsyncActions)[keyof typeof currentUserAsyncActions];
|
|
57
|
+
type CurrentUserAsyncThunkActionCreators =
|
|
58
|
+
| ReturnType<AsyncThunkActions['pending']>
|
|
59
|
+
| ReturnType<AsyncThunkActions['fulfilled']>
|
|
60
|
+
| ReturnType<AsyncThunkActions['rejected']>;
|
|
61
|
+
|
|
62
|
+
export type CurrentUserState = StateSliceWithMeta<
|
|
63
|
+
Omit<Account, 'capabilities'> | null,
|
|
64
|
+
SerializedError | null
|
|
65
|
+
>;
|
|
66
|
+
|
|
67
|
+
const currentUserSlice = createSlice({
|
|
68
|
+
name: 'currentUser',
|
|
69
|
+
initialState: (): CurrentUserState => ({
|
|
70
|
+
data: null,
|
|
71
|
+
error: null,
|
|
72
|
+
meta: {
|
|
73
|
+
status: 'idle',
|
|
74
|
+
updatedAt: null,
|
|
75
|
+
currentRequestId: null,
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
reducers: {
|
|
79
|
+
setMeta: (state, action: PayloadAction<CurrentUserAsyncThunkActionCreators>) => {
|
|
80
|
+
state.meta.updatedAt = new Date().toUTCString();
|
|
81
|
+
state.meta.status = action.payload.meta.requestStatus;
|
|
82
|
+
state.meta.currentRequestId = action.payload.meta.requestId;
|
|
83
|
+
return state;
|
|
84
|
+
},
|
|
85
|
+
setAccount: (state, action: PayloadAction<Account>) => {
|
|
86
|
+
state.data = action.payload;
|
|
87
|
+
state.error = null;
|
|
88
|
+
state.meta.updatedAt = new Date().toUTCString();
|
|
89
|
+
return state;
|
|
90
|
+
},
|
|
91
|
+
setOrganizationCapabilities: (state, action: PayloadAction<Capability[]>) => {
|
|
92
|
+
if (state.data !== null && state.data.organization) {
|
|
93
|
+
state.data.organization.capabilities = action.payload;
|
|
94
|
+
state.error = null;
|
|
95
|
+
state.meta.updatedAt = new Date().toUTCString();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return state;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
extraReducers: (builder) => {
|
|
102
|
+
for (const { pending, fulfilled, rejected } of Object.values(currentUserAsyncActions)) {
|
|
103
|
+
builder.addCase(pending, (state, action) => {
|
|
104
|
+
if (/idle|fulfilled|rejected/.test(state.meta.status)) {
|
|
105
|
+
currentUserActions.setMeta(action);
|
|
106
|
+
}
|
|
107
|
+
return state;
|
|
108
|
+
});
|
|
109
|
+
builder.addCase(fulfilled, (state, action) => {
|
|
110
|
+
if (/idle|pending/.test(state.meta.status)) {
|
|
111
|
+
currentUserActions.setMeta(action);
|
|
112
|
+
}
|
|
113
|
+
return state;
|
|
114
|
+
});
|
|
115
|
+
builder.addCase(rejected, (state, action) => {
|
|
116
|
+
if (/idle|pending/.test(state.meta.status)) {
|
|
117
|
+
currentUserActions.setMeta(action);
|
|
118
|
+
state.error = action.error;
|
|
119
|
+
}
|
|
120
|
+
return state;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const currentUserActions = currentUserSlice.actions;
|
|
127
|
+
const currentUserReducer = currentUserSlice.reducer;
|
|
128
|
+
|
|
129
|
+
export { currentUserAsyncActions, currentUserActions, currentUserReducer };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import type { FeatureListType } from '../../../../common/features/featureGate';
|
|
2
|
+
import type { RootStateDay1 } from '../../store-day1';
|
|
1
3
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
|
-
import { AssistedInstallerFeatureType } from '../../../../common';
|
|
3
|
-
import { RootStateDay1 } from '../../store-day1';
|
|
4
4
|
|
|
5
5
|
export const selectFeatureFlagsSlice = (state: RootStateDay1) => state.featureFlags;
|
|
6
6
|
|
|
7
7
|
export const isFeatureEnabled = createSelector(
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
8
|
+
selectFeatureFlagsSlice,
|
|
9
|
+
(_featureFlags: ReturnType<typeof selectFeatureFlagsSlice>, featureId: keyof FeatureListType) =>
|
|
10
|
+
featureId,
|
|
11
|
+
(featureFlags, featureId) => featureFlags.data[featureId],
|
|
13
12
|
);
|
|
@@ -1,15 +1,110 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { PayloadAction, SerializedError } from '@reduxjs/toolkit';
|
|
2
|
+
import type { StateSliceWithMeta } from '../../types/state-slice';
|
|
3
|
+
import type { FeatureListType } from '../../../../common/features/featureGate';
|
|
4
|
+
import type { RootStateDay1 } from '../../store-day1';
|
|
5
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
6
|
+
import { STANDALONE_DEPLOYMENT_ENABLED_FEATURES } from '../../../../common/features/featureGate';
|
|
7
|
+
import { externalFeaturesMappings } from '../../../config/external-features';
|
|
8
|
+
import { currentUserAsyncActions } from '../current-user/slice';
|
|
9
|
+
|
|
10
|
+
const featureFlagsAsyncActions = {
|
|
11
|
+
detectFeaturesAsync: createAsyncThunk(
|
|
12
|
+
'featureFlags/detectFeatures',
|
|
13
|
+
async (featuresOverride: FeatureListType | null = null, thunkApi) => {
|
|
14
|
+
await thunkApi.dispatch(currentUserAsyncActions.getCapabilitiesAsync());
|
|
15
|
+
const state = thunkApi.getState() as RootStateDay1;
|
|
16
|
+
for (const { featureId, capabilityId } of externalFeaturesMappings) {
|
|
17
|
+
const capability = state.currentUser.data?.organization?.capabilities?.find(
|
|
18
|
+
(capability) => capability.name === capabilityId,
|
|
19
|
+
);
|
|
20
|
+
if (capability) {
|
|
21
|
+
thunkApi.dispatch(
|
|
22
|
+
featureFlagsActions.setFeatureFlag({
|
|
23
|
+
featureId,
|
|
24
|
+
isEnabled: capability.value === 'true',
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (featuresOverride !== null) {
|
|
30
|
+
for (const [k, v] of Object.entries(featuresOverride)) {
|
|
31
|
+
thunkApi.dispatch(
|
|
32
|
+
featureFlagsActions.setFeatureFlag({
|
|
33
|
+
featureId: k as keyof FeatureListType,
|
|
34
|
+
isEnabled: v,
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type AsyncThunkActions = (typeof featureFlagsAsyncActions)[keyof typeof featureFlagsAsyncActions];
|
|
44
|
+
type FeatureFlagsAsyncThunkActionCreators =
|
|
45
|
+
| ReturnType<AsyncThunkActions['pending']>
|
|
46
|
+
| ReturnType<AsyncThunkActions['fulfilled']>
|
|
47
|
+
| ReturnType<AsyncThunkActions['rejected']>;
|
|
48
|
+
|
|
49
|
+
export type FeatureFlagsState = StateSliceWithMeta<FeatureListType, SerializedError | null>;
|
|
50
|
+
|
|
51
|
+
const initialState: FeatureFlagsState = {
|
|
52
|
+
data: STANDALONE_DEPLOYMENT_ENABLED_FEATURES,
|
|
53
|
+
error: null,
|
|
54
|
+
meta: {
|
|
55
|
+
status: 'idle',
|
|
56
|
+
updatedAt: null,
|
|
57
|
+
currentRequestId: null,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
3
60
|
|
|
4
61
|
const featureFlagsSlice = createSlice({
|
|
5
62
|
name: 'featureFlags',
|
|
6
|
-
initialState
|
|
63
|
+
initialState,
|
|
7
64
|
reducers: {
|
|
8
|
-
|
|
9
|
-
|
|
65
|
+
setMeta: (state, action: PayloadAction<FeatureFlagsAsyncThunkActionCreators>) => {
|
|
66
|
+
state.meta.updatedAt = new Date().toUTCString();
|
|
67
|
+
state.meta.status = action.payload.meta.requestStatus;
|
|
68
|
+
state.meta.currentRequestId = action.payload.meta.requestId;
|
|
69
|
+
return state;
|
|
70
|
+
},
|
|
71
|
+
setFeatureFlag: (
|
|
72
|
+
state,
|
|
73
|
+
action: PayloadAction<{ featureId: keyof FeatureListType; isEnabled: boolean }>,
|
|
74
|
+
) => {
|
|
75
|
+
const { featureId, isEnabled } = action.payload;
|
|
76
|
+
state.data[featureId] = isEnabled;
|
|
77
|
+
state.error = null;
|
|
78
|
+
state.meta.updatedAt = new Date().toUTCString();
|
|
79
|
+
return state;
|
|
10
80
|
},
|
|
11
81
|
},
|
|
82
|
+
extraReducers: (builder) => {
|
|
83
|
+
for (const { pending, fulfilled, rejected } of Object.values(featureFlagsAsyncActions)) {
|
|
84
|
+
builder.addCase(pending, (state, action) => {
|
|
85
|
+
if (/idle|fulfilled|rejected/.test(state.meta.status)) {
|
|
86
|
+
featureFlagsActions.setMeta(action);
|
|
87
|
+
}
|
|
88
|
+
return state;
|
|
89
|
+
});
|
|
90
|
+
builder.addCase(fulfilled, (state, action) => {
|
|
91
|
+
if (/idle|pending/.test(state.meta.status)) {
|
|
92
|
+
featureFlagsActions.setMeta(action);
|
|
93
|
+
}
|
|
94
|
+
return state;
|
|
95
|
+
});
|
|
96
|
+
builder.addCase(rejected, (state, action) => {
|
|
97
|
+
if (/idle|pending/.test(state.meta.status)) {
|
|
98
|
+
featureFlagsActions.setMeta(action);
|
|
99
|
+
state.error = action.error;
|
|
100
|
+
}
|
|
101
|
+
return state;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
},
|
|
12
105
|
});
|
|
13
106
|
|
|
14
|
-
|
|
15
|
-
|
|
107
|
+
const featureFlagsActions = featureFlagsSlice.actions;
|
|
108
|
+
const featureFlagsReducer = featureFlagsSlice.reducer;
|
|
109
|
+
|
|
110
|
+
export { featureFlagsAsyncActions, featureFlagsActions, featureFlagsReducer };
|
|
@@ -19,7 +19,7 @@ export const listInfraEnvsByClusterId = createAsyncThunk(
|
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
export const createInfraEnv = createAsyncThunk(
|
|
22
|
-
'',
|
|
22
|
+
'infraEnvs/createInfraEnv',
|
|
23
23
|
async (params: WithRequired<InfraEnvCreateParams, 'clusterId'>) => {
|
|
24
24
|
const { data: infraEnv } = await InfraEnvsAPI.register(params);
|
|
25
25
|
// dispatch({ type: 'currentCluster/updateStaticNetworkConfig' payload: infraEnv.staticNetworkConfig });
|
|
@@ -3,7 +3,7 @@ import { clustersReducer } from './slices/clusters/slice';
|
|
|
3
3
|
import { currentClusterReducer } from './slices/current-cluster/slice';
|
|
4
4
|
import { infraEnvsReducer } from './slices/infra-envs/slice';
|
|
5
5
|
import { featureFlagsReducer } from './slices/feature-flags/slice';
|
|
6
|
-
import {
|
|
6
|
+
import { currentUserReducer } from './slices/current-user/slice';
|
|
7
7
|
|
|
8
8
|
export const storeDay1 = configureStore({
|
|
9
9
|
devTools: {
|
|
@@ -14,9 +14,7 @@ export const storeDay1 = configureStore({
|
|
|
14
14
|
currentCluster: currentClusterReducer,
|
|
15
15
|
infraEnvs: infraEnvsReducer,
|
|
16
16
|
featureFlags: featureFlagsReducer,
|
|
17
|
-
|
|
18
|
-
preloadedState: {
|
|
19
|
-
featureFlags: STANDALONE_DEPLOYMENT_ENABLED_FEATURES,
|
|
17
|
+
currentUser: currentUserReducer,
|
|
20
18
|
},
|
|
21
19
|
});
|
|
22
20
|
export type RootStateDay1 = ReturnType<typeof storeDay1.getState>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface StateSliceMeta {
|
|
2
|
+
/** @default idle */
|
|
3
|
+
status: 'idle' | 'pending' | 'fulfilled' | 'rejected';
|
|
4
|
+
/** @default null */
|
|
5
|
+
updatedAt?: string | null;
|
|
6
|
+
/** @default null */
|
|
7
|
+
currentRequestId?: string | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface StateSlice<D = unknown, E = unknown> {
|
|
11
|
+
data: D;
|
|
12
|
+
error: E;
|
|
13
|
+
}
|
|
14
|
+
export interface StateSliceWithMeta<D = unknown, E = unknown> extends StateSlice<D, E> {
|
|
15
|
+
meta: StateSliceMeta;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@openshift-assisted/locales": "2.9.
|
|
4
|
-
"@openshift-assisted/types": "2.9.
|
|
3
|
+
"@openshift-assisted/locales": "2.9.11-cim",
|
|
4
|
+
"@openshift-assisted/types": "2.9.11-cim",
|
|
5
|
+
"@patternfly/patternfly": "^4.222.4",
|
|
6
|
+
"@patternfly/react-code-editor": "^4.82.113",
|
|
7
|
+
"@patternfly/react-core": "^4.168.8",
|
|
8
|
+
"@patternfly/react-icons": "^4.93.3",
|
|
9
|
+
"@patternfly/react-styles": "^4.92.3",
|
|
10
|
+
"@patternfly/react-table": "^4.37.8",
|
|
11
|
+
"@patternfly/react-tokens": "^4.94.3",
|
|
5
12
|
"axios-case-converter": "^0.11.1",
|
|
6
13
|
"camel-case": "^4.1.2",
|
|
7
14
|
"cidr-tools": "^4.3.0",
|
|
@@ -26,6 +33,7 @@
|
|
|
26
33
|
},
|
|
27
34
|
"description": "React component library for the Assisted Installer UI",
|
|
28
35
|
"devDependencies": {
|
|
36
|
+
"@redhat-cloud-services/types": "^1.0.1",
|
|
29
37
|
"@tsconfig/recommended": "^1.0.2",
|
|
30
38
|
"@types/file-saver": "^2.0.1",
|
|
31
39
|
"@types/human-date": "^1.4.0",
|
|
@@ -112,7 +120,7 @@
|
|
|
112
120
|
},
|
|
113
121
|
"scripts": {
|
|
114
122
|
"build": "yarn run -T tsc --build --verbose && yarn copy:css",
|
|
115
|
-
"check_circular_deps": "yarn run -T dpdm --warning false --tree false --exit-code circular:1 ./lib/index.ts",
|
|
123
|
+
"check_circular_deps": "yarn run -T dpdm --transform --warning false --tree false --exit-code circular:1 ./lib/index.ts",
|
|
116
124
|
"check_types": "yarn run -T tsc --noEmit",
|
|
117
125
|
"clean": "yarn run -T rimraf node_modules build",
|
|
118
126
|
"copy:css": "rsync -Ruv lib/./**/*.css build/cjs",
|
|
@@ -131,5 +139,5 @@
|
|
|
131
139
|
]
|
|
132
140
|
}
|
|
133
141
|
},
|
|
134
|
-
"version": "2.9.
|
|
142
|
+
"version": "2.9.11-cim"
|
|
135
143
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routeBaseBath.d.ts","sourceRoot":"","sources":["../../../../lib/ocm/config/routeBaseBath.ts"],"names":[],"mappings":"AAAA,eAAO,IAAI,aAAa,QAAK,CAAC;AAE9B,eAAO,MAAM,gBAAgB,aAAc,MAAM,SAEhD,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const storeDay2: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<{
|
|
2
|
-
infraEnvs: import("@openshift-assisted/types/./assisted-installer-service").InfraEnv[];
|
|
3
|
-
featureFlags: import("../../common").FeatureListType;
|
|
4
|
-
}, import("redux").AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<{
|
|
5
|
-
infraEnvs: import("@openshift-assisted/types/./assisted-installer-service").InfraEnv[];
|
|
6
|
-
featureFlags: import("../../common").FeatureListType;
|
|
7
|
-
}, import("redux").AnyAction, undefined>]>;
|
|
8
|
-
export type RootStateDay2 = ReturnType<typeof storeDay2.getState>;
|
|
9
|
-
export type DispatchDay2 = typeof storeDay2.dispatch;
|
|
10
|
-
//# sourceMappingURL=store-day2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store-day2.d.ts","sourceRoot":"","sources":["../../../../lib/ocm/store/store-day2.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;0CAWpB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,OAAO,SAAS,CAAC,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routeBaseBath.js","sourceRoot":"","sources":["../../../../lib/ocm/config/routeBaseBath.ts"],"names":[],"mappings":";;;AAAW,QAAA,aAAa,GAAG,EAAE,CAAC;AAEvB,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACnD,qBAAa,GAAG,QAAQ,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storeDay2 = void 0;
|
|
4
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
-
const slice_1 = require("./slices/infra-envs/slice");
|
|
6
|
-
const slice_2 = require("./slices/feature-flags/slice");
|
|
7
|
-
const common_1 = require("../../common");
|
|
8
|
-
exports.storeDay2 = (0, toolkit_1.configureStore)({
|
|
9
|
-
devTools: {
|
|
10
|
-
name: 'Assisted Installer - Day 2',
|
|
11
|
-
},
|
|
12
|
-
reducer: {
|
|
13
|
-
infraEnvs: slice_1.infraEnvsReducer,
|
|
14
|
-
featureFlags: slice_2.featureFlagsReducer,
|
|
15
|
-
},
|
|
16
|
-
preloadedState: {
|
|
17
|
-
featureFlags: common_1.STANDALONE_DEPLOYMENT_ENABLED_FEATURES,
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=store-day2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store-day2.js","sourceRoot":"","sources":["../../../../lib/ocm/store/store-day2.ts"],"names":[],"mappings":";;;AAAA,8CAAkD;AAClD,qDAA6D;AAC7D,wDAAmE;AACnE,yCAAsE;AAEzD,QAAA,SAAS,GAAG,IAAA,wBAAc,EAAC;IACtC,QAAQ,EAAE;QACR,IAAI,EAAE,4BAA4B;KACnC;IACD,OAAO,EAAE;QACP,SAAS,EAAE,wBAAgB;QAC3B,YAAY,EAAE,2BAAmB;KAClC;IACD,cAAc,EAAE;QACd,YAAY,EAAE,+CAAsC;KACrD;CACF,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { infraEnvsReducer } from './slices/infra-envs/slice';
|
|
3
|
-
import { featureFlagsReducer } from './slices/feature-flags/slice';
|
|
4
|
-
import { STANDALONE_DEPLOYMENT_ENABLED_FEATURES } from '../../common';
|
|
5
|
-
|
|
6
|
-
export const storeDay2 = configureStore({
|
|
7
|
-
devTools: {
|
|
8
|
-
name: 'Assisted Installer - Day 2',
|
|
9
|
-
},
|
|
10
|
-
reducer: {
|
|
11
|
-
infraEnvs: infraEnvsReducer,
|
|
12
|
-
featureFlags: featureFlagsReducer,
|
|
13
|
-
},
|
|
14
|
-
preloadedState: {
|
|
15
|
-
featureFlags: STANDALONE_DEPLOYMENT_ENABLED_FEATURES,
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
export type RootStateDay2 = ReturnType<typeof storeDay2.getState>;
|
|
19
|
-
export type DispatchDay2 = typeof storeDay2.dispatch;
|
/package/lib/cim/components/ClusterDeployment/{wizardTransition.test.ts → _wizardTransition.test.ts}
RENAMED
|
File without changes
|
/package/lib/common/components/ui/formik/{validationSchemas.test.ts → _validationSchemas.test.ts}
RENAMED
|
File without changes
|
/package/lib/ocm/components/clusterWizard/{wizardTransition.test.ts → _wizardTransition.test.ts}
RENAMED
|
File without changes
|
|
File without changes
|