@devtron-labs/devtron-fe-common-lib 0.0.58-beta-8 → 0.0.58-beta-10

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 (87) hide show
  1. package/dist/Common/Api.d.ts +9 -0
  2. package/dist/Common/Constants.d.ts +14 -1
  3. package/dist/Common/Hooks/index.d.ts +1 -0
  4. package/dist/Common/Hooks/useUrlFilters/constants.d.ts +8 -0
  5. package/dist/Common/Hooks/useUrlFilters/index.d.ts +2 -0
  6. package/dist/Common/Hooks/useUrlFilters/types.d.ts +6 -0
  7. package/dist/Common/Hooks/useUrlFilters/useUrlFilters.d.ts +32 -0
  8. package/dist/Common/SortableTableHeaderCell/SortableTableHeaderCell.d.ts +18 -0
  9. package/dist/Common/SortableTableHeaderCell/index.d.ts +2 -0
  10. package/dist/Common/SortableTableHeaderCell/types.d.ts +25 -0
  11. package/dist/Common/Types.d.ts +15 -4
  12. package/dist/Common/index.d.ts +1 -0
  13. package/dist/Pages/GlobalConfigurations/Authorization/constants.d.ts +15 -0
  14. package/dist/Pages/GlobalConfigurations/Authorization/index.d.ts +1 -0
  15. package/dist/Pages/GlobalConfigurations/index.d.ts +1 -1
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.js +370 -1116
  18. package/package.json +1 -1
  19. package/src/Assets/Icon/ic-arrow-up-down.svg +3 -0
  20. package/src/Assets/Icon/ic-sort-arrow-down.svg +3 -0
  21. package/src/Common/Api.ts +21 -0
  22. package/src/Common/BreadCrumb/Types.ts +1 -0
  23. package/src/Common/Checkbox.tsx +0 -1
  24. package/src/Common/Constants.ts +18 -3
  25. package/src/Common/CustomInput/CustomInput.tsx +1 -2
  26. package/src/Common/DraggableWrapper/DraggableWrapper.tsx +1 -3
  27. package/src/Common/Hooks/index.ts +1 -0
  28. package/src/Common/Hooks/useUrlFilters/constants.ts +9 -0
  29. package/src/Common/Hooks/useUrlFilters/index.ts +2 -0
  30. package/src/Common/Hooks/useUrlFilters/types.ts +6 -0
  31. package/src/Common/Hooks/useUrlFilters/useUrlFilters.ts +120 -0
  32. package/src/Common/RJSF/utils.ts +0 -3
  33. package/src/Common/SearchBar/SearchBar.component.tsx +13 -26
  34. package/src/Common/SearchBar/searchBar.scss +1 -1
  35. package/src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx +44 -0
  36. package/src/Common/SortableTableHeaderCell/index.ts +2 -0
  37. package/src/Common/SortableTableHeaderCell/types.ts +26 -0
  38. package/src/Common/Types.ts +14 -3
  39. package/src/Common/index.ts +1 -0
  40. package/src/Pages/GlobalConfigurations/Authorization/constants.ts +16 -0
  41. package/src/Pages/GlobalConfigurations/Authorization/index.ts +1 -0
  42. package/src/Pages/GlobalConfigurations/index.ts +1 -1
  43. package/src/index.ts +0 -1
  44. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraConfigForm.d.ts +0 -4
  45. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.d.ts +0 -4
  46. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.d.ts +0 -7
  47. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormItem.d.ts +0 -4
  48. package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraProfileNameField.d.ts +0 -4
  49. package/dist/Pages/GlobalConfigurations/BuildInfra/Descriptor.d.ts +0 -4
  50. package/dist/Pages/GlobalConfigurations/BuildInfra/Footer.d.ts +0 -4
  51. package/dist/Pages/GlobalConfigurations/BuildInfra/constants.d.ts +0 -47
  52. package/dist/Pages/GlobalConfigurations/BuildInfra/index.d.ts +0 -7
  53. package/dist/Pages/GlobalConfigurations/BuildInfra/services.d.ts +0 -13
  54. package/dist/Pages/GlobalConfigurations/BuildInfra/types.d.ts +0 -281
  55. package/dist/Pages/GlobalConfigurations/BuildInfra/utils.d.ts +0 -12
  56. package/dist/Shared/Components/APIResponseHandler/APIResponseHandler.d.ts +0 -4
  57. package/dist/Shared/Components/APIResponseHandler/index.d.ts +0 -2
  58. package/dist/Shared/Components/APIResponseHandler/types.d.ts +0 -37
  59. package/dist/Shared/Components/ReactSelect/index.d.ts +0 -1
  60. package/dist/Shared/Components/ReactSelect/utils.d.ts +0 -12
  61. package/dist/Shared/Components/index.d.ts +0 -2
  62. package/dist/Shared/index.d.ts +0 -2
  63. package/dist/Shared/validations.d.ts +0 -7
  64. package/src/Assets/Icon/ic-cpu.svg +0 -4
  65. package/src/Assets/Icon/ic-memory.svg +0 -3
  66. package/src/Assets/Icon/ic-timer.svg +0 -3
  67. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraConfigForm.tsx +0 -121
  68. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.tsx +0 -44
  69. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.tsx +0 -106
  70. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormItem.tsx +0 -55
  71. package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraProfileNameField.tsx +0 -32
  72. package/src/Pages/GlobalConfigurations/BuildInfra/Descriptor.tsx +0 -38
  73. package/src/Pages/GlobalConfigurations/BuildInfra/Footer.tsx +0 -45
  74. package/src/Pages/GlobalConfigurations/BuildInfra/Readme.md +0 -4
  75. package/src/Pages/GlobalConfigurations/BuildInfra/constants.tsx +0 -136
  76. package/src/Pages/GlobalConfigurations/BuildInfra/index.ts +0 -7
  77. package/src/Pages/GlobalConfigurations/BuildInfra/services.tsx +0 -183
  78. package/src/Pages/GlobalConfigurations/BuildInfra/types.tsx +0 -334
  79. package/src/Pages/GlobalConfigurations/BuildInfra/utils.tsx +0 -494
  80. package/src/Shared/Components/APIResponseHandler/APIResponseHandler.tsx +0 -39
  81. package/src/Shared/Components/APIResponseHandler/index.ts +0 -2
  82. package/src/Shared/Components/APIResponseHandler/types.tsx +0 -39
  83. package/src/Shared/Components/ReactSelect/index.ts +0 -1
  84. package/src/Shared/Components/ReactSelect/utils.tsx +0 -97
  85. package/src/Shared/Components/index.ts +0 -2
  86. package/src/Shared/index.ts +0 -2
  87. package/src/Shared/validations.tsx +0 -72
@@ -1,13 +0,0 @@
1
- import { ResponseType } from '../../../Common';
2
- import { BuildInfraProfileResponseType, BuildInfraProfileTransformerType, CreateBuildInfraProfileType, GetBuildInfraProfileType, UpdateBuildInfraProfileType } from './types';
3
- export declare const getTransformedBuildInfraProfileResponse: ({ configurationUnits, defaultConfigurations, profile, fromCreateView, }: BuildInfraProfileTransformerType) => BuildInfraProfileResponseType;
4
- export declare const getBuildInfraProfileByName: ({ name, fromCreateView, }: GetBuildInfraProfileType) => Promise<BuildInfraProfileResponseType>;
5
- export declare const updateBuildInfraProfile: ({ name, profileInput }: UpdateBuildInfraProfileType) => Promise<ResponseType<any>>;
6
- export declare const createBuildInfraProfile: ({ profileInput }: CreateBuildInfraProfileType) => Promise<{
7
- code: number;
8
- result: import("./types").BuildInfraProfileData;
9
- }>;
10
- export declare const deleteBuildInfraProfileByName: (name: string) => Promise<{
11
- code: number;
12
- result: any;
13
- }>;
@@ -1,281 +0,0 @@
1
- import { FormEvent, FunctionComponent, ReactNode } from 'react';
2
- import { Breadcrumb } from '../../../Common/BreadCrumb/Types';
3
- import { ValidationResponseType } from '../../../Shared';
4
- import { ServerErrors } from '../../../Common';
5
- /**
6
- * Unique actions that will be dispatched and,
7
- * Keeping some values (cpu_limit, etc) in sync with backend
8
- */
9
- export declare enum BuildInfraConfigTypes {
10
- CPU_LIMIT = "cpu_limit",
11
- CPU_REQUEST = "cpu_request",
12
- MEMORY_LIMIT = "memory_limit",
13
- MEMORY_REQUEST = "memory_request",
14
- BUILD_TIMEOUT = "timeout"
15
- }
16
- /**
17
- * Combination of BuildInfraConfigTypes and BuildInfraMetaConfigTypes is going to derive error state and actions(actions will also be derived with BuildInfraInheritActions)
18
- */
19
- export declare enum BuildInfraMetaConfigTypes {
20
- NAME = "name",
21
- DESCRIPTION = "description"
22
- }
23
- /**
24
- * Would be used as key for few components and would be appending activate and de_activate actions to it
25
- */
26
- export declare enum BuildInfraLocators {
27
- CPU = "cpu",
28
- MEMORY = "memory",
29
- BUILD_TIMEOUT = "timeout"
30
- }
31
- export declare enum BuildInfraInheritActions {
32
- ACTIVATE_CPU = "activate_cpu",
33
- DE_ACTIVATE_CPU = "de_activate_cpu",
34
- ACTIVATE_MEMORY = "activate_memory",
35
- DE_ACTIVATE_MEMORY = "de_activate_memory",
36
- ACTIVATE_BUILD_TIMEOUT = "activate_build_timeout",
37
- DE_ACTIVATE_BUILD_TIMEOUT = "de_activate_build_timeout"
38
- }
39
- export declare const BuildInfraLocatorsActionMap: {
40
- timeout: BuildInfraLocators;
41
- cpu_limit: BuildInfraLocators;
42
- cpu_request: BuildInfraLocators;
43
- memory_limit: BuildInfraLocators;
44
- memory_request: BuildInfraLocators;
45
- };
46
- export declare enum BuildInfraProfileVariants {
47
- DEFAULT = "DEFAULT",
48
- NORMAL = "NORMAL",
49
- CUSTOM = "CUSTOM"
50
- }
51
- export interface DescriptorProps {
52
- /**
53
- * In case we want to restrict the max-width
54
- */
55
- additionalContainerClasses?: string;
56
- breadCrumbs: Breadcrumb[];
57
- /**
58
- * Would stick at right of div
59
- */
60
- children?: ReactNode;
61
- }
62
- export interface BuildInfraActionType {
63
- /**
64
- * Type of action to be dispatched, would be suffixed with type of change
65
- */
66
- actionType: BuildInfraConfigTypes;
67
- /**
68
- * Label to be shown above input
69
- */
70
- label: string;
71
- /**
72
- * Placeholder for input, can be optional
73
- */
74
- placeholder?: string;
75
- }
76
- export interface BuildInfraConfigurationMarkerProps {
77
- className?: string;
78
- }
79
- export interface BuildInfraFormFieldType {
80
- /**
81
- * Heading of the form item
82
- */
83
- heading: ReactNode;
84
- /**
85
- * Icon/Checkbox to be shown in front of heading
86
- */
87
- marker: FunctionComponent<BuildInfraConfigurationMarkerProps>;
88
- /**
89
- * Actions to be shown in the form item
90
- */
91
- actions: BuildInfraActionType[];
92
- /**
93
- * Unique identifier for the form item used for key
94
- */
95
- locator: BuildInfraLocators;
96
- }
97
- export interface ConfigurationUnitType {
98
- name: string;
99
- conversionFactor: number;
100
- }
101
- export type ConfigurationUnitMapType = {
102
- [key: ConfigurationUnitType['name']]: ConfigurationUnitType;
103
- };
104
- export type BuildInfraUnitsMapType = {
105
- [key in BuildInfraConfigTypes]: ConfigurationUnitMapType;
106
- };
107
- export interface BuildInfraConfigValuesType {
108
- value: string;
109
- unit?: ConfigurationUnitType['name'];
110
- }
111
- interface BuildInfraProfileConfigBase {
112
- id?: number;
113
- key: BuildInfraConfigTypes;
114
- profileName: string;
115
- active: boolean;
116
- }
117
- export interface BuildInfraProfileConfigResponseDataType extends BuildInfraConfigValuesType, BuildInfraProfileConfigBase {
118
- }
119
- export interface BuildInfraConfigurationType extends BuildInfraConfigValuesType, BuildInfraProfileConfigBase {
120
- defaultValue: BuildInfraConfigValuesType;
121
- }
122
- export type BuildInfraConfigurationMapType = {
123
- [key in BuildInfraConfigTypes]: BuildInfraConfigurationType;
124
- };
125
- export interface BuildInfraProfileBase {
126
- id?: number;
127
- name: string;
128
- description: string;
129
- type: BuildInfraProfileVariants;
130
- appCount: number;
131
- }
132
- export interface BuildInfraProfileResponseDataType extends BuildInfraProfileBase {
133
- configurations: BuildInfraProfileConfigResponseDataType[];
134
- }
135
- export interface BuildInfraProfileData extends BuildInfraProfileBase {
136
- configurations: BuildInfraConfigurationMapType;
137
- }
138
- export interface GetBuildInfraProfileType {
139
- name: string;
140
- fromCreateView?: boolean;
141
- }
142
- export interface BuildInfraProfileResponseType {
143
- configurationUnits: BuildInfraUnitsMapType | null;
144
- profile: BuildInfraProfileData | null;
145
- }
146
- export interface UseBuildInfraFormProps {
147
- /**
148
- * Name of the profile, if not provided assumption would be for create view
149
- */
150
- name?: string;
151
- /**
152
- * If true, would send put request else would create profile via post
153
- */
154
- editProfile?: boolean;
155
- /**
156
- * If true, call this on form submission success
157
- */
158
- handleSuccessRedirection?: () => void;
159
- }
160
- export type ProfileInputErrorType = {
161
- [key in BuildInfraConfigTypes | BuildInfraMetaConfigTypes]: string;
162
- };
163
- export interface ProfileInputDispatchDataType {
164
- value: string;
165
- unit?: string;
166
- }
167
- export interface HandleProfileInputChangeType {
168
- action: BuildInfraConfigTypes | BuildInfraInheritActions | BuildInfraMetaConfigTypes;
169
- data?: ProfileInputDispatchDataType;
170
- }
171
- export interface UseBuildInfraFormResponseType {
172
- isLoading: boolean;
173
- profileResponse: BuildInfraProfileResponseType | null;
174
- responseError: ServerErrors | null;
175
- reloadRequest: () => void;
176
- profileInput: BuildInfraProfileData;
177
- profileInputErrors: ProfileInputErrorType;
178
- handleProfileInputChange: ({ action, data }: HandleProfileInputChangeType) => void;
179
- loadingActionRequest: boolean;
180
- handleSubmit: (e: FormEvent<HTMLFormElement>) => Promise<void>;
181
- }
182
- export interface BuildInfraFormItemProps extends Pick<BuildInfraFormFieldType, 'marker' | 'heading'> {
183
- children?: ReactNode;
184
- /**
185
- * If true, means profile is inheriting values from other profile (e.g, default)
186
- */
187
- isInheriting?: boolean;
188
- /**
189
- * Would be false for last item
190
- */
191
- showDivider?: boolean;
192
- /**
193
- * Would be used to dispatch inherit actions (activate_cpu, de_activate_cpu, etc)
194
- */
195
- handleProfileInputChange: UseBuildInfraFormResponseType['handleProfileInputChange'];
196
- locator: BuildInfraFormFieldType['locator'];
197
- isDefaultProfile: boolean;
198
- }
199
- export interface ValidateRequestLimitType {
200
- request: BuildInfraConfigValuesType;
201
- limit: BuildInfraConfigValuesType;
202
- unitsMap: ConfigurationUnitMapType;
203
- }
204
- export interface ValidateRequestLimitResponseType {
205
- request: ValidationResponseType;
206
- limit: ValidationResponseType;
207
- }
208
- export interface BuildInfraConfigFormProps extends Pick<UseBuildInfraFormResponseType, 'profileInput' | 'profileInputErrors' | 'handleProfileInputChange'> {
209
- isDefaultProfile?: boolean;
210
- unitsMap?: BuildInfraProfileResponseType['configurationUnits'];
211
- configurationContainerLabel?: ReactNode;
212
- }
213
- export interface BuildInfraFormActionProps extends BuildInfraActionType {
214
- handleProfileInputChange: UseBuildInfraFormResponseType['handleProfileInputChange'];
215
- currentValue: BuildInfraConfigValuesType['value'];
216
- error?: string;
217
- isRequired?: boolean;
218
- profileUnitsMap?: ConfigurationUnitMapType;
219
- currentUnitName?: BuildInfraConfigValuesType['unit'];
220
- }
221
- export interface FooterProps {
222
- /**
223
- * If true, means form contains errors
224
- */
225
- disabled?: boolean;
226
- hideCancelButton?: boolean;
227
- /**
228
- * If true would show save changes else would show save for submit button
229
- */
230
- editProfile?: boolean;
231
- loading?: boolean;
232
- }
233
- export interface UpdateBuildInfraProfileType extends Pick<UseBuildInfraFormResponseType, 'profileInput'> {
234
- name: string;
235
- }
236
- export interface CreateBuildInfraProfileType extends Pick<UseBuildInfraFormResponseType, 'profileInput'> {
237
- }
238
- export interface CreateBuildInfraServiceConfigurationType {
239
- key: BuildInfraConfigTypes;
240
- value: string | number;
241
- active: boolean;
242
- unit?: string;
243
- /**
244
- * Would send for those that are available in profileInput
245
- */
246
- id?: number;
247
- }
248
- export interface CreateBuildInfraServicePayloadType {
249
- name: string;
250
- description: string;
251
- type: BuildInfraProfileVariants;
252
- configurations: CreateBuildInfraServiceConfigurationType[];
253
- }
254
- export interface BuildInfraInputFieldComponentProps {
255
- handleProfileInputChange: UseBuildInfraFormResponseType['handleProfileInputChange'];
256
- currentValue: BuildInfraConfigValuesType['value'];
257
- error?: string;
258
- }
259
- export interface InheritingHeaderProps {
260
- defaultHeading: BuildInfraFormFieldType['heading'];
261
- inheritingData: BuildInfraConfigValuesType[];
262
- isInheriting: boolean;
263
- isDefaultProfile: boolean;
264
- }
265
- export interface BuildInfraConfigResponseDataType {
266
- name: BuildInfraConfigTypes;
267
- units: ConfigurationUnitType[];
268
- }
269
- interface BaseBuildInfraProfileResponseType {
270
- defaultConfigurations: BuildInfraProfileConfigResponseDataType[];
271
- configurationUnits: BuildInfraUnitsMapType;
272
- }
273
- export interface BuildInfraListResponseType extends BaseBuildInfraProfileResponseType {
274
- profiles: BuildInfraProfileResponseDataType[];
275
- }
276
- export interface BuildInfraProfileAPIResponseType extends BaseBuildInfraProfileResponseType {
277
- profile: BuildInfraProfileResponseDataType;
278
- }
279
- export interface BuildInfraProfileTransformerType extends BuildInfraProfileAPIResponseType, Pick<GetBuildInfraProfileType, 'fromCreateView'> {
280
- }
281
- export {};
@@ -1,12 +0,0 @@
1
- import { UseBuildInfraFormProps, UseBuildInfraFormResponseType, ValidateRequestLimitResponseType, ValidateRequestLimitType } from './types';
2
- export declare const validateRequestLimit: ({ request, limit, unitsMap, }: ValidateRequestLimitType) => ValidateRequestLimitResponseType;
3
- export declare const useBuildInfraForm: ({ name, editProfile, handleSuccessRedirection, }: UseBuildInfraFormProps) => UseBuildInfraFormResponseType;
4
- export declare const unitSelectorStyles: () => {
5
- menuList: (base: any) => any;
6
- control: (base: any, state: any) => any;
7
- option: (base: any, state: any) => any;
8
- dropdownIndicator: (base: any, state: any) => any;
9
- valueContainer: (base: any) => any;
10
- loadingMessage: (base: any) => any;
11
- noOptionsMessage: (base: any) => any;
12
- };
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { APIResponseHandlerProps } from './types';
3
- declare const APIResponseHandler: ({ isLoading, progressingProps, error, notAuthorized, notFoundText, reloadProps, children, }: APIResponseHandlerProps) => JSX.Element;
4
- export default APIResponseHandler;
@@ -1,2 +0,0 @@
1
- export { default as APIResponseHandler } from './APIResponseHandler';
2
- export * from './types';
@@ -1,37 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { ProgressingProps, ReloadType, ServerErrors } from '../../../Common';
3
- export interface EmptyPageTextType {
4
- title?: string;
5
- subTitle?: string;
6
- }
7
- export interface APIResponseHandlerProps {
8
- /**
9
- * If true, would show Progressing component
10
- */
11
- isLoading?: boolean;
12
- /**
13
- * If loading is true, would load send these props to Progressing component
14
- */
15
- progressingProps?: ProgressingProps;
16
- /**
17
- * If true and isLoading is false would show default Reload component
18
- * In case error code is 404 show default 404 page using GenericEmptyState
19
- */
20
- error?: ServerErrors;
21
- /**
22
- * Page text for 404 page
23
- */
24
- notFoundText?: EmptyPageTextType;
25
- /**
26
- * If true would show Not Authorized page
27
- */
28
- notAuthorized?: boolean;
29
- /**
30
- * If given, on Error, would load these props
31
- */
32
- reloadProps?: ReloadType;
33
- /**
34
- * If no Error and no Loading, would load this component
35
- */
36
- children: ReactNode;
37
- }
@@ -1 +0,0 @@
1
- export * from './utils';
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const getCommonSelectStyle: (styleOverrides?: {}) => {
3
- menuList: (base: any) => any;
4
- control: (base: any, state: any) => any;
5
- option: (base: any, state: any) => any;
6
- dropdownIndicator: (base: any, state: any) => any;
7
- valueContainer: (base: any) => any;
8
- loadingMessage: (base: any) => any;
9
- noOptionsMessage: (base: any) => any;
10
- };
11
- export declare const getCustomOptionSelectionStyle: (styleOverrides?: {}) => (base: any, state: any) => any;
12
- export declare const SelectOption: (props: any) => JSX.Element;
@@ -1,2 +0,0 @@
1
- export * from './APIResponseHandler';
2
- export * from './ReactSelect';
@@ -1,2 +0,0 @@
1
- export * from './Components';
2
- export * from './validations';
@@ -1,7 +0,0 @@
1
- export interface ValidationResponseType {
2
- isValid: boolean;
3
- message?: string;
4
- }
5
- export declare const validateName: (name: string) => ValidationResponseType;
6
- export declare const validateDescription: (description: string) => ValidationResponseType;
7
- export declare const validateRequiredPositiveNumber: (value: string | Number) => ValidationResponseType;
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
2
- <path d="M12.5 5.625H7.5M12.5 8.125H7.5M15.625 3.125V16.875C15.625 17.2202 15.3452 17.5 15 17.5H5C4.65482 17.5 4.375 17.2202 4.375 16.875V3.125C4.375 2.77982 4.65482 2.5 5 2.5H15C15.3452 2.5 15.625 2.77982 15.625 3.125Z" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
- <path d="M10 15C10.5178 15 10.9375 14.5803 10.9375 14.0625C10.9375 13.5447 10.5178 13.125 10 13.125C9.48223 13.125 9.0625 13.5447 9.0625 14.0625C9.0625 14.5803 9.48223 15 10 15Z" fill="#596168"/>
4
- </svg>
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
2
- <path d="M16.25 8.125H18.125M16.25 11.875H18.125M1.875 8.125H3.75M1.875 11.875H3.75M11.875 16.25V18.125M8.125 16.25V18.125M11.875 1.875V3.75M8.125 1.875V3.75M7.8125 7.8125H12.1875V12.1875H7.8125V7.8125ZM4.375 3.75H15.625C15.9702 3.75 16.25 4.02982 16.25 4.375V15.625C16.25 15.9702 15.9702 16.25 15.625 16.25H4.375C4.02982 16.25 3.75 15.9702 3.75 15.625V4.375C3.75 4.02982 4.02982 3.75 4.375 3.75Z" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
2
- <path d="M10 11.0415L13.0936 7.94791M8.125 1.6665H11.875M16.875 11.0415C16.875 14.8385 13.797 17.9165 10 17.9165C6.20304 17.9165 3.125 14.8385 3.125 11.0415C3.125 7.24455 6.20304 4.1665 10 4.1665C13.797 4.1665 16.875 7.24455 16.875 11.0415Z" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
- </svg>
@@ -1,121 +0,0 @@
1
- import { FunctionComponent } from 'react'
2
- import { Progressing } from '../../../Common'
3
- import BuildInfraFormAction from './BuildInfraFormAction'
4
- import BuildInfraFormItem from './BuildInfraFormItem'
5
- import BuildInfraProfileDescriptionField from './BuildInfraDescriptionField'
6
- import BuildInfraProfileNameField from './BuildInfraProfileNameField'
7
- import { BUILD_INFRA_FORM_FIELDS, BUILD_INFRA_TEXT } from './constants'
8
- import { BuildInfraActionType, BuildInfraConfigFormProps, InheritingHeaderProps } from './types'
9
-
10
- const InheritingHeader = ({
11
- defaultHeading,
12
- inheritingData,
13
- isInheriting,
14
- isDefaultProfile,
15
- }: InheritingHeaderProps) => {
16
- const inheritingDataString = inheritingData.map((data) => `${data.value} ${data.unit ?? ''}`).join(' - ')
17
-
18
- if (isDefaultProfile || !isInheriting) {
19
- // For typing issues
20
- // eslint-disable-next-line react/jsx-no-useless-fragment
21
- return <>{defaultHeading}</>
22
- }
23
-
24
- return (
25
- <div className="flexbox dc__align-items-center dc__content-space w-100">
26
- {defaultHeading}
27
-
28
- <p className="m-0 flexbox pt-0 pb-0 pl-4 pr-4 fs-13 lh-20 fw-4 cn-9">{inheritingDataString}</p>
29
-
30
- <p className="m-0 cn-7 fs-13 fw-4 lh-20">{BUILD_INFRA_TEXT.INHERITING_HEADING_DESCRIPTION}</p>
31
- </div>
32
- )
33
- }
34
-
35
- const BuildInfraConfigForm: FunctionComponent<BuildInfraConfigFormProps> = ({
36
- profileInput,
37
- profileInputErrors,
38
- handleProfileInputChange,
39
- isDefaultProfile,
40
- unitsMap,
41
- configurationContainerLabel,
42
- }) => {
43
- const currentConfigurations = profileInput?.configurations
44
-
45
- // will get the desired configuration from the currentConfigurations and then check if it is active or not
46
- const isInheritingProfileValues = (actions: BuildInfraActionType[]) =>
47
- actions.some((action) => !currentConfigurations[action.actionType].active)
48
-
49
- // Had to show loader for an instance due to batching of state updates not working as expected :/
50
- if (!currentConfigurations) {
51
- return <Progressing pageLoader />
52
- }
53
-
54
- return (
55
- <div className="flexbox-col dc__mxw-920 dc__gap-16">
56
- {!isDefaultProfile && (
57
- <div className="flexbox-col dc__gap-12">
58
- <BuildInfraProfileNameField
59
- handleProfileInputChange={handleProfileInputChange}
60
- currentValue={profileInput.name}
61
- error={profileInputErrors.name}
62
- />
63
-
64
- <BuildInfraProfileDescriptionField
65
- handleProfileInputChange={handleProfileInputChange}
66
- currentValue={profileInput.description}
67
- error={profileInputErrors.description}
68
- />
69
- </div>
70
- )}
71
-
72
- <div className="flexbox-col dc__gap-12">
73
- {configurationContainerLabel}
74
-
75
- <div className="w-100 flexbox-col dc__gap-16 br-4 dc__border-n1 p-16">
76
- {BUILD_INFRA_FORM_FIELDS.map((field, index) => (
77
- <BuildInfraFormItem
78
- key={field.locator}
79
- marker={field.marker}
80
- heading={
81
- <InheritingHeader
82
- defaultHeading={field.heading}
83
- inheritingData={field.actions.map(
84
- (action) => currentConfigurations[action.actionType],
85
- )}
86
- isInheriting={isInheritingProfileValues(field.actions)}
87
- isDefaultProfile={isDefaultProfile}
88
- />
89
- }
90
- showDivider={index !== BUILD_INFRA_FORM_FIELDS.length - 1}
91
- isInheriting={isInheritingProfileValues(field.actions)}
92
- handleProfileInputChange={handleProfileInputChange}
93
- locator={field.locator}
94
- isDefaultProfile={isDefaultProfile}
95
- >
96
- <div className="w-50 flexbox dc__gap-12 w-100 dc__align-start">
97
- {field.actions.map((action) => (
98
- <BuildInfraFormAction
99
- key={action.actionType}
100
- actionType={action.actionType}
101
- label={action.label}
102
- placeholder={action.placeholder}
103
- error={profileInputErrors[action.actionType]}
104
- // Assumption is for default profiles all input fields are required
105
- isRequired={isDefaultProfile}
106
- profileUnitsMap={unitsMap[action.actionType]}
107
- handleProfileInputChange={handleProfileInputChange}
108
- currentUnitName={currentConfigurations[action.actionType].unit}
109
- currentValue={currentConfigurations[action.actionType].value}
110
- />
111
- ))}
112
- </div>
113
- </BuildInfraFormItem>
114
- ))}
115
- </div>
116
- </div>
117
- </div>
118
- )
119
- }
120
-
121
- export default BuildInfraConfigForm
@@ -1,44 +0,0 @@
1
- import { FormEvent, FunctionComponent } from 'react'
2
- import { ReactComponent as ErrorIcon } from '../../../Assets/Icon/ic-warning.svg'
3
- import { BuildInfraInputFieldComponentProps, BuildInfraMetaConfigTypes } from './types'
4
- import { BUILD_INFRA_TEXT } from './constants'
5
-
6
- const BuildInfraProfileDescriptionField: FunctionComponent<BuildInfraInputFieldComponentProps> = ({
7
- handleProfileInputChange,
8
- currentValue,
9
- error,
10
- }) => {
11
- const handleChange = (e: FormEvent<HTMLTextAreaElement>) => {
12
- handleProfileInputChange({
13
- action: BuildInfraMetaConfigTypes.DESCRIPTION,
14
- data: { value: e.currentTarget.value },
15
- })
16
- }
17
-
18
- return (
19
- <div className="flexbox-col dc__gap-4 w-100 dc__align-start">
20
- <label htmlFor="build-infra-profile-description" className="m-0 fs-13 fw-4 lh-20 cn-7">
21
- {BUILD_INFRA_TEXT.DESCRIPTION_LABEL}
22
- </label>
23
-
24
- <textarea
25
- data-testid="build-infra-profile-description"
26
- name="profile-description"
27
- className="form__textarea mxh-140 dc__hover-border-n300"
28
- id="build-infra-profile-description"
29
- placeholder={BUILD_INFRA_TEXT.DESCRIPTION_PLACEHOLDER}
30
- value={currentValue}
31
- onChange={handleChange}
32
- />
33
-
34
- {error && (
35
- <div className="form__error">
36
- <ErrorIcon className="form__icon form__icon--error" />
37
- {error}
38
- </div>
39
- )}
40
- </div>
41
- )
42
- }
43
-
44
- export default BuildInfraProfileDescriptionField