@cloud-ru/uikit-product-calculator 0.33.3
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/CHANGELOG.md +1508 -0
- package/LICENSE +201 -0
- package/README.md +85 -0
- package/package.json +75 -0
- package/src/components/Calculator/Calculator.tsx +79 -0
- package/src/components/Calculator/index.ts +1 -0
- package/src/components/CalculatorContent/CalculatorContent.tsx +38 -0
- package/src/components/CalculatorContent/index.ts +1 -0
- package/src/components/CalculatorContent/styles.module.scss +79 -0
- package/src/components/Catalog/Catalog.tsx +225 -0
- package/src/components/Catalog/components/PrivateCardHeader.tsx +63 -0
- package/src/components/Catalog/components/index.ts +1 -0
- package/src/components/Catalog/components/styles.module.scss +35 -0
- package/src/components/Catalog/index.ts +1 -0
- package/src/components/Catalog/styles.module.scss +104 -0
- package/src/components/Controls/AlertControl/AlertControl.tsx +44 -0
- package/src/components/Controls/AlertControl/index.ts +1 -0
- package/src/components/Controls/ArrayControl/ArrayControl.tsx +105 -0
- package/src/components/Controls/ArrayControl/index.ts +1 -0
- package/src/components/Controls/ArrayControl/styles.module.scss +33 -0
- package/src/components/Controls/CarouselControl/CarouselControl.tsx +173 -0
- package/src/components/Controls/CarouselControl/index.ts +1 -0
- package/src/components/Controls/CarouselControl/styles.module.scss +32 -0
- package/src/components/Controls/Control/Control.tsx +205 -0
- package/src/components/Controls/Control/index.ts +1 -0
- package/src/components/Controls/ObjectControl/ObjectControl.tsx +150 -0
- package/src/components/Controls/ObjectControl/index.ts +1 -0
- package/src/components/Controls/ObjectControl/styles.module.scss +18 -0
- package/src/components/Controls/ObjectDecorator/ObjectDecorator.tsx +23 -0
- package/src/components/Controls/ObjectDecorator/index.ts +1 -0
- package/src/components/Controls/ObjectDecorator/styles.module.scss +15 -0
- package/src/components/Controls/SegmentedControl/SegmentedControl.tsx +79 -0
- package/src/components/Controls/SegmentedControl/SegmentedControlCard.tsx +38 -0
- package/src/components/Controls/SegmentedControl/index.ts +1 -0
- package/src/components/Controls/SegmentedControl/styles.module.scss +8 -0
- package/src/components/Controls/SelectControl/SelectControl.tsx +172 -0
- package/src/components/Controls/SelectControl/index.ts +1 -0
- package/src/components/Controls/SelectControl/styles.module.scss +5 -0
- package/src/components/Controls/SliderControl/SliderControl.tsx +92 -0
- package/src/components/Controls/SliderControl/index.ts +1 -0
- package/src/components/Controls/StepperControl/StepperControl.tsx +160 -0
- package/src/components/Controls/StepperControl/index.ts +1 -0
- package/src/components/Controls/StepperControl/styles.module.scss +16 -0
- package/src/components/Controls/TableControl/TableControl.tsx +162 -0
- package/src/components/Controls/TableControl/helperComponents/StepperWithAllowedValues.tsx +50 -0
- package/src/components/Controls/TableControl/helperComponents/index.ts +1 -0
- package/src/components/Controls/TableControl/helperComponents/styles.module.scss +53 -0
- package/src/components/Controls/TableControl/index.ts +1 -0
- package/src/components/Controls/TableControl/styles.module.scss +104 -0
- package/src/components/Controls/ToggleCard/ToggleCard.tsx +46 -0
- package/src/components/Controls/ToggleCard/index.ts +1 -0
- package/src/components/Controls/ToggleCard/styles.module.scss +11 -0
- package/src/components/Controls/ToggleCardsControl/ToggleCardsControl.tsx +93 -0
- package/src/components/Controls/ToggleCardsControl/index.ts +1 -0
- package/src/components/Controls/ToggleCardsControl/styles.module.scss +40 -0
- package/src/components/Controls/ToggleControl/ToggleControl.tsx +59 -0
- package/src/components/Controls/ToggleControl/components/SwitchRow.tsx +98 -0
- package/src/components/Controls/ToggleControl/components/index.ts +1 -0
- package/src/components/Controls/ToggleControl/components/styles.module.scss +110 -0
- package/src/components/Controls/ToggleControl/index.ts +1 -0
- package/src/components/Controls/ToggleObjectControl/ToggleObjectControl.tsx +111 -0
- package/src/components/Controls/ToggleObjectControl/index.ts +1 -0
- package/src/components/Controls/ToggleObjectControl/styles.module.scss +13 -0
- package/src/components/Controls/constants.ts +16 -0
- package/src/components/Controls/index.tsx +26 -0
- package/src/components/Controls/types.ts +181 -0
- package/src/components/Controls/utils.ts +49 -0
- package/src/components/Disclaimer/Disclaimer.tsx +33 -0
- package/src/components/Disclaimer/index.ts +1 -0
- package/src/components/Disclaimer/styles.module.scss +14 -0
- package/src/components/HeaderContainer/index.tsx +32 -0
- package/src/components/HeaderContainer/styles.module.scss +24 -0
- package/src/components/PriceSummary/PriceSummary.tsx +158 -0
- package/src/components/PriceSummary/components/PricePeriodSelect/PricePeriodSelect.tsx +81 -0
- package/src/components/PriceSummary/components/PricePeriodSelect/index.ts +1 -0
- package/src/components/PriceSummary/components/ProductCard/ProductCard.tsx +85 -0
- package/src/components/PriceSummary/components/ProductCard/index.ts +1 -0
- package/src/components/PriceSummary/components/ProductCard/styles.module.scss +7 -0
- package/src/components/PriceSummary/components/ProductListActions/ProductListActions.tsx +118 -0
- package/src/components/PriceSummary/components/ProductListActions/index.ts +1 -0
- package/src/components/PriceSummary/components/ProductListActions/styles.module.scss +38 -0
- package/src/components/PriceSummary/components/index.ts +3 -0
- package/src/components/PriceSummary/hooks.ts +36 -0
- package/src/components/PriceSummary/index.ts +1 -0
- package/src/components/PriceSummary/styles.module.scss +110 -0
- package/src/components/PriceSummary/utils/getTotalPrice.ts +19 -0
- package/src/components/PriceSummary/utils/index.ts +2 -0
- package/src/components/PriceSummary/utils/transformToProductCardData.ts +36 -0
- package/src/components/ProductHeadline/ProductPageHeadline.tsx +134 -0
- package/src/components/ProductHeadline/components/PriceCount.tsx +93 -0
- package/src/components/ProductHeadline/components/index.ts +1 -0
- package/src/components/ProductHeadline/components/styles.module.scss +52 -0
- package/src/components/ProductHeadline/index.ts +1 -0
- package/src/components/ProductHeadline/styles.module.scss +32 -0
- package/src/components/ProductPage/ProductPage.tsx +105 -0
- package/src/components/ProductPage/index.ts +1 -0
- package/src/components/ProductPage/styles.module.scss +13 -0
- package/src/components/Welcome/Welcome.tsx +138 -0
- package/src/components/Welcome/index.ts +1 -0
- package/src/components/Welcome/styles.module.scss +155 -0
- package/src/components/index.ts +3 -0
- package/src/config/config.tsx +27 -0
- package/src/config/index.ts +2 -0
- package/src/config/platforms/advanced/catalog.ts +82 -0
- package/src/config/platforms/advanced/constants.ts +23 -0
- package/src/config/platforms/advanced/index.ts +5 -0
- package/src/config/platforms/advanced/platform.tsx +13 -0
- package/src/config/platforms/advanced/product-config/AdvancedCloudBackup.ts +76 -0
- package/src/config/platforms/advanced/product-config/AdvancedCloudContainerEngine.tsx +260 -0
- package/src/config/platforms/advanced/product-config/AdvancedCloudServer.tsx +526 -0
- package/src/config/platforms/advanced/product-config/AdvancedDataAsYouUse.ts +159 -0
- package/src/config/platforms/advanced/product-config/AdvancedDataLakeInsight.ts +134 -0
- package/src/config/platforms/advanced/product-config/AdvancedDataWarehouseService.ts +94 -0
- package/src/config/platforms/advanced/product-config/AdvancedDcsMemcached.ts +69 -0
- package/src/config/platforms/advanced/product-config/AdvancedDcsRedis.ts +220 -0
- package/src/config/platforms/advanced/product-config/AdvancedDmsKafka.tsx +186 -0
- package/src/config/platforms/advanced/product-config/AdvancedDmsRabbitMq.ts +202 -0
- package/src/config/platforms/advanced/product-config/AdvancedDocumentDatabase.tsx +323 -0
- package/src/config/platforms/advanced/product-config/AdvancedElasticLoadBalance.tsx +252 -0
- package/src/config/platforms/advanced/product-config/AdvancedElasticSearch.ts +365 -0
- package/src/config/platforms/advanced/product-config/AdvancedFunctionGraph.tsx +65 -0
- package/src/config/platforms/advanced/product-config/AdvancedMapReduce.tsx +394 -0
- package/src/config/platforms/advanced/product-config/AdvancedMySqlDataBase.ts +417 -0
- package/src/config/platforms/advanced/product-config/AdvancedNetwork.ts +146 -0
- package/src/config/platforms/advanced/product-config/AdvancedObjectStorage.ts +232 -0
- package/src/config/platforms/advanced/product-config/AdvancedPostgreSqlDatabase.ts +402 -0
- package/src/config/platforms/advanced/product-config/AdvancedScalableFile.tsx +161 -0
- package/src/config/platforms/advanced/product-config/AdvancedSqlDatabase.ts +380 -0
- package/src/config/platforms/advanced/product-config/index.ts +21 -0
- package/src/config/platforms/advanced/products.ts +267 -0
- package/src/config/platforms/evolution/catalog.tsx +107 -0
- package/src/config/platforms/evolution/constants.ts +80 -0
- package/src/config/platforms/evolution/index.ts +5 -0
- package/src/config/platforms/evolution/platform.tsx +13 -0
- package/src/config/platforms/evolution/product-config/EvolutionArenadataDb.ts +151 -0
- package/src/config/platforms/evolution/product-config/EvolutionArtifactRegistry.ts +57 -0
- package/src/config/platforms/evolution/product-config/EvolutionBareMetal.tsx +172 -0
- package/src/config/platforms/evolution/product-config/EvolutionCloudServer.tsx +407 -0
- package/src/config/platforms/evolution/product-config/EvolutionCloudServerFreeTier.tsx +185 -0
- package/src/config/platforms/evolution/product-config/EvolutionCloudServerGpu.tsx +301 -0
- package/src/config/platforms/evolution/product-config/EvolutionContainerApps.ts +84 -0
- package/src/config/platforms/evolution/product-config/EvolutionContainerAppsFreeTier.ts +29 -0
- package/src/config/platforms/evolution/product-config/EvolutionKubernetes.ts +388 -0
- package/src/config/platforms/evolution/product-config/EvolutionManagedMetastore.ts +38 -0
- package/src/config/platforms/evolution/product-config/EvolutionManagedRedis.ts +161 -0
- package/src/config/platforms/evolution/product-config/EvolutionManagedSpark.ts +360 -0
- package/src/config/platforms/evolution/product-config/EvolutionManagedTrino.ts +53 -0
- package/src/config/platforms/evolution/product-config/EvolutionMlInference.tsx +703 -0
- package/src/config/platforms/evolution/product-config/EvolutionPostgreSql.ts +217 -0
- package/src/config/platforms/evolution/product-config/EvolutionPublicIp.ts +39 -0
- package/src/config/platforms/evolution/product-config/EvolutionSnatGateway.ts +22 -0
- package/src/config/platforms/evolution/product-config/EvolutionStorageS3.ts +223 -0
- package/src/config/platforms/evolution/product-config/EvolutionStorageS3FreeTier.ts +97 -0
- package/src/config/platforms/evolution/product-config/index.ts +17 -0
- package/src/config/platforms/evolution/products.ts +260 -0
- package/src/config/platforms/index.ts +3 -0
- package/src/config/platforms/vmware/catalog.ts +19 -0
- package/src/config/platforms/vmware/constants.ts +6 -0
- package/src/config/platforms/vmware/index.ts +5 -0
- package/src/config/platforms/vmware/platform.tsx +13 -0
- package/src/config/platforms/vmware/product-config/VmWareCloudBackup.ts +56 -0
- package/src/config/platforms/vmware/product-config/VmWareVirtualDataCenter.ts +309 -0
- package/src/config/platforms/vmware/product-config/VmWareVirtualMachinesBackup.ts +58 -0
- package/src/config/platforms/vmware/product-config/VmWareVirtualWorkspaces.tsx +210 -0
- package/src/config/platforms/vmware/product-config/index.ts +4 -0
- package/src/config/platforms/vmware/products.ts +63 -0
- package/src/config/styles.module.scss +9 -0
- package/src/config/utils/disk.ts +94 -0
- package/src/config/utils/diskPostgreSqlMySQL.ts +94 -0
- package/src/config/utils/eip.ts +104 -0
- package/src/config/utils/index.ts +52 -0
- package/src/config/utils/obs.ts +100 -0
- package/src/constants.ts +56 -0
- package/src/contexts/CalculatorContext.tsx +193 -0
- package/src/contexts/ProductContext.ts +25 -0
- package/src/contexts/index.ts +2 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useAdaptive.ts +20 -0
- package/src/hooks/useCatalogCardClick.ts +37 -0
- package/src/hooks/useProductClick.ts +14 -0
- package/src/hooks/useProductDelete.ts +46 -0
- package/src/index.ts +6 -0
- package/src/services/constants.ts +5 -0
- package/src/services/getFetcherFn.ts +57 -0
- package/src/services/getInitPrice.ts +64 -0
- package/src/services/getOnDownloadFileClick.ts +37 -0
- package/src/services/getOnShareClick.ts +56 -0
- package/src/services/index.ts +4 -0
- package/src/types/CalculatorType.ts +16 -0
- package/src/types/CatalogConfig.ts +13 -0
- package/src/types/Category.ts +14 -0
- package/src/types/FetcherFn.ts +26 -0
- package/src/types/FormValues.ts +4 -0
- package/src/types/Platform.ts +24 -0
- package/src/types/Price.ts +18 -0
- package/src/types/Product.ts +39 -0
- package/src/types/ProductState.ts +11 -0
- package/src/types/State.ts +7 -0
- package/src/types/index.ts +10 -0
- package/src/utils/filterNonEmptyArrays.ts +13 -0
- package/src/utils/formatNumber.ts +5 -0
- package/src/utils/getPrice.ts +38 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/parseKeyToDataTest.ts +14 -0
- package/src/utils/value.ts +11 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { CONTROL, FormConfig, StepperControl } from '../../../../components';
|
|
2
|
+
import { getObs, UnitsOfCalculationItem } from '../../../utils';
|
|
3
|
+
|
|
4
|
+
const StorageClassItem = {
|
|
5
|
+
Cold: 'Cold',
|
|
6
|
+
Standard: 'Standard',
|
|
7
|
+
Warm: 'Warm',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const storageClassItems = [
|
|
11
|
+
{
|
|
12
|
+
value: StorageClassItem.Standard,
|
|
13
|
+
label: 'Горячее (Standard)',
|
|
14
|
+
description:
|
|
15
|
+
'Стандартный класс хранения обеспечивает высокий уровень доступа и применим как к большим массивам данных, к которым требуется частый доступ, так и к небольшим (менее 1 МБ) данным.',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: StorageClassItem.Warm,
|
|
19
|
+
label: 'Теплое (Warm)',
|
|
20
|
+
description: 'Подходит для хранения информации, доступ к которой требуется нечасто (меньше 12-ти раз в год).',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: StorageClassItem.Cold,
|
|
24
|
+
label: 'Холодное (Cold)',
|
|
25
|
+
description:
|
|
26
|
+
'Архивный класс хранения предназначен для данных, доступ к которым требуется редко (в среднем один раз в год).',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const DataRedundancyPolicyItem = {
|
|
31
|
+
Multi: 'Multi',
|
|
32
|
+
Single: 'Single',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const dataRedundancyPolicyItems = [
|
|
36
|
+
{
|
|
37
|
+
value: DataRedundancyPolicyItem.Multi,
|
|
38
|
+
label: 'В трех зонах',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: DataRedundancyPolicyItem.Single,
|
|
42
|
+
label: 'В одной зоне',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const RestoringDataTypeItem = {
|
|
47
|
+
Standard:
|
|
48
|
+
// тут очепятка намеренная, тк бек такое тоже ждет
|
|
49
|
+
'Standart',
|
|
50
|
+
Fast: 'Fast',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const restoringDataTypeItems = [
|
|
54
|
+
{
|
|
55
|
+
value: RestoringDataTypeItem.Standard,
|
|
56
|
+
label: 'Стандартное',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: RestoringDataTypeItem.Fast,
|
|
60
|
+
label: 'Быстрое',
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const apiUiOptions: Partial<StepperControl['uiProps']> = {
|
|
65
|
+
min: 0,
|
|
66
|
+
step: 1_000,
|
|
67
|
+
max: 9_999_999_000,
|
|
68
|
+
showHint: false,
|
|
69
|
+
postfix: 'Шт',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const OBJECT_STORAGE_FORM_CONFIG: FormConfig = {
|
|
73
|
+
ui: [
|
|
74
|
+
'storageClass',
|
|
75
|
+
['storage', 'dataRedundancyPolicy'],
|
|
76
|
+
'apiActions',
|
|
77
|
+
['internetOutbound'],
|
|
78
|
+
['restoringDataType'],
|
|
79
|
+
['quantityRestoringData'],
|
|
80
|
+
],
|
|
81
|
+
controls: {
|
|
82
|
+
storageClass: {
|
|
83
|
+
type: CONTROL.Carousel,
|
|
84
|
+
defaultValue: StorageClassItem.Standard,
|
|
85
|
+
items: storageClassItems,
|
|
86
|
+
accessorKey: 'storages[0].obs.storageClass',
|
|
87
|
+
decoratorProps: {
|
|
88
|
+
label: 'Тип хранилища',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
storage: getObs({
|
|
92
|
+
space: {
|
|
93
|
+
accessorKey: 'storages[0].obs.storage.space',
|
|
94
|
+
label: 'Размер хранилища',
|
|
95
|
+
defaultValue: 100,
|
|
96
|
+
uiProps: {
|
|
97
|
+
min: 0,
|
|
98
|
+
max: 9_999_999_900,
|
|
99
|
+
showHint: false,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
units: {
|
|
103
|
+
accessorKey: 'storages[0].obs.storage.specification',
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
dataRedundancyPolicy: {
|
|
107
|
+
type: CONTROL.Segmented,
|
|
108
|
+
accessorKey: 'storages[0].obs.dataRedundancyPolicy',
|
|
109
|
+
defaultValue: DataRedundancyPolicyItem.Single,
|
|
110
|
+
items: dataRedundancyPolicyItems,
|
|
111
|
+
decoratorProps: {
|
|
112
|
+
label: 'Зона доступности хранения данных',
|
|
113
|
+
},
|
|
114
|
+
watchedControls: { storageClass: 'storages[0].obs.storageClass' },
|
|
115
|
+
relateFn: ({ storageClass }) => {
|
|
116
|
+
if (storageClass === StorageClassItem.Cold) {
|
|
117
|
+
return {
|
|
118
|
+
items: dataRedundancyPolicyItems.slice(1),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
apiActions: {
|
|
124
|
+
type: CONTROL.Object,
|
|
125
|
+
decoratorProps: {
|
|
126
|
+
label: 'Количество операций API',
|
|
127
|
+
},
|
|
128
|
+
ui: [['apiGet'], ['apiPut'], ['apiDelete']],
|
|
129
|
+
controls: {
|
|
130
|
+
apiGet: {
|
|
131
|
+
type: CONTROL.Stepper,
|
|
132
|
+
defaultValue: 0,
|
|
133
|
+
accessorKey: 'storages[0].obs.apiGet',
|
|
134
|
+
decoratorProps: {
|
|
135
|
+
label: 'GET-операции',
|
|
136
|
+
},
|
|
137
|
+
uiProps: apiUiOptions,
|
|
138
|
+
},
|
|
139
|
+
apiPut: {
|
|
140
|
+
type: CONTROL.Stepper,
|
|
141
|
+
defaultValue: 0,
|
|
142
|
+
accessorKey: 'storages[0].obs.apiPut',
|
|
143
|
+
decoratorProps: {
|
|
144
|
+
label: 'PUT-операции',
|
|
145
|
+
},
|
|
146
|
+
uiProps: apiUiOptions,
|
|
147
|
+
},
|
|
148
|
+
apiDelete: {
|
|
149
|
+
type: CONTROL.Stepper,
|
|
150
|
+
defaultValue: 0,
|
|
151
|
+
accessorKey: 'storages[0].obs.apiDelete',
|
|
152
|
+
decoratorProps: {
|
|
153
|
+
label: 'DELETE-операции',
|
|
154
|
+
},
|
|
155
|
+
uiProps: apiUiOptions,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
internetOutbound: getObs({
|
|
161
|
+
space: {
|
|
162
|
+
accessorKey: 'storages[0].obs.internetOutbound.traffic',
|
|
163
|
+
label: 'Исходящий трафик в интернет',
|
|
164
|
+
defaultValue: 0,
|
|
165
|
+
},
|
|
166
|
+
units: {
|
|
167
|
+
accessorKey: 'storages[0].obs.internetOutbound.unitsOfCalculation',
|
|
168
|
+
},
|
|
169
|
+
}),
|
|
170
|
+
restoringDataType: {
|
|
171
|
+
type: CONTROL.Segmented,
|
|
172
|
+
accessorKey: 'storages[0].obs.restoringDataType',
|
|
173
|
+
defaultValue: RestoringDataTypeItem.Standard,
|
|
174
|
+
items: restoringDataTypeItems,
|
|
175
|
+
decoratorProps: {
|
|
176
|
+
label: 'Восстановление данных',
|
|
177
|
+
},
|
|
178
|
+
watchedControls: { storageClass: 'storages[0].obs.storageClass' },
|
|
179
|
+
relateFn: ({ storageClass }) => {
|
|
180
|
+
if (storageClass !== StorageClassItem.Cold) {
|
|
181
|
+
return {
|
|
182
|
+
uiProps: {
|
|
183
|
+
visible: false,
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
quantityRestoringData: getObs({
|
|
190
|
+
space: {
|
|
191
|
+
accessorKey: 'storages[0].obs.quantityRestoringData.quantity',
|
|
192
|
+
label: 'Объём восстановленных данных',
|
|
193
|
+
defaultValue: 0,
|
|
194
|
+
uiProps: {
|
|
195
|
+
max: 9_999_999_900,
|
|
196
|
+
},
|
|
197
|
+
watchedControls: {
|
|
198
|
+
storageClass: 'storages[0].obs.storageClass',
|
|
199
|
+
unitsOfCalculation: 'storages[0].obs.quantityRestoringData.unitsOfCalculation',
|
|
200
|
+
},
|
|
201
|
+
relateFn: ({ storageClass, unitsOfCalculation }) => {
|
|
202
|
+
const uiProps: Partial<StepperControl['uiProps']> = {};
|
|
203
|
+
|
|
204
|
+
if (unitsOfCalculation === UnitsOfCalculationItem.Tb) {
|
|
205
|
+
uiProps.max = 9_765_620;
|
|
206
|
+
uiProps.postfix = 'ТБ';
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (storageClass !== StorageClassItem.Cold) {
|
|
210
|
+
uiProps.visible = false;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return { uiProps };
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
units: {
|
|
217
|
+
accessorKey: 'storages[0].obs.quantityRestoringData.unitsOfCalculation',
|
|
218
|
+
watchedControls: { storageClass: 'storages[0].obs.storageClass' },
|
|
219
|
+
|
|
220
|
+
relateFn: ({ storageClass }) => {
|
|
221
|
+
if (storageClass !== StorageClassItem.Cold) {
|
|
222
|
+
return {
|
|
223
|
+
uiProps: {
|
|
224
|
+
visible: false,
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
}),
|
|
231
|
+
},
|
|
232
|
+
};
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { CONTROL, FormConfig, SegmentedControl, StepperControl } from '../../../../components';
|
|
2
|
+
import { generateCpuItems, generateRamItems, getEip, getObs } from '../../../utils';
|
|
3
|
+
import { getDisk } from '../../../utils/diskPostgreSqlMySQL';
|
|
4
|
+
|
|
5
|
+
const BdInstanceTypeItem = {
|
|
6
|
+
Single: 'Single',
|
|
7
|
+
Replica: 'Replica',
|
|
8
|
+
PrimaryStandby: 'Primary/Standby',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const bdInstanceTypeItems = [
|
|
12
|
+
{
|
|
13
|
+
value: BdInstanceTypeItem.Single,
|
|
14
|
+
label: 'Single',
|
|
15
|
+
description: 'Одноузловая конфигурация',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: BdInstanceTypeItem.PrimaryStandby,
|
|
19
|
+
label: 'Primary/Standby',
|
|
20
|
+
description: 'Отказоустойчивый кластер высокой доступности',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const BdEngineVersionItem = {
|
|
25
|
+
General_Purpose: 'General Purpose',
|
|
26
|
+
Dedicated: 'Dedicated',
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
const bdEngineVersionItems = [
|
|
30
|
+
{
|
|
31
|
+
value: BdEngineVersionItem.Dedicated,
|
|
32
|
+
label: 'Dedicated',
|
|
33
|
+
description: `Инстансы имеют выделенные ресурсы процессора`,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: BdEngineVersionItem.General_Purpose,
|
|
37
|
+
label: 'General Purpose',
|
|
38
|
+
description: `Инстансы используют ресурсы процессора совместно с другими инстансами того же класса, размещенными на одном физическом сервере`,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const CpuRamByClassType: {
|
|
43
|
+
[instanceClass: string]: { [instanceType: string]: Record<string, number[]> };
|
|
44
|
+
} = {
|
|
45
|
+
[BdEngineVersionItem.Dedicated]: {
|
|
46
|
+
[BdInstanceTypeItem.Single]: {
|
|
47
|
+
'2': [4, 8],
|
|
48
|
+
'4': [8, 16],
|
|
49
|
+
'8': [16, 32],
|
|
50
|
+
'16': [64],
|
|
51
|
+
'32': [128],
|
|
52
|
+
'64': [256],
|
|
53
|
+
},
|
|
54
|
+
[BdInstanceTypeItem.PrimaryStandby]: {
|
|
55
|
+
'2': [4, 8],
|
|
56
|
+
'4': [8, 16],
|
|
57
|
+
'8': [16, 32],
|
|
58
|
+
'16': [64],
|
|
59
|
+
'32': [128],
|
|
60
|
+
'64': [256],
|
|
61
|
+
},
|
|
62
|
+
[BdInstanceTypeItem.Replica]: {
|
|
63
|
+
'2': [4, 8],
|
|
64
|
+
'4': [8, 16],
|
|
65
|
+
'8': [16, 32],
|
|
66
|
+
'16': [64],
|
|
67
|
+
'32': [128],
|
|
68
|
+
'64': [256],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
[BdEngineVersionItem.General_Purpose]: {
|
|
72
|
+
[BdInstanceTypeItem.Single]: {
|
|
73
|
+
'2': [4, 8],
|
|
74
|
+
'4': [8, 16],
|
|
75
|
+
'8': [16, 32],
|
|
76
|
+
},
|
|
77
|
+
[BdInstanceTypeItem.PrimaryStandby]: {
|
|
78
|
+
'2': [4, 8],
|
|
79
|
+
'4': [8, 16],
|
|
80
|
+
'8': [16, 32],
|
|
81
|
+
},
|
|
82
|
+
[BdInstanceTypeItem.Replica]: {
|
|
83
|
+
'2': [4, 8],
|
|
84
|
+
'4': [8, 16],
|
|
85
|
+
'8': [16, 32],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
type GetRdsControlsProps = {
|
|
91
|
+
prefix: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const getRdsControls = ({
|
|
95
|
+
prefix,
|
|
96
|
+
}: GetRdsControlsProps): {
|
|
97
|
+
cpu: SegmentedControl;
|
|
98
|
+
ram: SegmentedControl;
|
|
99
|
+
bdQuantity: StepperControl;
|
|
100
|
+
} => ({
|
|
101
|
+
cpu: {
|
|
102
|
+
type: CONTROL.Segmented,
|
|
103
|
+
accessorKey: `${prefix}.cpu`,
|
|
104
|
+
defaultValue: '2',
|
|
105
|
+
watchedControls: {
|
|
106
|
+
rdsBdEngineVersion: 'rds.bdInstanceClass',
|
|
107
|
+
rdsBdInstanceType: 'rds.bdInstanceType',
|
|
108
|
+
},
|
|
109
|
+
items: [],
|
|
110
|
+
decoratorProps: {
|
|
111
|
+
label: 'Количество vCPU',
|
|
112
|
+
labelTooltip: 'Виртуальный процессор',
|
|
113
|
+
},
|
|
114
|
+
relateFn: ({
|
|
115
|
+
rdsBdEngineVersion,
|
|
116
|
+
rdsBdInstanceType,
|
|
117
|
+
}: {
|
|
118
|
+
rdsBdEngineVersion: string;
|
|
119
|
+
rdsBdInstanceType: string;
|
|
120
|
+
}) => ({
|
|
121
|
+
items: generateCpuItems(
|
|
122
|
+
Object.entries(CpuRamByClassType[rdsBdEngineVersion][rdsBdInstanceType]).map(([key]) => Number(key)) ?? [],
|
|
123
|
+
),
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
ram: {
|
|
127
|
+
type: CONTROL.Segmented,
|
|
128
|
+
accessorKey: `${prefix}.ram`,
|
|
129
|
+
defaultValue: '4',
|
|
130
|
+
items: [],
|
|
131
|
+
decoratorProps: {
|
|
132
|
+
label: 'Объём RAM',
|
|
133
|
+
labelTooltip: 'Оперативная память',
|
|
134
|
+
},
|
|
135
|
+
watchedControls: {
|
|
136
|
+
cpu: `${prefix}.cpu`,
|
|
137
|
+
rdsBdEngineVersion: 'rds.bdInstanceClass',
|
|
138
|
+
rdsBdInstanceType: 'rds.bdInstanceType',
|
|
139
|
+
},
|
|
140
|
+
relateFn: ({
|
|
141
|
+
cpu,
|
|
142
|
+
rdsBdEngineVersion,
|
|
143
|
+
rdsBdInstanceType,
|
|
144
|
+
}: {
|
|
145
|
+
cpu: string;
|
|
146
|
+
rdsBdEngineVersion: string;
|
|
147
|
+
rdsBdInstanceType: string;
|
|
148
|
+
}) => ({
|
|
149
|
+
items: generateRamItems(CpuRamByClassType[rdsBdEngineVersion][rdsBdInstanceType][cpu] ?? []),
|
|
150
|
+
}),
|
|
151
|
+
},
|
|
152
|
+
bdQuantity: {
|
|
153
|
+
type: CONTROL.Stepper,
|
|
154
|
+
accessorKey: `${prefix}.bdQuantity`,
|
|
155
|
+
defaultValue: 1,
|
|
156
|
+
decoratorProps: {
|
|
157
|
+
label: 'Количество баз данных',
|
|
158
|
+
},
|
|
159
|
+
uiProps: {
|
|
160
|
+
min: 1,
|
|
161
|
+
max: 50,
|
|
162
|
+
postfix: 'Шт',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const rds = getRdsControls({ prefix: 'rds' });
|
|
168
|
+
const bdReplicaRds = getRdsControls({ prefix: 'bdReplica.rds' });
|
|
169
|
+
|
|
170
|
+
export const POSTGRE_SQL_DATA_BASE_FORM_CONFIG: FormConfig = {
|
|
171
|
+
ui: [
|
|
172
|
+
'rdsBdEngineVersion',
|
|
173
|
+
'rdsBdInstanceType',
|
|
174
|
+
'bdInstanceAlert',
|
|
175
|
+
['rdsCpu', 'rdsRam'],
|
|
176
|
+
['evs', 'rdsBdQuantity'],
|
|
177
|
+
'bdReplica',
|
|
178
|
+
'eip',
|
|
179
|
+
['obs'],
|
|
180
|
+
],
|
|
181
|
+
controls: {
|
|
182
|
+
rdsBdEngineVersion: {
|
|
183
|
+
type: CONTROL.Carousel,
|
|
184
|
+
accessorKey: 'rds.bdInstanceClass',
|
|
185
|
+
defaultValue: BdEngineVersionItem.Dedicated,
|
|
186
|
+
items: bdEngineVersionItems,
|
|
187
|
+
decoratorProps: {
|
|
188
|
+
label: 'Класс инстанса',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
rdsBdInstanceType: {
|
|
192
|
+
type: CONTROL.Carousel,
|
|
193
|
+
accessorKey: 'rds.bdInstanceType',
|
|
194
|
+
items: bdInstanceTypeItems,
|
|
195
|
+
defaultValue: BdInstanceTypeItem.Single,
|
|
196
|
+
decoratorProps: {
|
|
197
|
+
label: 'Режим развертывания',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
bdInstanceAlert: {
|
|
201
|
+
type: 'alert',
|
|
202
|
+
uiProps: {
|
|
203
|
+
appearance: 'info',
|
|
204
|
+
description:
|
|
205
|
+
'Данный режим подразумевает развертывание на двух инстансах — Primary и Standby. Конфигурация инстанса Primary дублируется для инстанса Standby. Стоимость в чеке указывается за 2 инстанса',
|
|
206
|
+
outline: true,
|
|
207
|
+
visible: false,
|
|
208
|
+
},
|
|
209
|
+
accessorKey: 'instances',
|
|
210
|
+
watchedControls: { bdInstanceType: 'rds.bdInstanceType' },
|
|
211
|
+
relateFn: ({ bdInstanceType }) => {
|
|
212
|
+
if (bdInstanceType === BdInstanceTypeItem.PrimaryStandby) {
|
|
213
|
+
return {
|
|
214
|
+
uiProps: {
|
|
215
|
+
visible: true,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
bdReplica: {
|
|
222
|
+
type: CONTROL.Object,
|
|
223
|
+
ui: ['replica'],
|
|
224
|
+
visible: true,
|
|
225
|
+
controls: {
|
|
226
|
+
replica: {
|
|
227
|
+
type: CONTROL.ToggleObject,
|
|
228
|
+
switchKey: 'bdReplicaIsNeeded',
|
|
229
|
+
decoratorProps: {
|
|
230
|
+
label: 'Реплика базы данных',
|
|
231
|
+
labelTooltip: 'Тип сервера реплики равен типу сервера базы данных',
|
|
232
|
+
},
|
|
233
|
+
control: {
|
|
234
|
+
type: CONTROL.Object,
|
|
235
|
+
ui: [
|
|
236
|
+
['cpu', 'ram'],
|
|
237
|
+
['systemDisk', 'bdQuantity'],
|
|
238
|
+
],
|
|
239
|
+
controls: {
|
|
240
|
+
cpu: {
|
|
241
|
+
...bdReplicaRds.cpu,
|
|
242
|
+
decoratorProps: {
|
|
243
|
+
...bdReplicaRds.cpu.decoratorProps,
|
|
244
|
+
labelTooltip: 'Количество vCPU реплики рекомендуется выбирать равное количеству основного RDS',
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
ram: {
|
|
248
|
+
...bdReplicaRds.ram,
|
|
249
|
+
decoratorProps: {
|
|
250
|
+
...bdReplicaRds.ram.decoratorProps,
|
|
251
|
+
labelTooltip: 'Объем RAM реплики рекомендуется выбирать равное количеству основного RDS',
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
bdQuantity: {
|
|
255
|
+
...bdReplicaRds.bdQuantity,
|
|
256
|
+
accessorKey: 'bdReplica.replicaQuantity',
|
|
257
|
+
decoratorProps: {
|
|
258
|
+
label: 'Количество реплик',
|
|
259
|
+
},
|
|
260
|
+
uiProps: {
|
|
261
|
+
min: 1,
|
|
262
|
+
max: 5,
|
|
263
|
+
postfix: 'Шт',
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
systemDisk: getDisk({
|
|
267
|
+
space: {
|
|
268
|
+
accessorKey: 'bdReplica.evs.systemDisk.diskSpace',
|
|
269
|
+
defaultValue: 40,
|
|
270
|
+
uiProps: {
|
|
271
|
+
min: 40,
|
|
272
|
+
max: 4000,
|
|
273
|
+
disabled: true,
|
|
274
|
+
},
|
|
275
|
+
decoratorProps: {
|
|
276
|
+
labelTooltip:
|
|
277
|
+
'SSD имеют высокую скорость передачи данных, что в два раза быстрее, чем HDD-накопители',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
specification: {
|
|
281
|
+
accessorKey: 'bdReplica.evs.systemDisk.specification',
|
|
282
|
+
defaultValue: 'Cloud SSD',
|
|
283
|
+
uiProps: { disabled: true },
|
|
284
|
+
},
|
|
285
|
+
}),
|
|
286
|
+
|
|
287
|
+
// Hidden
|
|
288
|
+
replicaQuantity: {
|
|
289
|
+
type: CONTROL.Stepper,
|
|
290
|
+
accessorKey: 'bdReplica.rds.bdQuantity',
|
|
291
|
+
defaultValue: 1,
|
|
292
|
+
decoratorProps: {
|
|
293
|
+
label: '',
|
|
294
|
+
},
|
|
295
|
+
uiProps: {
|
|
296
|
+
visible: false,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
// Hidden
|
|
301
|
+
evsAdditionalDisks: {
|
|
302
|
+
type: 'select-multiple',
|
|
303
|
+
accessorKey: 'bdReplica.evs.additionalDisks',
|
|
304
|
+
items: [],
|
|
305
|
+
defaultValue: [],
|
|
306
|
+
uiProps: {
|
|
307
|
+
visible: false,
|
|
308
|
+
},
|
|
309
|
+
decoratorProps: {
|
|
310
|
+
label: '',
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
rdsCpu: {
|
|
320
|
+
...rds.cpu,
|
|
321
|
+
onChangeFn: (value, setValue) => {
|
|
322
|
+
setValue([
|
|
323
|
+
['rds.cpu', value],
|
|
324
|
+
['bdReplica.rds.cpu', value],
|
|
325
|
+
]);
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
rdsRam: {
|
|
329
|
+
...rds.ram,
|
|
330
|
+
onChangeFn: (value, setValue) => {
|
|
331
|
+
setValue([
|
|
332
|
+
['rds.ram', value],
|
|
333
|
+
['bdReplica.rds.ram', value],
|
|
334
|
+
]);
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
rdsBdQuantity: rds.bdQuantity,
|
|
338
|
+
|
|
339
|
+
evs: getDisk({
|
|
340
|
+
space: {
|
|
341
|
+
accessorKey: 'evs.systemDisk.diskSpace',
|
|
342
|
+
defaultValue: 40,
|
|
343
|
+
uiProps: {
|
|
344
|
+
min: 40,
|
|
345
|
+
max: 4000,
|
|
346
|
+
},
|
|
347
|
+
onChangeFn: (value, setValue) => {
|
|
348
|
+
setValue([
|
|
349
|
+
['evs.systemDisk.diskSpace', value],
|
|
350
|
+
['bdReplica.evs.systemDisk.diskSpace', value],
|
|
351
|
+
]);
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
specification: {
|
|
355
|
+
accessorKey: 'evs.systemDisk.specification',
|
|
356
|
+
defaultValue: 'Cloud SSD',
|
|
357
|
+
onChangeFn: (value, setValue) => {
|
|
358
|
+
setValue([
|
|
359
|
+
['evs.systemDisk.specification', value],
|
|
360
|
+
['bdReplica.evs.systemDisk.specification', value],
|
|
361
|
+
]);
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
}),
|
|
365
|
+
eip: getEip({
|
|
366
|
+
trafficKey: 'eip.traffic',
|
|
367
|
+
}),
|
|
368
|
+
obs: getObs({
|
|
369
|
+
space: {
|
|
370
|
+
accessorKey: 'obs.storage.space',
|
|
371
|
+
defaultValue: 0,
|
|
372
|
+
},
|
|
373
|
+
units: {
|
|
374
|
+
accessorKey: 'obs.storage.unitsOfCalculation',
|
|
375
|
+
},
|
|
376
|
+
}),
|
|
377
|
+
|
|
378
|
+
// Hidden
|
|
379
|
+
evsAdditionalDisks: {
|
|
380
|
+
type: 'select-multiple',
|
|
381
|
+
accessorKey: 'evs.additionalDisks',
|
|
382
|
+
items: [],
|
|
383
|
+
defaultValue: [],
|
|
384
|
+
uiProps: {
|
|
385
|
+
visible: false,
|
|
386
|
+
},
|
|
387
|
+
decoratorProps: {
|
|
388
|
+
label: '',
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
// Hidden
|
|
392
|
+
ipQuantity: {
|
|
393
|
+
accessorKey: 'eip.ipQuantity',
|
|
394
|
+
type: CONTROL.Stepper,
|
|
395
|
+
defaultValue: 0,
|
|
396
|
+
decoratorProps: {},
|
|
397
|
+
uiProps: {
|
|
398
|
+
visible: false,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
};
|