@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.
Files changed (161) hide show
  1. package/build/@types/cim/components/ClusterDeployment/ScaleUpForm.d.ts +1 -0
  2. package/build/@types/cim/components/ClusterDeployment/ScaleUpForm.d.ts.map +1 -1
  3. package/build/@types/cim/components/InfraEnv/utils.d.ts.map +1 -1
  4. package/build/@types/cim/components/modals/ScaleUpModal.d.ts +1 -0
  5. package/build/@types/cim/components/modals/ScaleUpModal.d.ts.map +1 -1
  6. package/build/@types/cim/index.d.ts +1 -0
  7. package/build/@types/cim/index.d.ts.map +1 -1
  8. package/build/@types/cim/types/k8s/agent-cluster-install.d.ts +1 -1
  9. package/build/@types/cim/types/k8s/agent-cluster-install.d.ts.map +1 -1
  10. package/build/@types/common/api/utils.d.ts +1 -1
  11. package/build/@types/common/api/utils.d.ts.map +1 -1
  12. package/build/@types/common/index.d.ts +1 -0
  13. package/build/@types/common/index.d.ts.map +1 -1
  14. package/build/@types/common/types/index.d.ts +0 -8
  15. package/build/@types/common/types/index.d.ts.map +1 -1
  16. package/build/@types/common/types/resource-ui-state.d.ts +9 -0
  17. package/build/@types/common/types/resource-ui-state.d.ts.map +1 -0
  18. package/build/@types/ocm/components/Routes.d.ts.map +1 -1
  19. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.d.ts.map +1 -1
  20. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.d.ts +1 -1
  21. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.d.ts.map +1 -1
  22. package/build/@types/ocm/components/hosts/DeleteHostModal.d.ts.map +1 -1
  23. package/build/@types/ocm/config/external-features.d.ts +8 -0
  24. package/build/@types/ocm/config/external-features.d.ts.map +1 -0
  25. package/build/@types/ocm/config/index.d.ts +1 -1
  26. package/build/@types/ocm/config/{routeBaseBath.d.ts → routeBasePath.d.ts} +1 -1
  27. package/build/@types/ocm/config/routeBasePath.d.ts.map +1 -0
  28. package/build/@types/ocm/hooks/use-feature-detection.d.ts +3 -0
  29. package/build/@types/ocm/hooks/use-feature-detection.d.ts.map +1 -0
  30. package/build/@types/ocm/services/ClusterDetailsService.d.ts.map +1 -1
  31. package/build/@types/ocm/services/ClustersService.d.ts +3 -3
  32. package/build/@types/ocm/services/ClustersService.d.ts.map +1 -1
  33. package/build/@types/ocm/services/InfraEnvIdsCacheService.d.ts +2 -2
  34. package/build/@types/ocm/services/InfraEnvIdsCacheService.d.ts.map +1 -1
  35. package/build/@types/ocm/store/hooks.d.ts +17 -5
  36. package/build/@types/ocm/store/hooks.d.ts.map +1 -1
  37. package/build/@types/ocm/store/index.d.ts +1 -3
  38. package/build/@types/ocm/store/index.d.ts.map +1 -1
  39. package/build/@types/ocm/store/slices/clusters/selectors.d.ts +6 -3
  40. package/build/@types/ocm/store/slices/clusters/selectors.d.ts.map +1 -1
  41. package/build/@types/ocm/store/slices/clusters/slice.d.ts +2 -2
  42. package/build/@types/ocm/store/slices/clusters/slice.d.ts.map +1 -1
  43. package/build/@types/ocm/store/slices/current-cluster/slice.d.ts +4 -3
  44. package/build/@types/ocm/store/slices/current-cluster/slice.d.ts.map +1 -1
  45. package/build/@types/ocm/store/slices/current-user/slice.d.ts +46 -0
  46. package/build/@types/ocm/store/slices/current-user/slice.d.ts.map +1 -0
  47. package/build/@types/ocm/store/slices/feature-flags/selectors.d.ts +18 -4
  48. package/build/@types/ocm/store/slices/feature-flags/selectors.d.ts.map +1 -1
  49. package/build/@types/ocm/store/slices/feature-flags/slice.d.ts +26 -5
  50. package/build/@types/ocm/store/slices/feature-flags/slice.d.ts.map +1 -1
  51. package/build/@types/ocm/store/slices/infra-envs/selectors.d.ts +2 -1
  52. package/build/@types/ocm/store/slices/infra-envs/selectors.d.ts.map +1 -1
  53. package/build/@types/ocm/store/store-day1.d.ts +4 -2
  54. package/build/@types/ocm/store/store-day1.d.ts.map +1 -1
  55. package/build/@types/ocm/store/types/state-slice.d.ts +16 -0
  56. package/build/@types/ocm/store/types/state-slice.d.ts.map +1 -0
  57. package/build/cjs/cim/components/ClusterDeployment/ScaleUpForm.js +7 -4
  58. package/build/cjs/cim/components/ClusterDeployment/ScaleUpForm.js.map +1 -1
  59. package/build/cjs/cim/components/InfraEnv/utils.js +6 -6
  60. package/build/cjs/cim/components/InfraEnv/utils.js.map +1 -1
  61. package/build/cjs/cim/components/modals/ScaleUpModal.js +2 -2
  62. package/build/cjs/cim/components/modals/ScaleUpModal.js.map +1 -1
  63. package/build/cjs/cim/index.js +3 -1
  64. package/build/cjs/cim/index.js.map +1 -1
  65. package/build/cjs/common/index.js +3 -0
  66. package/build/cjs/common/index.js.map +1 -1
  67. package/build/cjs/common/types/index.js +0 -10
  68. package/build/cjs/common/types/index.js.map +1 -1
  69. package/build/cjs/common/types/resource-ui-state.js +13 -0
  70. package/build/cjs/common/types/resource-ui-state.js.map +1 -0
  71. package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTab.js +2 -2
  72. package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTab.js.map +1 -1
  73. package/build/cjs/ocm/components/Routes.js +3 -5
  74. package/build/cjs/ocm/components/Routes.js.map +1 -1
  75. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js +4 -1
  76. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js.map +1 -1
  77. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.js +5 -2
  78. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.js.map +1 -1
  79. package/build/cjs/ocm/components/hosts/DeleteHostModal.js +8 -7
  80. package/build/cjs/ocm/components/hosts/DeleteHostModal.js.map +1 -1
  81. package/build/cjs/ocm/config/external-features.js +10 -0
  82. package/build/cjs/ocm/config/external-features.js.map +1 -0
  83. package/build/cjs/ocm/config/index.js +1 -1
  84. package/build/cjs/ocm/config/{routeBaseBath.js → routeBasePath.js} +1 -1
  85. package/build/cjs/ocm/config/routeBasePath.js.map +1 -0
  86. package/build/cjs/ocm/hooks/use-feature-detection.js +14 -0
  87. package/build/cjs/ocm/hooks/use-feature-detection.js.map +1 -0
  88. package/build/cjs/ocm/services/ClusterDetailsService.js +0 -3
  89. package/build/cjs/ocm/services/ClusterDetailsService.js.map +1 -1
  90. package/build/cjs/ocm/services/ClustersService.js +19 -19
  91. package/build/cjs/ocm/services/ClustersService.js.map +1 -1
  92. package/build/cjs/ocm/services/InfraEnvIdsCacheService.js +5 -5
  93. package/build/cjs/ocm/services/InfraEnvIdsCacheService.js.map +1 -1
  94. package/build/cjs/ocm/store/hooks.js +2 -4
  95. package/build/cjs/ocm/store/hooks.js.map +1 -1
  96. package/build/cjs/ocm/store/index.js +1 -5
  97. package/build/cjs/ocm/store/index.js.map +1 -1
  98. package/build/cjs/ocm/store/slices/clusters/slice.js +9 -8
  99. package/build/cjs/ocm/store/slices/clusters/slice.js.map +1 -1
  100. package/build/cjs/ocm/store/slices/current-cluster/slice.js +14 -13
  101. package/build/cjs/ocm/store/slices/current-cluster/slice.js.map +1 -1
  102. package/build/cjs/ocm/store/slices/current-user/slice.js +109 -0
  103. package/build/cjs/ocm/store/slices/current-user/slice.js.map +1 -0
  104. package/build/cjs/ocm/store/slices/feature-flags/selectors.js +1 -4
  105. package/build/cjs/ocm/store/slices/feature-flags/selectors.js.map +1 -1
  106. package/build/cjs/ocm/store/slices/feature-flags/slice.js +79 -6
  107. package/build/cjs/ocm/store/slices/feature-flags/slice.js.map +1 -1
  108. package/build/cjs/ocm/store/slices/infra-envs/thunks.js +1 -1
  109. package/build/cjs/ocm/store/slices/infra-envs/thunks.js.map +1 -1
  110. package/build/cjs/ocm/store/store-day1.js +2 -4
  111. package/build/cjs/ocm/store/store-day1.js.map +1 -1
  112. package/build/cjs/ocm/store/types/state-slice.js +3 -0
  113. package/build/cjs/ocm/store/types/state-slice.js.map +1 -0
  114. package/lib/@types/assets.d.ts +1 -1
  115. package/lib/@types/global.d.ts +1 -0
  116. package/lib/_test-helpers/mock-container.ts +42 -0
  117. package/lib/_test-helpers/mock-server.ts +26 -0
  118. package/lib/_test-helpers/vitest-setup.ts +17 -0
  119. package/lib/cim/components/ClusterDeployment/ScaleUpForm.tsx +11 -5
  120. package/lib/cim/components/InfraEnv/utils.ts +7 -6
  121. package/lib/cim/components/modals/ScaleUpModal.tsx +3 -0
  122. package/lib/cim/index.ts +1 -0
  123. package/lib/cim/types/k8s/agent-cluster-install.ts +4 -7
  124. package/lib/common/api/utils.ts +1 -1
  125. package/lib/common/index.ts +1 -0
  126. package/lib/common/types/index.ts +0 -9
  127. package/lib/common/types/resource-ui-state.ts +8 -0
  128. package/lib/ocm/components/HostsClusterDetailTab/HostsClusterDetailTab.tsx +2 -2
  129. package/lib/ocm/components/Routes.tsx +3 -5
  130. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.tsx +7 -2
  131. package/lib/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.ts +6 -1
  132. package/lib/ocm/components/hosts/DeleteHostModal.tsx +28 -23
  133. package/lib/ocm/config/external-features.ts +12 -0
  134. package/lib/ocm/config/index.ts +1 -1
  135. package/lib/ocm/hooks/_use-feature-detection.test.tsx +125 -0
  136. package/lib/ocm/hooks/use-feature-detection.ts +17 -0
  137. package/lib/ocm/services/ClusterDetailsService.ts +0 -4
  138. package/lib/ocm/services/ClustersService.ts +9 -9
  139. package/lib/ocm/services/InfraEnvIdsCacheService.ts +2 -2
  140. package/lib/ocm/store/hooks.ts +1 -4
  141. package/lib/ocm/store/index.ts +1 -3
  142. package/lib/ocm/store/slices/clusters/slice.ts +5 -4
  143. package/lib/ocm/store/slices/current-cluster/slice.ts +9 -15
  144. package/lib/ocm/store/slices/current-user/slice.ts +129 -0
  145. package/lib/ocm/store/slices/feature-flags/selectors.ts +6 -7
  146. package/lib/ocm/store/slices/feature-flags/slice.ts +102 -7
  147. package/lib/ocm/store/slices/infra-envs/thunks.ts +1 -1
  148. package/lib/ocm/store/store-day1.ts +2 -4
  149. package/lib/ocm/store/types/state-slice.ts +16 -0
  150. package/package.json +17 -5
  151. package/build/@types/ocm/config/routeBaseBath.d.ts.map +0 -1
  152. package/build/@types/ocm/store/store-day2.d.ts +0 -10
  153. package/build/@types/ocm/store/store-day2.d.ts.map +0 -1
  154. package/build/cjs/ocm/config/routeBaseBath.js.map +0 -1
  155. package/build/cjs/ocm/store/store-day2.js +0 -20
  156. package/build/cjs/ocm/store/store-day2.js.map +0 -1
  157. package/lib/ocm/store/store-day2.ts +0 -19
  158. /package/lib/cim/components/ClusterDeployment/{wizardTransition.test.ts → _wizardTransition.test.ts} +0 -0
  159. /package/lib/common/components/ui/formik/{validationSchemas.test.ts → _validationSchemas.test.ts} +0 -0
  160. /package/lib/ocm/components/clusterWizard/{wizardTransition.test.ts → _wizardTransition.test.ts} +0 -0
  161. /package/lib/ocm/config/{routeBaseBath.ts → routeBasePath.ts} +0 -0
@@ -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
- [selectFeatureFlagsSlice, (_, feature: AssistedInstallerFeatureType) => feature],
9
- (featureFlags, feature) => {
10
- // Configured via Unleash in the OCM
11
- return !!featureFlags[feature];
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 { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
- import { FeatureListType } from '../../../../common';
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: {} as FeatureListType,
63
+ initialState,
7
64
  reducers: {
8
- setFeatureFlags: (state, action: PayloadAction<FeatureListType>) => {
9
- return Object.assign(state, action.payload);
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
- export const featureFlagsActions = featureFlagsSlice.actions;
15
- export const featureFlagsReducer = featureFlagsSlice.reducer;
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 { STANDALONE_DEPLOYMENT_ENABLED_FEATURES } from '../../common';
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.9-cim",
4
- "@openshift-assisted/types": "2.9.9-cim",
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,10 +120,14 @@
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
- "copy:css": "rsync -Ruv lib/./**/*.css build/cjs"
126
+ "copy:css": "rsync -Ruv lib/./**/*.css build/cjs",
127
+ "format": "yarn run -T prettier --cache --check . \"!build\"",
128
+ "fix-code-style": "yarn lint --fix && yarn format --write",
129
+ "lint": "yarn run -T eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache .",
130
+ "test": "vitest"
119
131
  },
120
132
  "typesVersions": {
121
133
  "*": {
@@ -127,5 +139,5 @@
127
139
  ]
128
140
  }
129
141
  },
130
- "version": "2.9.9-cim"
142
+ "version": "2.9.11-cim"
131
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;