@devtron-labs/devtron-fe-common-lib 0.0.61-beta-7 → 0.0.61-beta-8
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/dist/Common/Constants.d.ts +14 -1
- package/dist/Common/DraggableWrapper/types.d.ts +4 -1
- package/dist/Common/Helper.d.ts +1 -4
- package/dist/Common/Hooks/index.d.ts +1 -0
- package/dist/Common/Hooks/useUrlFilters/constants.d.ts +8 -0
- package/dist/Common/Hooks/useUrlFilters/index.d.ts +2 -0
- package/dist/Common/Hooks/useUrlFilters/types.d.ts +19 -0
- package/dist/Common/Hooks/useUrlFilters/useUrlFilters.d.ts +20 -0
- package/dist/Common/SortableTableHeaderCell/SortableTableHeaderCell.d.ts +18 -0
- package/dist/Common/SortableTableHeaderCell/index.d.ts +2 -0
- package/dist/Common/SortableTableHeaderCell/types.d.ts +25 -0
- package/dist/Common/Types.d.ts +13 -1
- package/dist/Common/index.d.ts +1 -0
- package/dist/Pages/GlobalConfigurations/Authorization/constants.d.ts +15 -0
- package/dist/Pages/GlobalConfigurations/Authorization/index.d.ts +1 -0
- package/dist/Pages/GlobalConfigurations/index.d.ts +1 -1
- package/dist/Shared/Components/BulkSelection/types.d.ts +2 -0
- package/dist/Shared/Components/index.d.ts +0 -2
- package/dist/Shared/index.d.ts +0 -2
- package/dist/index.js +385 -1186
- package/package.json +1 -1
- package/src/Assets/Icon/ic-arrow-up-down.svg +3 -0
- package/src/Assets/Icon/ic-sort-arrow-down.svg +3 -0
- package/src/Common/BreadCrumb/Types.ts +1 -0
- package/src/Common/Checkbox.tsx +0 -1
- package/src/Common/Constants.ts +18 -3
- package/src/Common/CustomInput/CustomInput.tsx +1 -2
- package/src/Common/DraggableWrapper/DraggableWrapper.tsx +1 -3
- package/src/Common/DraggableWrapper/types.ts +4 -1
- package/src/Common/Helper.tsx +24 -31
- package/src/Common/Hooks/index.ts +1 -0
- package/src/Common/Hooks/useUrlFilters/constants.ts +9 -0
- package/src/Common/Hooks/useUrlFilters/index.ts +2 -0
- package/src/Common/Hooks/useUrlFilters/types.ts +21 -0
- package/src/Common/Hooks/useUrlFilters/useUrlFilters.ts +121 -0
- package/src/Common/RJSF/utils.ts +0 -2
- package/src/Common/SearchBar/searchBar.scss +1 -1
- package/src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx +44 -0
- package/src/Common/SortableTableHeaderCell/index.ts +2 -0
- package/src/Common/SortableTableHeaderCell/types.ts +26 -0
- package/src/Common/Types.ts +13 -1
- package/src/Common/index.ts +1 -0
- package/src/Pages/GlobalConfigurations/Authorization/constants.ts +16 -0
- package/src/Pages/GlobalConfigurations/Authorization/index.ts +1 -0
- package/src/Pages/GlobalConfigurations/index.ts +1 -1
- package/src/Shared/Components/BulkSelection/BulkSelection.tsx +2 -2
- package/src/Shared/Components/BulkSelection/BulkSelectionDropdownItems.tsx +1 -3
- package/src/Shared/Components/BulkSelection/BulkSelectionProvider.tsx +16 -5
- package/src/Shared/Components/BulkSelection/types.tsx +2 -0
- package/src/Shared/Components/index.ts +0 -2
- package/src/Shared/index.ts +0 -2
- package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraConfigForm.d.ts +0 -4
- package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.d.ts +0 -4
- package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.d.ts +0 -7
- package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormItem.d.ts +0 -4
- package/dist/Pages/GlobalConfigurations/BuildInfra/BuildInfraProfileNameField.d.ts +0 -4
- package/dist/Pages/GlobalConfigurations/BuildInfra/Descriptor.d.ts +0 -4
- package/dist/Pages/GlobalConfigurations/BuildInfra/Footer.d.ts +0 -4
- package/dist/Pages/GlobalConfigurations/BuildInfra/constants.d.ts +0 -50
- package/dist/Pages/GlobalConfigurations/BuildInfra/index.d.ts +0 -7
- package/dist/Pages/GlobalConfigurations/BuildInfra/services.d.ts +0 -6
- package/dist/Pages/GlobalConfigurations/BuildInfra/types.d.ts +0 -286
- package/dist/Pages/GlobalConfigurations/BuildInfra/utils.d.ts +0 -12
- package/dist/Shared/Components/APIResponseHandler/APIResponseHandler.d.ts +0 -4
- package/dist/Shared/Components/APIResponseHandler/constants.d.ts +0 -4
- package/dist/Shared/Components/APIResponseHandler/index.d.ts +0 -2
- package/dist/Shared/Components/APIResponseHandler/types.d.ts +0 -37
- package/dist/Shared/Components/ReactSelect/index.d.ts +0 -1
- package/dist/Shared/Components/ReactSelect/utils.d.ts +0 -12
- package/dist/Shared/Helpers.d.ts +0 -16
- package/dist/Shared/validations.d.ts +0 -8
- package/src/Assets/Icon/ic-cpu.svg +0 -4
- package/src/Assets/Icon/ic-memory.svg +0 -3
- package/src/Assets/Icon/ic-timer.svg +0 -3
- package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraConfigForm.tsx +0 -128
- package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.tsx +0 -44
- package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.tsx +0 -106
- package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormItem.tsx +0 -55
- package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraProfileNameField.tsx +0 -32
- package/src/Pages/GlobalConfigurations/BuildInfra/Descriptor.tsx +0 -45
- package/src/Pages/GlobalConfigurations/BuildInfra/Footer.tsx +0 -56
- package/src/Pages/GlobalConfigurations/BuildInfra/Readme.md +0 -4
- package/src/Pages/GlobalConfigurations/BuildInfra/constants.tsx +0 -139
- package/src/Pages/GlobalConfigurations/BuildInfra/index.ts +0 -7
- package/src/Pages/GlobalConfigurations/BuildInfra/services.tsx +0 -167
- package/src/Pages/GlobalConfigurations/BuildInfra/types.tsx +0 -339
- package/src/Pages/GlobalConfigurations/BuildInfra/utils.tsx +0 -507
- package/src/Shared/Components/APIResponseHandler/APIResponseHandler.tsx +0 -41
- package/src/Shared/Components/APIResponseHandler/constants.tsx +0 -5
- package/src/Shared/Components/APIResponseHandler/index.ts +0 -2
- package/src/Shared/Components/APIResponseHandler/types.tsx +0 -39
- package/src/Shared/Components/ReactSelect/index.ts +0 -1
- package/src/Shared/Components/ReactSelect/utils.tsx +0 -97
- package/src/Shared/Helpers.tsx +0 -29
- package/src/Shared/validations.tsx +0 -130
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { BuildInfraFormActionProps } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* In case need arise for variants break this CustomInput and Select as a separate component
|
|
5
|
-
*/
|
|
6
|
-
declare const BuildInfraFormAction: FunctionComponent<BuildInfraFormActionProps>;
|
|
7
|
-
export default BuildInfraFormAction;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { UseBreadcrumbProps } from '../../../Common/BreadCrumb/Types';
|
|
2
|
-
import { BuildInfraFormFieldType, BuildInfraMetaConfigTypes, ProfileInputErrorType, BuildInfraProfileBase, HandleProfileInputChangeType } from './types';
|
|
3
|
-
export declare const BUILD_INFRA_INPUT_CONSTRAINTS: {
|
|
4
|
-
readonly STEP: "any";
|
|
5
|
-
readonly MIN: 0;
|
|
6
|
-
readonly DECIMAL_PLACES: 2;
|
|
7
|
-
};
|
|
8
|
-
export declare const BUILD_INFRA_TEXT: {
|
|
9
|
-
readonly HEADING: "Build Infra Configuration";
|
|
10
|
-
readonly EDIT_SUBMIT: "Save changes";
|
|
11
|
-
readonly SAVE_SUBMIT: "Save";
|
|
12
|
-
readonly EDIT_CANCEL: "Cancel";
|
|
13
|
-
readonly EDIT_DEFAULT_TOOLTIP: "Efficiently control infrastructure settings such as CPU, Memory, and Build timeout for your build pipelines. Streamline resource management to optimise build time and cost effortlessly.";
|
|
14
|
-
readonly DESCRIPTION_LABEL: "Description";
|
|
15
|
-
readonly DESCRIPTION_PLACEHOLDER: "Enter a description here";
|
|
16
|
-
readonly PROFILE_LABEL: "Profile name";
|
|
17
|
-
readonly PROFILE_PLACEHOLDER: "Enter a name eg. java/node/small/medium/large";
|
|
18
|
-
readonly INHERITING_HEADING_DESCRIPTION: "Inheriting from default";
|
|
19
|
-
readonly SUBMIT_BUTTON_TIPPY: {
|
|
20
|
-
readonly INVALID_INPUT: "Valid input is required for all mandatory fields.";
|
|
21
|
-
readonly REQUEST_IN_PROGRESS: "Request in progress.";
|
|
22
|
-
};
|
|
23
|
-
readonly VALIDATE_REQUEST_LIMIT: {
|
|
24
|
-
readonly REQUEST_LESS_THAN_LIMIT: "Request should be less than or equal to limit.";
|
|
25
|
-
readonly CAN_NOT_COMPUTE: "Request and limit value diff are too high to validate.";
|
|
26
|
-
readonly REQUEST_DECIMAL_PLACES: "Request should be upto 2 decimal places.";
|
|
27
|
-
readonly LIMIT_DECIMAL_PLACES: "Limit should be upto 2 decimal places.";
|
|
28
|
-
};
|
|
29
|
-
readonly getInvalidActionMessage: (action: HandleProfileInputChangeType['action']) => string;
|
|
30
|
-
readonly getSubmitSuccessMessage: (profileName: string, isEdited: boolean) => string;
|
|
31
|
-
readonly PROFILE_NOT_FOUND: {
|
|
32
|
-
readonly title: "Profile not found";
|
|
33
|
-
readonly subTitle: "The profile you are looking for does not exist.";
|
|
34
|
-
};
|
|
35
|
-
readonly INVALID_FORM_MESSAGE: "Valid input is required for all mandatory fields.";
|
|
36
|
-
};
|
|
37
|
-
export declare const BUILD_INFRA_BREADCRUMB: UseBreadcrumbProps;
|
|
38
|
-
export declare const BUILD_INFRA_FORM_FIELDS: BuildInfraFormFieldType[];
|
|
39
|
-
export declare const PROFILE_INPUT_ERROR_FIELDS: ProfileInputErrorType;
|
|
40
|
-
export declare const CREATE_MODE_REQUIRED_INPUT_FIELDS: BuildInfraMetaConfigTypes[];
|
|
41
|
-
export declare const DEFAULT_PROFILE_NAME: "default";
|
|
42
|
-
export declare const CREATE_PROFILE_BASE_VALUE: BuildInfraProfileBase;
|
|
43
|
-
export declare const CREATE_VIEW_CHECKED_CONFIGS: {
|
|
44
|
-
readonly cpu_request: true;
|
|
45
|
-
readonly cpu_limit: true;
|
|
46
|
-
};
|
|
47
|
-
export declare const BUILD_INFRA_TEST_IDS: {
|
|
48
|
-
readonly SUBMIT_BUTTON: "build-infra-submit-button";
|
|
49
|
-
readonly CANCEL_BUTTON: "build-infra-cancel-button";
|
|
50
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as BuildInfraDescriptor } from './Descriptor';
|
|
2
|
-
export { default as BuildInfraFooter } from './Footer';
|
|
3
|
-
export { default as BuildInfraConfigForm } from './BuildInfraConfigForm';
|
|
4
|
-
export * from './services';
|
|
5
|
-
export * from './utils';
|
|
6
|
-
export * from './types';
|
|
7
|
-
export * from './constants';
|
|
@@ -1,6 +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<ResponseType<any>>;
|
|
@@ -1,286 +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_timeout",
|
|
37
|
-
DE_ACTIVATE_BUILD_TIMEOUT = "de_activate_timeout"
|
|
38
|
-
}
|
|
39
|
-
export declare const BuildInfraConfigActionMap: {
|
|
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
|
-
tippyInfoText?: string;
|
|
62
|
-
tippyAdditionalContent?: ReactNode;
|
|
63
|
-
}
|
|
64
|
-
export interface BuildInfraActionType {
|
|
65
|
-
/**
|
|
66
|
-
* Type of action to be dispatched, would be suffixed with type of change
|
|
67
|
-
*/
|
|
68
|
-
actionType: BuildInfraConfigTypes;
|
|
69
|
-
/**
|
|
70
|
-
* Label to be shown above input
|
|
71
|
-
*/
|
|
72
|
-
label: string;
|
|
73
|
-
/**
|
|
74
|
-
* Placeholder for input, can be optional
|
|
75
|
-
*/
|
|
76
|
-
placeholder?: string;
|
|
77
|
-
}
|
|
78
|
-
export interface BuildInfraConfigurationMarkerProps {
|
|
79
|
-
className?: string;
|
|
80
|
-
}
|
|
81
|
-
export interface BuildInfraFormFieldType {
|
|
82
|
-
/**
|
|
83
|
-
* Heading of the form item
|
|
84
|
-
*/
|
|
85
|
-
heading: ReactNode;
|
|
86
|
-
/**
|
|
87
|
-
* Icon/Checkbox to be shown in front of heading
|
|
88
|
-
*/
|
|
89
|
-
marker: FunctionComponent<BuildInfraConfigurationMarkerProps>;
|
|
90
|
-
/**
|
|
91
|
-
* Actions to be shown in the form item
|
|
92
|
-
*/
|
|
93
|
-
actions: BuildInfraActionType[];
|
|
94
|
-
/**
|
|
95
|
-
* Unique identifier for the form item used for key
|
|
96
|
-
*/
|
|
97
|
-
locator: BuildInfraLocators;
|
|
98
|
-
}
|
|
99
|
-
export interface ConfigurationUnitType {
|
|
100
|
-
name: string;
|
|
101
|
-
conversionFactor: number;
|
|
102
|
-
}
|
|
103
|
-
export type ConfigurationUnitMapType = {
|
|
104
|
-
[key: ConfigurationUnitType['name']]: ConfigurationUnitType;
|
|
105
|
-
};
|
|
106
|
-
export type BuildInfraUnitsMapType = {
|
|
107
|
-
[key in BuildInfraConfigTypes]: ConfigurationUnitMapType;
|
|
108
|
-
};
|
|
109
|
-
export interface BuildInfraConfigValuesType {
|
|
110
|
-
value: string;
|
|
111
|
-
unit?: ConfigurationUnitType['name'];
|
|
112
|
-
}
|
|
113
|
-
interface BuildInfraProfileConfigBase {
|
|
114
|
-
id?: number;
|
|
115
|
-
key: BuildInfraConfigTypes;
|
|
116
|
-
profileName: string;
|
|
117
|
-
active: boolean;
|
|
118
|
-
}
|
|
119
|
-
export interface BuildInfraProfileConfigResponseDataType extends BuildInfraConfigValuesType, BuildInfraProfileConfigBase {
|
|
120
|
-
}
|
|
121
|
-
export interface BuildInfraConfigurationType extends BuildInfraConfigValuesType, BuildInfraProfileConfigBase {
|
|
122
|
-
defaultValue: BuildInfraConfigValuesType;
|
|
123
|
-
}
|
|
124
|
-
export type BuildInfraConfigurationMapWithoutDefaultType = {
|
|
125
|
-
[key in BuildInfraConfigTypes]: BuildInfraConfigValuesType & BuildInfraProfileConfigBase;
|
|
126
|
-
};
|
|
127
|
-
export type BuildInfraConfigurationMapType = {
|
|
128
|
-
[key in BuildInfraConfigTypes]: BuildInfraConfigurationType;
|
|
129
|
-
};
|
|
130
|
-
export interface BuildInfraProfileBase {
|
|
131
|
-
id?: number;
|
|
132
|
-
name: string;
|
|
133
|
-
description: string;
|
|
134
|
-
type: BuildInfraProfileVariants;
|
|
135
|
-
appCount: number;
|
|
136
|
-
}
|
|
137
|
-
export interface BuildInfraProfileResponseDataType extends BuildInfraProfileBase {
|
|
138
|
-
configurations: BuildInfraProfileConfigResponseDataType[];
|
|
139
|
-
}
|
|
140
|
-
export interface BuildInfraProfileData extends BuildInfraProfileBase {
|
|
141
|
-
configurations: BuildInfraConfigurationMapType;
|
|
142
|
-
}
|
|
143
|
-
export interface GetBuildInfraProfileType {
|
|
144
|
-
name: string;
|
|
145
|
-
fromCreateView?: boolean;
|
|
146
|
-
}
|
|
147
|
-
export interface BuildInfraProfileResponseType {
|
|
148
|
-
configurationUnits: BuildInfraUnitsMapType | null;
|
|
149
|
-
profile: BuildInfraProfileData | null;
|
|
150
|
-
}
|
|
151
|
-
export interface UseBuildInfraFormProps {
|
|
152
|
-
/**
|
|
153
|
-
* Name of the profile, if not provided assumption would be for create view
|
|
154
|
-
*/
|
|
155
|
-
name?: string;
|
|
156
|
-
/**
|
|
157
|
-
* If true, would send put request else would create profile via post
|
|
158
|
-
*/
|
|
159
|
-
editProfile?: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* If true, call this on form submission success
|
|
162
|
-
*/
|
|
163
|
-
handleSuccessRedirection?: () => void;
|
|
164
|
-
}
|
|
165
|
-
export type ProfileInputErrorType = {
|
|
166
|
-
[key in BuildInfraConfigTypes | BuildInfraMetaConfigTypes]: string;
|
|
167
|
-
};
|
|
168
|
-
export interface ProfileInputDispatchDataType {
|
|
169
|
-
value: string;
|
|
170
|
-
unit?: string;
|
|
171
|
-
}
|
|
172
|
-
export interface HandleProfileInputChangeType {
|
|
173
|
-
action: BuildInfraConfigTypes | BuildInfraInheritActions | BuildInfraMetaConfigTypes;
|
|
174
|
-
data?: ProfileInputDispatchDataType;
|
|
175
|
-
}
|
|
176
|
-
export interface UseBuildInfraFormResponseType {
|
|
177
|
-
isLoading: boolean;
|
|
178
|
-
profileResponse: BuildInfraProfileResponseType | null;
|
|
179
|
-
responseError: ServerErrors | null;
|
|
180
|
-
reloadRequest: () => void;
|
|
181
|
-
profileInput: BuildInfraProfileData;
|
|
182
|
-
profileInputErrors: ProfileInputErrorType;
|
|
183
|
-
handleProfileInputChange: ({ action, data }: HandleProfileInputChangeType) => void;
|
|
184
|
-
loadingActionRequest: boolean;
|
|
185
|
-
handleSubmit: (e: FormEvent<HTMLFormElement>) => Promise<void>;
|
|
186
|
-
}
|
|
187
|
-
export interface BuildInfraFormItemProps extends Pick<BuildInfraFormFieldType, 'marker' | 'heading'> {
|
|
188
|
-
children?: ReactNode;
|
|
189
|
-
/**
|
|
190
|
-
* If true, means profile is inheriting values from other profile (e.g, default)
|
|
191
|
-
*/
|
|
192
|
-
isInheriting?: boolean;
|
|
193
|
-
/**
|
|
194
|
-
* Would be false for last item
|
|
195
|
-
*/
|
|
196
|
-
showDivider?: boolean;
|
|
197
|
-
/**
|
|
198
|
-
* Would be used to dispatch inherit actions (activate_cpu, de_activate_cpu, etc)
|
|
199
|
-
*/
|
|
200
|
-
handleProfileInputChange: UseBuildInfraFormResponseType['handleProfileInputChange'];
|
|
201
|
-
locator: BuildInfraFormFieldType['locator'];
|
|
202
|
-
isDefaultProfile: boolean;
|
|
203
|
-
}
|
|
204
|
-
export interface ValidateRequestLimitType {
|
|
205
|
-
request: BuildInfraConfigValuesType;
|
|
206
|
-
limit: BuildInfraConfigValuesType;
|
|
207
|
-
unitsMap: ConfigurationUnitMapType;
|
|
208
|
-
}
|
|
209
|
-
export interface ValidateRequestLimitResponseType {
|
|
210
|
-
request: ValidationResponseType;
|
|
211
|
-
limit: ValidationResponseType;
|
|
212
|
-
}
|
|
213
|
-
export interface BuildInfraConfigFormProps extends Pick<UseBuildInfraFormResponseType, 'profileInput' | 'profileInputErrors' | 'handleProfileInputChange'> {
|
|
214
|
-
isDefaultProfile?: boolean;
|
|
215
|
-
unitsMap?: BuildInfraProfileResponseType['configurationUnits'];
|
|
216
|
-
configurationContainerLabel?: ReactNode;
|
|
217
|
-
}
|
|
218
|
-
export interface BuildInfraFormActionProps extends BuildInfraActionType {
|
|
219
|
-
handleProfileInputChange: UseBuildInfraFormResponseType['handleProfileInputChange'];
|
|
220
|
-
currentValue: BuildInfraConfigValuesType['value'];
|
|
221
|
-
error?: string;
|
|
222
|
-
isRequired?: boolean;
|
|
223
|
-
profileUnitsMap?: ConfigurationUnitMapType;
|
|
224
|
-
currentUnitName?: BuildInfraConfigValuesType['unit'];
|
|
225
|
-
}
|
|
226
|
-
export interface FooterProps {
|
|
227
|
-
/**
|
|
228
|
-
* If true, means form contains errors
|
|
229
|
-
*/
|
|
230
|
-
disabled?: boolean;
|
|
231
|
-
handleCancel?: () => void;
|
|
232
|
-
/**
|
|
233
|
-
* If true would show save changes else would show save for submit button
|
|
234
|
-
*/
|
|
235
|
-
editProfile?: boolean;
|
|
236
|
-
loading?: boolean;
|
|
237
|
-
}
|
|
238
|
-
export interface UpdateBuildInfraProfileType extends Pick<UseBuildInfraFormResponseType, 'profileInput'> {
|
|
239
|
-
name: string;
|
|
240
|
-
}
|
|
241
|
-
export interface CreateBuildInfraProfileType extends Pick<UseBuildInfraFormResponseType, 'profileInput'> {
|
|
242
|
-
}
|
|
243
|
-
export interface CreateBuildInfraServiceConfigurationType {
|
|
244
|
-
key: BuildInfraConfigTypes;
|
|
245
|
-
value: string | number;
|
|
246
|
-
active: boolean;
|
|
247
|
-
unit?: string;
|
|
248
|
-
/**
|
|
249
|
-
* Would send for those that are available in profileInput
|
|
250
|
-
*/
|
|
251
|
-
id?: number;
|
|
252
|
-
}
|
|
253
|
-
export interface CreateBuildInfraServicePayloadType {
|
|
254
|
-
name: string;
|
|
255
|
-
description: string;
|
|
256
|
-
type: BuildInfraProfileVariants;
|
|
257
|
-
configurations: CreateBuildInfraServiceConfigurationType[];
|
|
258
|
-
}
|
|
259
|
-
export interface BuildInfraInputFieldComponentProps {
|
|
260
|
-
handleProfileInputChange: UseBuildInfraFormResponseType['handleProfileInputChange'];
|
|
261
|
-
currentValue: BuildInfraConfigValuesType['value'];
|
|
262
|
-
error?: string;
|
|
263
|
-
}
|
|
264
|
-
export interface InheritingHeaderProps {
|
|
265
|
-
defaultHeading: BuildInfraFormFieldType['heading'];
|
|
266
|
-
inheritingData: BuildInfraConfigValuesType[];
|
|
267
|
-
isInheriting: boolean;
|
|
268
|
-
isDefaultProfile: boolean;
|
|
269
|
-
}
|
|
270
|
-
export interface BuildInfraConfigResponseDataType {
|
|
271
|
-
name: BuildInfraConfigTypes;
|
|
272
|
-
units: ConfigurationUnitType[];
|
|
273
|
-
}
|
|
274
|
-
interface BaseBuildInfraProfileResponseType {
|
|
275
|
-
defaultConfigurations: BuildInfraProfileConfigResponseDataType[];
|
|
276
|
-
configurationUnits: BuildInfraUnitsMapType;
|
|
277
|
-
}
|
|
278
|
-
export interface BuildInfraListResponseType extends BaseBuildInfraProfileResponseType {
|
|
279
|
-
profiles: BuildInfraProfileResponseDataType[];
|
|
280
|
-
}
|
|
281
|
-
export interface BuildInfraProfileAPIResponseType extends BaseBuildInfraProfileResponseType {
|
|
282
|
-
profile: BuildInfraProfileResponseDataType;
|
|
283
|
-
}
|
|
284
|
-
export interface BuildInfraProfileTransformerType extends BuildInfraProfileAPIResponseType, Pick<GetBuildInfraProfileType, 'fromCreateView'> {
|
|
285
|
-
}
|
|
286
|
-
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,37 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { GenericEmptyStateType, ProgressingProps, ReloadType, ServerErrors } from '../../../Common';
|
|
3
|
-
export interface EmptyPageTextType {
|
|
4
|
-
title?: GenericEmptyStateType['title'];
|
|
5
|
-
subTitle?: GenericEmptyStateType['subTitle'];
|
|
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;
|
package/dist/Shared/Helpers.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface HighlightSearchTextProps {
|
|
2
|
-
/**
|
|
3
|
-
* The text to be highlighted
|
|
4
|
-
*/
|
|
5
|
-
searchText: string;
|
|
6
|
-
/**
|
|
7
|
-
* The whole text string
|
|
8
|
-
*/
|
|
9
|
-
text: string;
|
|
10
|
-
/**
|
|
11
|
-
* The classes to be applied to the highlighted text
|
|
12
|
-
*/
|
|
13
|
-
highlightClasses?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare const highlightSearchText: ({ searchText, text, highlightClasses }: HighlightSearchTextProps) => string;
|
|
16
|
-
export {};
|
|
@@ -1,8 +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;
|
|
8
|
-
export declare const validateRequiredPositiveInteger: (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,128 +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
|
-
<div className="flexbox dc__content-space w-100">
|
|
29
|
-
<span className="m-0 pt-0 pb-0 pl-4 pr-4 fs-13 lh-20 fw-4 cn-9 dc__ellipsis-right dc__word-break-all flex-grow-1">
|
|
30
|
-
{inheritingDataString}
|
|
31
|
-
</span>
|
|
32
|
-
|
|
33
|
-
{/* TODO: Add ellipsis */}
|
|
34
|
-
<p className="m-0 cn-7 fs-13 fw-4 lh-20 dc__no-shrink">
|
|
35
|
-
{BUILD_INFRA_TEXT.INHERITING_HEADING_DESCRIPTION}
|
|
36
|
-
</p>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const BuildInfraConfigForm: FunctionComponent<BuildInfraConfigFormProps> = ({
|
|
43
|
-
profileInput,
|
|
44
|
-
profileInputErrors,
|
|
45
|
-
handleProfileInputChange,
|
|
46
|
-
isDefaultProfile,
|
|
47
|
-
unitsMap,
|
|
48
|
-
configurationContainerLabel,
|
|
49
|
-
}) => {
|
|
50
|
-
const currentConfigurations = profileInput?.configurations
|
|
51
|
-
|
|
52
|
-
// will get the desired configuration from the currentConfigurations and then check if it is active or not
|
|
53
|
-
const isInheritingProfileValues = (actions: BuildInfraActionType[]) =>
|
|
54
|
-
actions.some((action) => !currentConfigurations[action.actionType].active)
|
|
55
|
-
|
|
56
|
-
// Had to show loader for an instance due to batching of state updates not working as expected :/
|
|
57
|
-
if (!currentConfigurations) {
|
|
58
|
-
return <Progressing pageLoader />
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div className="flexbox-col dc__mxw-920 dc__gap-16">
|
|
63
|
-
{!isDefaultProfile && (
|
|
64
|
-
<div className="flexbox-col dc__gap-12">
|
|
65
|
-
<BuildInfraProfileNameField
|
|
66
|
-
handleProfileInputChange={handleProfileInputChange}
|
|
67
|
-
currentValue={profileInput.name}
|
|
68
|
-
error={profileInputErrors.name}
|
|
69
|
-
/>
|
|
70
|
-
|
|
71
|
-
<BuildInfraProfileDescriptionField
|
|
72
|
-
handleProfileInputChange={handleProfileInputChange}
|
|
73
|
-
currentValue={profileInput.description}
|
|
74
|
-
error={profileInputErrors.description}
|
|
75
|
-
/>
|
|
76
|
-
</div>
|
|
77
|
-
)}
|
|
78
|
-
|
|
79
|
-
<div className="flexbox-col dc__gap-12">
|
|
80
|
-
{configurationContainerLabel}
|
|
81
|
-
|
|
82
|
-
<div className="w-100 flexbox-col dc__gap-16 br-4 dc__border-n1 p-16">
|
|
83
|
-
{BUILD_INFRA_FORM_FIELDS.map((field, index) => (
|
|
84
|
-
<BuildInfraFormItem
|
|
85
|
-
key={field.locator}
|
|
86
|
-
marker={field.marker}
|
|
87
|
-
heading={
|
|
88
|
-
<InheritingHeader
|
|
89
|
-
defaultHeading={field.heading}
|
|
90
|
-
inheritingData={field.actions.map(
|
|
91
|
-
(action) => currentConfigurations[action.actionType],
|
|
92
|
-
)}
|
|
93
|
-
isInheriting={isInheritingProfileValues(field.actions)}
|
|
94
|
-
isDefaultProfile={isDefaultProfile}
|
|
95
|
-
/>
|
|
96
|
-
}
|
|
97
|
-
showDivider={index !== BUILD_INFRA_FORM_FIELDS.length - 1}
|
|
98
|
-
isInheriting={isInheritingProfileValues(field.actions)}
|
|
99
|
-
handleProfileInputChange={handleProfileInputChange}
|
|
100
|
-
locator={field.locator}
|
|
101
|
-
isDefaultProfile={isDefaultProfile}
|
|
102
|
-
>
|
|
103
|
-
<div className="w-50 flexbox dc__gap-12 w-100 dc__align-start">
|
|
104
|
-
{field.actions.map((action) => (
|
|
105
|
-
<BuildInfraFormAction
|
|
106
|
-
key={action.actionType}
|
|
107
|
-
actionType={action.actionType}
|
|
108
|
-
label={action.label}
|
|
109
|
-
placeholder={action.placeholder}
|
|
110
|
-
error={profileInputErrors[action.actionType]}
|
|
111
|
-
// Assumption is for default profiles all input fields are required
|
|
112
|
-
isRequired
|
|
113
|
-
profileUnitsMap={unitsMap[action.actionType]}
|
|
114
|
-
handleProfileInputChange={handleProfileInputChange}
|
|
115
|
-
currentUnitName={currentConfigurations[action.actionType].unit}
|
|
116
|
-
currentValue={currentConfigurations[action.actionType].value}
|
|
117
|
-
/>
|
|
118
|
-
))}
|
|
119
|
-
</div>
|
|
120
|
-
</BuildInfraFormItem>
|
|
121
|
-
))}
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export default BuildInfraConfigForm
|