@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.
Files changed (205) hide show
  1. package/CHANGELOG.md +1508 -0
  2. package/LICENSE +201 -0
  3. package/README.md +85 -0
  4. package/package.json +75 -0
  5. package/src/components/Calculator/Calculator.tsx +79 -0
  6. package/src/components/Calculator/index.ts +1 -0
  7. package/src/components/CalculatorContent/CalculatorContent.tsx +38 -0
  8. package/src/components/CalculatorContent/index.ts +1 -0
  9. package/src/components/CalculatorContent/styles.module.scss +79 -0
  10. package/src/components/Catalog/Catalog.tsx +225 -0
  11. package/src/components/Catalog/components/PrivateCardHeader.tsx +63 -0
  12. package/src/components/Catalog/components/index.ts +1 -0
  13. package/src/components/Catalog/components/styles.module.scss +35 -0
  14. package/src/components/Catalog/index.ts +1 -0
  15. package/src/components/Catalog/styles.module.scss +104 -0
  16. package/src/components/Controls/AlertControl/AlertControl.tsx +44 -0
  17. package/src/components/Controls/AlertControl/index.ts +1 -0
  18. package/src/components/Controls/ArrayControl/ArrayControl.tsx +105 -0
  19. package/src/components/Controls/ArrayControl/index.ts +1 -0
  20. package/src/components/Controls/ArrayControl/styles.module.scss +33 -0
  21. package/src/components/Controls/CarouselControl/CarouselControl.tsx +173 -0
  22. package/src/components/Controls/CarouselControl/index.ts +1 -0
  23. package/src/components/Controls/CarouselControl/styles.module.scss +32 -0
  24. package/src/components/Controls/Control/Control.tsx +205 -0
  25. package/src/components/Controls/Control/index.ts +1 -0
  26. package/src/components/Controls/ObjectControl/ObjectControl.tsx +150 -0
  27. package/src/components/Controls/ObjectControl/index.ts +1 -0
  28. package/src/components/Controls/ObjectControl/styles.module.scss +18 -0
  29. package/src/components/Controls/ObjectDecorator/ObjectDecorator.tsx +23 -0
  30. package/src/components/Controls/ObjectDecorator/index.ts +1 -0
  31. package/src/components/Controls/ObjectDecorator/styles.module.scss +15 -0
  32. package/src/components/Controls/SegmentedControl/SegmentedControl.tsx +79 -0
  33. package/src/components/Controls/SegmentedControl/SegmentedControlCard.tsx +38 -0
  34. package/src/components/Controls/SegmentedControl/index.ts +1 -0
  35. package/src/components/Controls/SegmentedControl/styles.module.scss +8 -0
  36. package/src/components/Controls/SelectControl/SelectControl.tsx +172 -0
  37. package/src/components/Controls/SelectControl/index.ts +1 -0
  38. package/src/components/Controls/SelectControl/styles.module.scss +5 -0
  39. package/src/components/Controls/SliderControl/SliderControl.tsx +92 -0
  40. package/src/components/Controls/SliderControl/index.ts +1 -0
  41. package/src/components/Controls/StepperControl/StepperControl.tsx +160 -0
  42. package/src/components/Controls/StepperControl/index.ts +1 -0
  43. package/src/components/Controls/StepperControl/styles.module.scss +16 -0
  44. package/src/components/Controls/TableControl/TableControl.tsx +162 -0
  45. package/src/components/Controls/TableControl/helperComponents/StepperWithAllowedValues.tsx +50 -0
  46. package/src/components/Controls/TableControl/helperComponents/index.ts +1 -0
  47. package/src/components/Controls/TableControl/helperComponents/styles.module.scss +53 -0
  48. package/src/components/Controls/TableControl/index.ts +1 -0
  49. package/src/components/Controls/TableControl/styles.module.scss +104 -0
  50. package/src/components/Controls/ToggleCard/ToggleCard.tsx +46 -0
  51. package/src/components/Controls/ToggleCard/index.ts +1 -0
  52. package/src/components/Controls/ToggleCard/styles.module.scss +11 -0
  53. package/src/components/Controls/ToggleCardsControl/ToggleCardsControl.tsx +93 -0
  54. package/src/components/Controls/ToggleCardsControl/index.ts +1 -0
  55. package/src/components/Controls/ToggleCardsControl/styles.module.scss +40 -0
  56. package/src/components/Controls/ToggleControl/ToggleControl.tsx +59 -0
  57. package/src/components/Controls/ToggleControl/components/SwitchRow.tsx +98 -0
  58. package/src/components/Controls/ToggleControl/components/index.ts +1 -0
  59. package/src/components/Controls/ToggleControl/components/styles.module.scss +110 -0
  60. package/src/components/Controls/ToggleControl/index.ts +1 -0
  61. package/src/components/Controls/ToggleObjectControl/ToggleObjectControl.tsx +111 -0
  62. package/src/components/Controls/ToggleObjectControl/index.ts +1 -0
  63. package/src/components/Controls/ToggleObjectControl/styles.module.scss +13 -0
  64. package/src/components/Controls/constants.ts +16 -0
  65. package/src/components/Controls/index.tsx +26 -0
  66. package/src/components/Controls/types.ts +181 -0
  67. package/src/components/Controls/utils.ts +49 -0
  68. package/src/components/Disclaimer/Disclaimer.tsx +33 -0
  69. package/src/components/Disclaimer/index.ts +1 -0
  70. package/src/components/Disclaimer/styles.module.scss +14 -0
  71. package/src/components/HeaderContainer/index.tsx +32 -0
  72. package/src/components/HeaderContainer/styles.module.scss +24 -0
  73. package/src/components/PriceSummary/PriceSummary.tsx +158 -0
  74. package/src/components/PriceSummary/components/PricePeriodSelect/PricePeriodSelect.tsx +81 -0
  75. package/src/components/PriceSummary/components/PricePeriodSelect/index.ts +1 -0
  76. package/src/components/PriceSummary/components/ProductCard/ProductCard.tsx +85 -0
  77. package/src/components/PriceSummary/components/ProductCard/index.ts +1 -0
  78. package/src/components/PriceSummary/components/ProductCard/styles.module.scss +7 -0
  79. package/src/components/PriceSummary/components/ProductListActions/ProductListActions.tsx +118 -0
  80. package/src/components/PriceSummary/components/ProductListActions/index.ts +1 -0
  81. package/src/components/PriceSummary/components/ProductListActions/styles.module.scss +38 -0
  82. package/src/components/PriceSummary/components/index.ts +3 -0
  83. package/src/components/PriceSummary/hooks.ts +36 -0
  84. package/src/components/PriceSummary/index.ts +1 -0
  85. package/src/components/PriceSummary/styles.module.scss +110 -0
  86. package/src/components/PriceSummary/utils/getTotalPrice.ts +19 -0
  87. package/src/components/PriceSummary/utils/index.ts +2 -0
  88. package/src/components/PriceSummary/utils/transformToProductCardData.ts +36 -0
  89. package/src/components/ProductHeadline/ProductPageHeadline.tsx +134 -0
  90. package/src/components/ProductHeadline/components/PriceCount.tsx +93 -0
  91. package/src/components/ProductHeadline/components/index.ts +1 -0
  92. package/src/components/ProductHeadline/components/styles.module.scss +52 -0
  93. package/src/components/ProductHeadline/index.ts +1 -0
  94. package/src/components/ProductHeadline/styles.module.scss +32 -0
  95. package/src/components/ProductPage/ProductPage.tsx +105 -0
  96. package/src/components/ProductPage/index.ts +1 -0
  97. package/src/components/ProductPage/styles.module.scss +13 -0
  98. package/src/components/Welcome/Welcome.tsx +138 -0
  99. package/src/components/Welcome/index.ts +1 -0
  100. package/src/components/Welcome/styles.module.scss +155 -0
  101. package/src/components/index.ts +3 -0
  102. package/src/config/config.tsx +27 -0
  103. package/src/config/index.ts +2 -0
  104. package/src/config/platforms/advanced/catalog.ts +82 -0
  105. package/src/config/platforms/advanced/constants.ts +23 -0
  106. package/src/config/platforms/advanced/index.ts +5 -0
  107. package/src/config/platforms/advanced/platform.tsx +13 -0
  108. package/src/config/platforms/advanced/product-config/AdvancedCloudBackup.ts +76 -0
  109. package/src/config/platforms/advanced/product-config/AdvancedCloudContainerEngine.tsx +260 -0
  110. package/src/config/platforms/advanced/product-config/AdvancedCloudServer.tsx +526 -0
  111. package/src/config/platforms/advanced/product-config/AdvancedDataAsYouUse.ts +159 -0
  112. package/src/config/platforms/advanced/product-config/AdvancedDataLakeInsight.ts +134 -0
  113. package/src/config/platforms/advanced/product-config/AdvancedDataWarehouseService.ts +94 -0
  114. package/src/config/platforms/advanced/product-config/AdvancedDcsMemcached.ts +69 -0
  115. package/src/config/platforms/advanced/product-config/AdvancedDcsRedis.ts +220 -0
  116. package/src/config/platforms/advanced/product-config/AdvancedDmsKafka.tsx +186 -0
  117. package/src/config/platforms/advanced/product-config/AdvancedDmsRabbitMq.ts +202 -0
  118. package/src/config/platforms/advanced/product-config/AdvancedDocumentDatabase.tsx +323 -0
  119. package/src/config/platforms/advanced/product-config/AdvancedElasticLoadBalance.tsx +252 -0
  120. package/src/config/platforms/advanced/product-config/AdvancedElasticSearch.ts +365 -0
  121. package/src/config/platforms/advanced/product-config/AdvancedFunctionGraph.tsx +65 -0
  122. package/src/config/platforms/advanced/product-config/AdvancedMapReduce.tsx +394 -0
  123. package/src/config/platforms/advanced/product-config/AdvancedMySqlDataBase.ts +417 -0
  124. package/src/config/platforms/advanced/product-config/AdvancedNetwork.ts +146 -0
  125. package/src/config/platforms/advanced/product-config/AdvancedObjectStorage.ts +232 -0
  126. package/src/config/platforms/advanced/product-config/AdvancedPostgreSqlDatabase.ts +402 -0
  127. package/src/config/platforms/advanced/product-config/AdvancedScalableFile.tsx +161 -0
  128. package/src/config/platforms/advanced/product-config/AdvancedSqlDatabase.ts +380 -0
  129. package/src/config/platforms/advanced/product-config/index.ts +21 -0
  130. package/src/config/platforms/advanced/products.ts +267 -0
  131. package/src/config/platforms/evolution/catalog.tsx +107 -0
  132. package/src/config/platforms/evolution/constants.ts +80 -0
  133. package/src/config/platforms/evolution/index.ts +5 -0
  134. package/src/config/platforms/evolution/platform.tsx +13 -0
  135. package/src/config/platforms/evolution/product-config/EvolutionArenadataDb.ts +151 -0
  136. package/src/config/platforms/evolution/product-config/EvolutionArtifactRegistry.ts +57 -0
  137. package/src/config/platforms/evolution/product-config/EvolutionBareMetal.tsx +172 -0
  138. package/src/config/platforms/evolution/product-config/EvolutionCloudServer.tsx +407 -0
  139. package/src/config/platforms/evolution/product-config/EvolutionCloudServerFreeTier.tsx +185 -0
  140. package/src/config/platforms/evolution/product-config/EvolutionCloudServerGpu.tsx +301 -0
  141. package/src/config/platforms/evolution/product-config/EvolutionContainerApps.ts +84 -0
  142. package/src/config/platforms/evolution/product-config/EvolutionContainerAppsFreeTier.ts +29 -0
  143. package/src/config/platforms/evolution/product-config/EvolutionKubernetes.ts +388 -0
  144. package/src/config/platforms/evolution/product-config/EvolutionManagedMetastore.ts +38 -0
  145. package/src/config/platforms/evolution/product-config/EvolutionManagedRedis.ts +161 -0
  146. package/src/config/platforms/evolution/product-config/EvolutionManagedSpark.ts +360 -0
  147. package/src/config/platforms/evolution/product-config/EvolutionManagedTrino.ts +53 -0
  148. package/src/config/platforms/evolution/product-config/EvolutionMlInference.tsx +703 -0
  149. package/src/config/platforms/evolution/product-config/EvolutionPostgreSql.ts +217 -0
  150. package/src/config/platforms/evolution/product-config/EvolutionPublicIp.ts +39 -0
  151. package/src/config/platforms/evolution/product-config/EvolutionSnatGateway.ts +22 -0
  152. package/src/config/platforms/evolution/product-config/EvolutionStorageS3.ts +223 -0
  153. package/src/config/platforms/evolution/product-config/EvolutionStorageS3FreeTier.ts +97 -0
  154. package/src/config/platforms/evolution/product-config/index.ts +17 -0
  155. package/src/config/platforms/evolution/products.ts +260 -0
  156. package/src/config/platforms/index.ts +3 -0
  157. package/src/config/platforms/vmware/catalog.ts +19 -0
  158. package/src/config/platforms/vmware/constants.ts +6 -0
  159. package/src/config/platforms/vmware/index.ts +5 -0
  160. package/src/config/platforms/vmware/platform.tsx +13 -0
  161. package/src/config/platforms/vmware/product-config/VmWareCloudBackup.ts +56 -0
  162. package/src/config/platforms/vmware/product-config/VmWareVirtualDataCenter.ts +309 -0
  163. package/src/config/platforms/vmware/product-config/VmWareVirtualMachinesBackup.ts +58 -0
  164. package/src/config/platforms/vmware/product-config/VmWareVirtualWorkspaces.tsx +210 -0
  165. package/src/config/platforms/vmware/product-config/index.ts +4 -0
  166. package/src/config/platforms/vmware/products.ts +63 -0
  167. package/src/config/styles.module.scss +9 -0
  168. package/src/config/utils/disk.ts +94 -0
  169. package/src/config/utils/diskPostgreSqlMySQL.ts +94 -0
  170. package/src/config/utils/eip.ts +104 -0
  171. package/src/config/utils/index.ts +52 -0
  172. package/src/config/utils/obs.ts +100 -0
  173. package/src/constants.ts +56 -0
  174. package/src/contexts/CalculatorContext.tsx +193 -0
  175. package/src/contexts/ProductContext.ts +25 -0
  176. package/src/contexts/index.ts +2 -0
  177. package/src/hooks/index.ts +6 -0
  178. package/src/hooks/useAdaptive.ts +20 -0
  179. package/src/hooks/useCatalogCardClick.ts +37 -0
  180. package/src/hooks/useProductClick.ts +14 -0
  181. package/src/hooks/useProductDelete.ts +46 -0
  182. package/src/index.ts +6 -0
  183. package/src/services/constants.ts +5 -0
  184. package/src/services/getFetcherFn.ts +57 -0
  185. package/src/services/getInitPrice.ts +64 -0
  186. package/src/services/getOnDownloadFileClick.ts +37 -0
  187. package/src/services/getOnShareClick.ts +56 -0
  188. package/src/services/index.ts +4 -0
  189. package/src/types/CalculatorType.ts +16 -0
  190. package/src/types/CatalogConfig.ts +13 -0
  191. package/src/types/Category.ts +14 -0
  192. package/src/types/FetcherFn.ts +26 -0
  193. package/src/types/FormValues.ts +4 -0
  194. package/src/types/Platform.ts +24 -0
  195. package/src/types/Price.ts +18 -0
  196. package/src/types/Product.ts +39 -0
  197. package/src/types/ProductState.ts +11 -0
  198. package/src/types/State.ts +7 -0
  199. package/src/types/index.ts +10 -0
  200. package/src/utils/filterNonEmptyArrays.ts +13 -0
  201. package/src/utils/formatNumber.ts +5 -0
  202. package/src/utils/getPrice.ts +38 -0
  203. package/src/utils/index.ts +5 -0
  204. package/src/utils/parseKeyToDataTest.ts +14 -0
  205. package/src/utils/value.ts +11 -0
@@ -0,0 +1,388 @@
1
+ import { CONTROL, FormConfig } from '../../../../components';
2
+ import { generateCpuItems, generateInstanceConfigItems, generateRamItems } from '../../../utils';
3
+
4
+ const nodeConfigItems = generateInstanceConfigItems([
5
+ [2, 4],
6
+ [4, 8],
7
+ [8, 16],
8
+ [16, 32],
9
+ ]);
10
+
11
+ const masterNodeCount = generateCpuItems([1, 3, 5]);
12
+
13
+ const GuaranteedPartItem = {
14
+ '10': '10',
15
+ '30': '30',
16
+ '100': '100',
17
+ };
18
+
19
+ const NVIDIA_A100_80GB = {
20
+ value: 'NVIDIA A100 80GB',
21
+ label: 'NVIDIA A100 80GB',
22
+ };
23
+
24
+ const NVIDIA_H100_NVLINK_ITEM = {
25
+ value: 'NVIDIA H100 NVLink',
26
+ label: 'NVIDIA H100 NVLink',
27
+ };
28
+ const NVIDIA_H100_NVLINK_ITEM_PCIe = {
29
+ value: 'NVIDIA H100 PCI',
30
+ label: 'NVIDIA H100 PCI',
31
+ };
32
+
33
+ const NVIDIA_V100 = {
34
+ value: 'NVIDIA V100',
35
+ label: 'NVIDIA V100',
36
+ };
37
+
38
+ const MODEL_ITEMS = [NVIDIA_A100_80GB, NVIDIA_H100_NVLINK_ITEM, NVIDIA_H100_NVLINK_ITEM_PCIe, NVIDIA_V100];
39
+
40
+ const guaranteedPartCards = [
41
+ {
42
+ value: GuaranteedPartItem[10],
43
+ label: '10% доля',
44
+ description: 'Для тестирования и несложных приложений',
45
+ },
46
+ {
47
+ value: GuaranteedPartItem[30],
48
+ label: '30% доля',
49
+ description: 'Для стандартной рабочей нагрузки',
50
+ },
51
+ {
52
+ value: GuaranteedPartItem[100],
53
+ label: '100% доля',
54
+ description: 'Для высоконагруженных сервисов',
55
+ },
56
+ ];
57
+
58
+ const guaranteedPartToVCpuMap = {
59
+ [GuaranteedPartItem[10]]: [2, 4, 8],
60
+ [GuaranteedPartItem[30]]: [2, 4, 8, 16, 24, 32],
61
+ [GuaranteedPartItem[100]]: [2, 4, 8, 16, 24, 32],
62
+ };
63
+
64
+ const guaranteedPartVCpuToRamMap: Record<string, Record<string, number[]>> = {
65
+ [GuaranteedPartItem[10]]: {
66
+ '2': [4],
67
+ '4': [8, 16, 32],
68
+ '8': [16, 32],
69
+ },
70
+ [GuaranteedPartItem[30]]: {
71
+ '2': [4],
72
+ '4': [8, 16, 32, 64],
73
+ '8': [16, 32, 64],
74
+ '16': [32, 64],
75
+ '24': [48],
76
+ '32': [64],
77
+ },
78
+ [GuaranteedPartItem[100]]: {
79
+ '2': [4],
80
+ '4': [8, 16, 32, 64],
81
+ '8': [16, 32, 64, 128],
82
+ '16': [32, 64, 128, 256],
83
+ '24': [48],
84
+ '32': [64, 128, 256],
85
+ },
86
+ };
87
+
88
+ const GPU_BY_MODEL: { [model: string]: number[] } = {
89
+ [NVIDIA_A100_80GB.value]: [1, 2, 3, 4, 5, 6, 7, 8],
90
+ [NVIDIA_H100_NVLINK_ITEM.value]: [1, 2, 3, 4, 5, 6, 7, 8],
91
+ [NVIDIA_H100_NVLINK_ITEM_PCIe.value]: [1, 2, 3, 4, 5, 6, 7, 8],
92
+ [NVIDIA_V100.value]: [1, 2, 4, 8, 16],
93
+ };
94
+
95
+ const CPU_BY_MODEL_AND_GPU: { [model: string]: { [gpu: string]: number[] } } = {
96
+ [NVIDIA_A100_80GB.value]: {
97
+ '1': [20],
98
+ '2': [40],
99
+ '3': [60],
100
+ '4': [80],
101
+ '5': [100],
102
+ '6': [120],
103
+ '7': [140],
104
+ '8': [160],
105
+ },
106
+ [NVIDIA_H100_NVLINK_ITEM.value]: {
107
+ '1': [20],
108
+ '2': [40],
109
+ '3': [60],
110
+ '4': [80],
111
+ '5': [100],
112
+ '6': [120],
113
+ '7': [140],
114
+ '8': [160],
115
+ },
116
+ [NVIDIA_H100_NVLINK_ITEM_PCIe.value]: {
117
+ '1': [20],
118
+ '2': [40],
119
+ '3': [60],
120
+ '4': [80],
121
+ '5': [100],
122
+ '6': [120],
123
+ '7': [140],
124
+ '8': [160],
125
+ },
126
+ [NVIDIA_V100.value]: {
127
+ '1': [4],
128
+ '2': [8],
129
+ '4': [16],
130
+ '8': [32],
131
+ '16': [64],
132
+ },
133
+ };
134
+
135
+ const RAN_BY_MODEL_AND_GPU: { [model: string]: { [gpu: string]: number[] } } = {
136
+ [NVIDIA_A100_80GB.value]: {
137
+ '1': [125],
138
+ '2': [250],
139
+ '3': [375],
140
+ '4': [500],
141
+ '5': [625],
142
+ '6': [750],
143
+ '7': [875],
144
+ '8': [900],
145
+ },
146
+ [NVIDIA_H100_NVLINK_ITEM.value]: {
147
+ '1': [186],
148
+ '2': [372],
149
+ '3': [558],
150
+ '4': [744],
151
+ '5': [930],
152
+ '6': [1116],
153
+ '7': [1302],
154
+ '8': [1488],
155
+ },
156
+ [NVIDIA_H100_NVLINK_ITEM_PCIe.value]: {
157
+ '1': [125],
158
+ '2': [250],
159
+ '3': [375],
160
+ '4': [500],
161
+ '5': [625],
162
+ '6': [750],
163
+ '7': [875],
164
+ '8': [900],
165
+ },
166
+ [NVIDIA_V100.value]: {
167
+ '1': [64],
168
+ '2': [128],
169
+ '4': [256],
170
+ '8': [512],
171
+ '16': [1024],
172
+ },
173
+ };
174
+
175
+ export const EVOLUTION_KUBERNETES_FORM_CONFIG: FormConfig = {
176
+ ui: ['masterNode', 'workerNode', 'bindingPublicIpAddress'],
177
+ controls: {
178
+ masterNode: {
179
+ ui: [['masterNodeConfig', 'masterNodeCount']],
180
+ type: CONTROL.Object,
181
+ decoratorProps: {
182
+ label: 'Мастер-узел',
183
+ },
184
+ controls: {
185
+ masterNodeConfig: {
186
+ type: CONTROL.SelectSingle,
187
+ accessorKey: 'masterNode.nodeConfig',
188
+ items: nodeConfigItems,
189
+ decoratorProps: {
190
+ label: 'Конфигурация мастер-узла',
191
+ },
192
+ defaultValue: '2 4',
193
+ },
194
+ masterNodeCount: {
195
+ type: CONTROL.Segmented,
196
+ accessorKey: 'masterNode.nodeCount',
197
+ defaultValue: masterNodeCount[0].value,
198
+ items: masterNodeCount,
199
+ decoratorProps: {
200
+ label: 'Количество мастер-узлов',
201
+ },
202
+ },
203
+ },
204
+ },
205
+ workerNode: {
206
+ type: CONTROL.ToggleObject,
207
+ switchKey: 'workerNodeNeeded',
208
+ decoratorProps: {
209
+ label: 'Узлы для запуска контейнера',
210
+ },
211
+ control: {
212
+ type: CONTROL.Object,
213
+ ui: [
214
+ 'hasGpu',
215
+ ['gpuModel'],
216
+ 'gpuCount',
217
+ 'guaranteedPart',
218
+ ['vCpuCount', 'ramAmount'],
219
+ ['nodeCount'],
220
+ ['diskSize'],
221
+ ],
222
+ decoratorProps: {
223
+ label: 'Рабочие узлы',
224
+ },
225
+ controls: {
226
+ hasGpu: {
227
+ type: CONTROL.Toggle,
228
+ accessorKey: 'workerNode.hasGpu',
229
+ defaultValue: false,
230
+ decoratorProps: {
231
+ label: 'Графический процессор (GPU)',
232
+ },
233
+ },
234
+ gpuModel: {
235
+ type: CONTROL.SelectSingle,
236
+ accessorKey: 'workerNode.gpuModel',
237
+ defaultValue: MODEL_ITEMS[0].value,
238
+ items: MODEL_ITEMS,
239
+ uiProps: {
240
+ visible: false,
241
+ },
242
+ decoratorProps: {
243
+ label: 'Модель GPU',
244
+ },
245
+ watchedControls: {
246
+ hasGpu: 'workerNode.hasGpu',
247
+ },
248
+ relateFn: ({ hasGpu }) => ({
249
+ uiProps: {
250
+ visible: hasGpu,
251
+ },
252
+ }),
253
+ },
254
+ gpuCount: {
255
+ type: CONTROL.Slider,
256
+ accessorKey: 'workerNode.gpuCount',
257
+ defaultValue: '1',
258
+ items: GPU_BY_MODEL[0],
259
+ decoratorProps: {
260
+ label: 'Количество GPU',
261
+ },
262
+ uiProps: {
263
+ visible: false,
264
+ step: 1,
265
+ },
266
+ watchedControls: {
267
+ hasGpu: 'workerNode.hasGpu',
268
+ gpuModel: 'workerNode.gpuModel',
269
+ },
270
+ relateFn: ({ hasGpu, gpuModel }) => ({
271
+ uiProps: {
272
+ visible: hasGpu,
273
+ },
274
+ items: GPU_BY_MODEL[gpuModel],
275
+ }),
276
+ },
277
+ guaranteedPart: {
278
+ type: CONTROL.Carousel,
279
+ accessorKey: 'workerNode.guaranteedPart',
280
+ defaultValue: guaranteedPartCards[0].value,
281
+ items: guaranteedPartCards,
282
+ decoratorProps: {
283
+ label: 'Гарантированная доля vCPU',
284
+ labelTooltip:
285
+ 'Гарантированная доля vCPU определяет долю использования процессора, выделенную для виртуальной машины. Этот параметр известен также как переподписка vCPU (vCPU Overcommitment). При 100% гарантируется использование полной мощности виртуальных ядер процессора хоста виртуализации, выделенных виртуальной машине.',
286
+ },
287
+ watchedControls: {
288
+ hasGpu: 'workerNode.hasGpu',
289
+ },
290
+ relateFn: ({ hasGpu }) => ({
291
+ items: hasGpu ? [guaranteedPartCards[guaranteedPartCards.length - 1]] : guaranteedPartCards,
292
+ }),
293
+ },
294
+ vCpuCount: {
295
+ type: CONTROL.Slider,
296
+ accessorKey: 'workerNode.vCpuCount',
297
+ defaultValue: '2',
298
+ items: [2, 4, 8],
299
+ decoratorProps: {
300
+ label: 'Количество ядер vCPU',
301
+ labelTooltip: 'Виртуальные ядра',
302
+ },
303
+ watchedControls: {
304
+ guaranteedPart: 'workerNode.guaranteedPart',
305
+ hasGpu: 'workerNode.hasGpu',
306
+ gpuModel: 'workerNode.gpuModel',
307
+ gpuCount: 'workerNode.gpuCount',
308
+ },
309
+ relateFn: ({ guaranteedPart, hasGpu, gpuModel, gpuCount }) => {
310
+ const items = hasGpu
311
+ ? CPU_BY_MODEL_AND_GPU[gpuModel][String(gpuCount)]
312
+ : guaranteedPartToVCpuMap?.[guaranteedPart];
313
+
314
+ if (items?.length > 0) {
315
+ return {
316
+ items,
317
+ };
318
+ }
319
+ },
320
+ },
321
+ ramAmount: {
322
+ type: CONTROL.Segmented,
323
+ accessorKey: 'workerNode.ramAmount',
324
+ defaultValue: '4',
325
+ items: generateRamItems([4]),
326
+ decoratorProps: {
327
+ label: 'Количество оперативной памяти RAM',
328
+ },
329
+ watchedControls: {
330
+ guaranteedPart: 'workerNode.guaranteedPart',
331
+ vCpuCoreCount: 'workerNode.vCpuCount',
332
+ hasGpu: 'workerNode.hasGpu',
333
+ gpuCount: 'workerNode.gpuCount',
334
+ gpuModel: 'workerNode.gpuModel',
335
+ },
336
+ relateFn: ({ guaranteedPart, vCpuCoreCount, gpuModel, hasGpu, gpuCount }) => {
337
+ const items = hasGpu
338
+ ? RAN_BY_MODEL_AND_GPU[gpuModel][String(gpuCount)]
339
+ : guaranteedPartVCpuToRamMap?.[guaranteedPart]?.[vCpuCoreCount];
340
+
341
+ if (items?.length > 0) {
342
+ return {
343
+ items: generateRamItems(items),
344
+ };
345
+ }
346
+ },
347
+ },
348
+ nodeCount: {
349
+ type: CONTROL.Stepper,
350
+ accessorKey: 'workerNode.nodeCount',
351
+ defaultValue: 1,
352
+ decoratorProps: {
353
+ label: 'Количество узлов',
354
+ },
355
+ uiProps: {
356
+ min: 1,
357
+ max: 50,
358
+ postfix: 'Шт',
359
+ },
360
+ },
361
+ diskSize: {
362
+ type: CONTROL.Stepper,
363
+ accessorKey: 'workerNode.diskSize',
364
+ defaultValue: 10,
365
+ decoratorProps: {
366
+ label: 'Диск',
367
+ },
368
+ uiProps: {
369
+ min: 10,
370
+ max: 64,
371
+ postfix: 'ГБ',
372
+ },
373
+ },
374
+ },
375
+ },
376
+ },
377
+ bindingPublicIpAddress: {
378
+ type: CONTROL.Toggle,
379
+ accessorKey:
380
+ // Так специально
381
+ 'bindingPublickIpAddress',
382
+ defaultValue: false,
383
+ decoratorProps: {
384
+ label: 'Аренда публичного IP',
385
+ },
386
+ },
387
+ },
388
+ };
@@ -0,0 +1,38 @@
1
+ import { CONTROL, FormConfig } from '../../../../components';
2
+ import { generateCpuItems, generateRamItems } from '../../../utils';
3
+
4
+ export const EVOLUTION_MANAGED_METASTORE_CONFIG: FormConfig = {
5
+ ui: [['vCpuCoreCount', 'ramAmount'], 'alert'],
6
+ controls: {
7
+ alert: {
8
+ type: CONTROL.Alert,
9
+ uiProps: {
10
+ description:
11
+ 'Для хранения информации об операциях инстанс можно подключить к внешнему S3 или к Evolution Object Storage',
12
+ },
13
+ accessorKey: 'free',
14
+ },
15
+ vCpuCoreCount: {
16
+ type: CONTROL.Segmented,
17
+ accessorKey: 'vCpuCoreCount',
18
+ defaultValue: '2',
19
+ items: generateCpuItems([2]),
20
+ decoratorProps: {
21
+ label: 'Количество ядер vCPU',
22
+ labelTooltip: 'Количество ядер vCPU',
23
+ },
24
+ },
25
+ ramAmount: {
26
+ type: CONTROL.Segmented,
27
+ accessorKey: 'ramAmount',
28
+ defaultValue: '4',
29
+ items: generateRamItems([4]),
30
+ decoratorProps: {
31
+ label: 'Количество оперативной памяти (RAM)',
32
+ },
33
+ uiProps: {
34
+ disabled: true,
35
+ },
36
+ },
37
+ },
38
+ };
@@ -0,0 +1,161 @@
1
+ import { CONTROL, FormConfig } from '../../../../components';
2
+ import { generateCpuItems, generateInstanceConfigItems, getDisk } from '../../../utils';
3
+ import { DeploymentMode, deploymentModes } from '../constants';
4
+
5
+ const nodeConfigItems = generateInstanceConfigItems([
6
+ [2, 4],
7
+ [4, 16],
8
+ [8, 32],
9
+ ]);
10
+
11
+ const valueMasterReplica = 'Master/Replica';
12
+ const valueCluster = 'Cluster';
13
+ const valueStandalone = 'Standalone';
14
+
15
+ const DEFAULT_ITEMS_SLIDER = [1, 2, 3, 4, 5];
16
+
17
+ const shardQuantityItemsByInstantType: { [key: string]: number[] } = {
18
+ [valueStandalone]: [1],
19
+ [valueMasterReplica]: [1],
20
+ [valueCluster]: [3, 4, 5],
21
+ };
22
+
23
+ type ReplicaQuantityItemsByInstant = {
24
+ values: number[];
25
+ label: string;
26
+ visible?: boolean;
27
+ };
28
+
29
+ const replicaQuantityItemsByInstantType: { [key: string]: ReplicaQuantityItemsByInstant } = {
30
+ [valueStandalone]: { values: [0], label: 'Количество реплик', visible: false },
31
+ [valueMasterReplica]: { values: DEFAULT_ITEMS_SLIDER, label: 'Количество реплик' },
32
+ [valueCluster]: { values: DEFAULT_ITEMS_SLIDER, label: 'Количество реплик на шард' },
33
+ };
34
+
35
+ const instanceTypePartCards = [
36
+ {
37
+ value: valueStandalone,
38
+ label: valueStandalone,
39
+ description: 'Одноузловая конфигурация',
40
+ },
41
+ {
42
+ value: valueMasterReplica,
43
+ label: valueMasterReplica,
44
+ description: 'Отказоустойчивый кластер высокой доступности',
45
+ },
46
+ {
47
+ value: valueCluster,
48
+ label: valueCluster,
49
+ description: 'Отказоустойчивый кластер высокой доступности с шардированием',
50
+ },
51
+ ];
52
+
53
+ export const EVOLUTION_MANAGED_REDIS_CONFIG: FormConfig = {
54
+ ui: ['deploymentMode', 'instanceType', ['masterNodeConfig', 'shardQuantity'], ['replicaQuantity'], ['systemDisk']],
55
+ controls: {
56
+ deploymentMode: {
57
+ type: CONTROL.Carousel,
58
+ accessorKey: 'deploymentMode',
59
+ defaultValue: DeploymentMode.Business,
60
+ uiProps: {
61
+ visible: false,
62
+ },
63
+ items: deploymentModes,
64
+ decoratorProps: {
65
+ label: 'Режим развертывания',
66
+ labelTooltip: 'Режимы развертывания кластера отличаются объемом ресурсов и уровнем безопасности',
67
+ },
68
+ },
69
+ instanceType: {
70
+ decoratorProps: {
71
+ label: 'Тип инстанса',
72
+ },
73
+ type: CONTROL.Carousel,
74
+ accessorKey: 'instanceType',
75
+ defaultValue: instanceTypePartCards[0].value,
76
+ items: instanceTypePartCards,
77
+ onChangeFn: (value, setValue) => {
78
+ if (value === valueStandalone) {
79
+ setValue([
80
+ ['instanceType', value],
81
+ ['replicaQuantity', '0'],
82
+ ]);
83
+ } else {
84
+ setValue([
85
+ ['instanceType', value],
86
+ ['replicaQuantity', '1'],
87
+ ]);
88
+ }
89
+ },
90
+ },
91
+ masterNodeConfig: {
92
+ type: CONTROL.SelectSingle,
93
+ accessorKey: 'masterNode.nodeConfig',
94
+ items: nodeConfigItems,
95
+ decoratorProps: {
96
+ label: 'Конфигурация',
97
+ },
98
+ defaultValue: '2 4',
99
+ },
100
+ shardQuantity: {
101
+ type: CONTROL.Segmented,
102
+ decoratorProps: {
103
+ label: 'Количество шардов',
104
+ },
105
+ defaultValue: '1',
106
+ items: generateCpuItems([1]),
107
+ accessorKey: 'shardQuantity',
108
+ watchedControls: { instanceType: 'instanceType' },
109
+ relateFn: ({ instanceType }) => {
110
+ const items = shardQuantityItemsByInstantType[instanceType];
111
+
112
+ if (items?.length > 0) {
113
+ return {
114
+ items: generateCpuItems(items),
115
+ };
116
+ }
117
+ },
118
+ },
119
+ replicaQuantity: {
120
+ type: CONTROL.Slider,
121
+ accessorKey: 'replicaQuantity',
122
+ defaultValue: '0',
123
+ items: DEFAULT_ITEMS_SLIDER,
124
+ decoratorProps: {
125
+ label: 'Количество реплик',
126
+ },
127
+ watchedControls: { instanceType: 'instanceType' },
128
+ relateFn: ({ instanceType }) => {
129
+ const item = replicaQuantityItemsByInstantType[instanceType];
130
+
131
+ return {
132
+ items: item.values,
133
+ uiProps: {
134
+ visible: item.visible,
135
+ },
136
+ decoratorProps: {
137
+ label: item.label,
138
+ },
139
+ };
140
+ },
141
+ },
142
+ systemDisk: getDisk({
143
+ space: {
144
+ label: 'Диск',
145
+ accessorKey: 'diskCapacity',
146
+ defaultValue: 40,
147
+ uiProps: {
148
+ min: 40,
149
+ max: 16_384,
150
+ },
151
+ },
152
+ specification: {
153
+ accessorKey: 'specification',
154
+ defaultValue: 'SSD',
155
+ uiProps: {
156
+ disabled: true,
157
+ },
158
+ },
159
+ }),
160
+ },
161
+ };