@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,360 @@
1
+ import { CONTROL, FormConfig } from '../../../../components';
2
+ import { generateRamItems } from '../../../utils';
3
+
4
+ const VCPU_CORE_ITEMS_WITHOUT_GPU = [4, 8, 16];
5
+
6
+ const VCPU_NO_MODEL_GPU: { [key: string]: number[] } = {
7
+ '4': [8, 16, 32, 64],
8
+ '8': [16, 32, 64, 128],
9
+ '16': [32, 64],
10
+ '24': [32],
11
+ };
12
+
13
+ const NVIDIA_H100_NVLINK_ITEM = {
14
+ value: 'NVIDIA H100 NVLink',
15
+ label: 'NVIDIA H100 NVLink',
16
+ };
17
+
18
+ const NVIDIA_H100_NVLINK_ITEM_WITHOUT = {
19
+ value: 'NVIDIA H100 PCI without NVLink',
20
+ label: 'NVIDIA H100 PCI без NVLink',
21
+ };
22
+
23
+ const NVIDIA_V100 = {
24
+ value: 'NVIDIA V100',
25
+ label: 'NVIDIA V100',
26
+ };
27
+
28
+ const NVIDIA_A100_WITHOUT = {
29
+ value: 'NVIDIA A100 PCI without NVLink',
30
+ label: 'NVIDIA A100 80Гб PCI без NVLink',
31
+ };
32
+
33
+ const MODEL_ITEMS = [NVIDIA_H100_NVLINK_ITEM_WITHOUT, NVIDIA_V100, NVIDIA_H100_NVLINK_ITEM, NVIDIA_A100_WITHOUT];
34
+
35
+ const GPU_BY_MODEL: { [model: string]: number[] } = {
36
+ [NVIDIA_H100_NVLINK_ITEM.value]: [1, 2, 3, 4, 5, 6, 7, 8],
37
+ [NVIDIA_H100_NVLINK_ITEM_WITHOUT.value]: [1, 2, 3, 4, 5, 6, 7, 8],
38
+ [NVIDIA_V100.value]: [1, 2, 4, 8, 16],
39
+ [NVIDIA_A100_WITHOUT.value]: [1, 2, 3, 4, 5, 6, 7, 8],
40
+ };
41
+
42
+ const CPU_BY_MODEL_AND_GPU: { [model: string]: { [gpu: string]: number[] } } = {
43
+ [NVIDIA_H100_NVLINK_ITEM.value]: {
44
+ '1': [20],
45
+ '2': [40],
46
+ '3': [60],
47
+ '4': [80],
48
+ '5': [100],
49
+ '6': [120],
50
+ '7': [140],
51
+ '8': [160],
52
+ },
53
+ [NVIDIA_H100_NVLINK_ITEM_WITHOUT.value]: {
54
+ '1': [20],
55
+ '2': [40],
56
+ '3': [60],
57
+ '4': [80],
58
+ '5': [100],
59
+ '6': [120],
60
+ '7': [140],
61
+ '8': [160],
62
+ },
63
+ [NVIDIA_V100.value]: {
64
+ '1': [4],
65
+ '2': [8],
66
+ '4': [16],
67
+ '8': [32],
68
+ '16': [64],
69
+ },
70
+ [NVIDIA_A100_WITHOUT.value]: {
71
+ '1': [20],
72
+ '2': [40],
73
+ '3': [60],
74
+ '4': [80],
75
+ '5': [100],
76
+ '6': [120],
77
+ '7': [140],
78
+ '8': [160],
79
+ },
80
+ };
81
+
82
+ const RAM_BY_MODEL_AND_CPU: { [model: string]: { [cpu: string]: number[] } } = {
83
+ [NVIDIA_H100_NVLINK_ITEM.value]: {
84
+ '20': [186],
85
+ '40': [372],
86
+ '60': [558],
87
+ '80': [744],
88
+ '100': [930],
89
+ '120': [1116],
90
+ '140': [1302],
91
+ '160': [1488],
92
+ },
93
+ [NVIDIA_H100_NVLINK_ITEM_WITHOUT.value]: {
94
+ '20': [125],
95
+ '40': [250],
96
+ '60': [375],
97
+ '80': [500],
98
+ '100': [625],
99
+ '120': [750],
100
+ '140': [875],
101
+ '160': [1000],
102
+ },
103
+ [NVIDIA_V100.value]: {
104
+ '4': [64],
105
+ '8': [128],
106
+ '16': [256],
107
+ '32': [512],
108
+ '64': [1024],
109
+ },
110
+ [NVIDIA_A100_WITHOUT.value]: {
111
+ '20': [125],
112
+ '40': [250],
113
+ '60': [375],
114
+ '80': [500],
115
+ '100': [625],
116
+ '120': [750],
117
+ '140': [875],
118
+ '160': [1000],
119
+ },
120
+ };
121
+ const MAX_SIZE_NODE_COUNT_WITH_GPU: {
122
+ [gpuModel: string]: {
123
+ [vcpu: string]: {
124
+ [ram: string]: number;
125
+ };
126
+ };
127
+ } = {
128
+ [NVIDIA_H100_NVLINK_ITEM.value]: {
129
+ '20': {
130
+ '186': 7,
131
+ },
132
+ '40': {
133
+ '372': 7,
134
+ },
135
+ '60': {
136
+ '558': 7,
137
+ },
138
+ '100': {
139
+ '930': 7,
140
+ },
141
+ '120': {
142
+ '1116': 7,
143
+ },
144
+ '140': {
145
+ '1302': 7,
146
+ },
147
+ '160': {
148
+ '1488': 7,
149
+ },
150
+ },
151
+ [NVIDIA_H100_NVLINK_ITEM_WITHOUT.value]: {
152
+ '20': {
153
+ '125': 7,
154
+ },
155
+ '40': {
156
+ '250': 7,
157
+ },
158
+ '60': {
159
+ '375': 7,
160
+ },
161
+ '80': {
162
+ '500': 7,
163
+ },
164
+ '100': {
165
+ '625': 7,
166
+ },
167
+ '120': {
168
+ '750': 7,
169
+ },
170
+ '140': {
171
+ '875': 7,
172
+ },
173
+ '160': {
174
+ '1000': 7,
175
+ },
176
+ },
177
+ [NVIDIA_V100.value]: {
178
+ '4': {
179
+ '64': 7,
180
+ },
181
+ '8': {
182
+ '128': 7,
183
+ },
184
+ '16': {
185
+ '256': 7,
186
+ },
187
+ '32': {
188
+ '512': 7,
189
+ },
190
+ '64': {
191
+ '1024': 7,
192
+ },
193
+ },
194
+ [NVIDIA_A100_WITHOUT.value]: {
195
+ '20': {
196
+ '125': 7,
197
+ },
198
+ '40': {
199
+ '250': 7,
200
+ },
201
+ '60': {
202
+ '375': 7,
203
+ },
204
+ '80': {
205
+ '500': 7,
206
+ },
207
+ '100': {
208
+ '625': 7,
209
+ },
210
+ },
211
+ };
212
+
213
+ export const EVOLUTION_MANAGED_SPARK_CONFIG: FormConfig = {
214
+ ui: ['hasGpu', ['gpuModel'], 'gpuCount', ['vCpuCoreCount', 'ramAmount'], ['nodeCount']],
215
+ controls: {
216
+ hasGpu: {
217
+ type: CONTROL.Toggle,
218
+ accessorKey: 'hasGpu',
219
+ defaultValue: false,
220
+ decoratorProps: {
221
+ label: 'Графический процессор (GPU)',
222
+ },
223
+ },
224
+ gpuModel: {
225
+ type: CONTROL.SelectSingle,
226
+ accessorKey: 'gpuModel',
227
+ defaultValue: MODEL_ITEMS[0].value,
228
+ items: MODEL_ITEMS,
229
+ uiProps: {
230
+ visible: false,
231
+ },
232
+ decoratorProps: {
233
+ label: 'Модель GPU',
234
+ },
235
+ watchedControls: {
236
+ hasGpu: 'hasGpu',
237
+ },
238
+ relateFn: ({ hasGpu }) => ({
239
+ uiProps: {
240
+ visible: hasGpu,
241
+ },
242
+ }),
243
+ },
244
+ gpuCount: {
245
+ type: CONTROL.Slider,
246
+ accessorKey: 'gpuCount',
247
+ defaultValue: '1',
248
+ items: GPU_BY_MODEL[0],
249
+ decoratorProps: {
250
+ label: 'Количество GPU',
251
+ },
252
+ uiProps: {
253
+ visible: false,
254
+ step: 1,
255
+ },
256
+ watchedControls: {
257
+ hasGpu: 'hasGpu',
258
+ gpuModel: 'gpuModel',
259
+ },
260
+ relateFn: ({ hasGpu, gpuModel }) => ({
261
+ uiProps: {
262
+ visible: hasGpu,
263
+ },
264
+ items: GPU_BY_MODEL[gpuModel],
265
+ }),
266
+ },
267
+ vCpuCoreCount: {
268
+ type: CONTROL.Slider,
269
+ accessorKey: 'vCpuCoreCount',
270
+ defaultValue: '4',
271
+ items: VCPU_CORE_ITEMS_WITHOUT_GPU,
272
+ decoratorProps: {
273
+ label: 'Количество ядер vCPU',
274
+ },
275
+ uiProps: {
276
+ visible: true,
277
+ step: 1,
278
+ },
279
+ watchedControls: {
280
+ hasGpu: 'hasGpu',
281
+ gpuModel: 'gpuModel',
282
+ gpuCount: 'gpuCount',
283
+ },
284
+ relateFn: ({ hasGpu, gpuModel, gpuCount }) => ({
285
+ items: !hasGpu ? VCPU_CORE_ITEMS_WITHOUT_GPU : CPU_BY_MODEL_AND_GPU[gpuModel][String(gpuCount)],
286
+ }),
287
+ },
288
+ ramAmount: {
289
+ type: CONTROL.Segmented,
290
+ decoratorProps: {
291
+ label: 'Количество оперативной памяти (RAM)',
292
+ },
293
+ defaultValue: '8',
294
+ items: generateRamItems(VCPU_NO_MODEL_GPU['4']),
295
+ accessorKey: 'ramAmount',
296
+ watchedControls: {
297
+ vCpuCoreCount: 'vCpuCoreCount',
298
+ hasGpu: 'hasGpu',
299
+ gpuModel: 'gpuModel',
300
+ },
301
+ relateFn: ({ vCpuCoreCount, hasGpu, gpuModel }) => {
302
+ if (!hasGpu) {
303
+ const ramWithoutGPU = VCPU_NO_MODEL_GPU[vCpuCoreCount];
304
+ if (!ramWithoutGPU) {
305
+ const defaultItems = Object.values(VCPU_NO_MODEL_GPU)[0];
306
+ return {
307
+ items: generateRamItems(defaultItems),
308
+ };
309
+ }
310
+ return {
311
+ items: generateRamItems(ramWithoutGPU),
312
+ };
313
+ }
314
+ const ramByGPU = RAM_BY_MODEL_AND_CPU[gpuModel][String(vCpuCoreCount)];
315
+ if (!ramByGPU) {
316
+ const defaultItems = Object.values(RAM_BY_MODEL_AND_CPU[gpuModel])[0];
317
+ return {
318
+ items: generateRamItems(defaultItems),
319
+ };
320
+ }
321
+ return {
322
+ items: generateRamItems(ramByGPU),
323
+ };
324
+ },
325
+ },
326
+ nodeCount: {
327
+ type: CONTROL.Stepper,
328
+ accessorKey: 'nodeQuantity',
329
+ defaultValue: 1,
330
+ decoratorProps: {
331
+ label: 'Количество узлов',
332
+ },
333
+ uiProps: {
334
+ min: 1,
335
+ max: 10,
336
+ postfix: 'Шт',
337
+ },
338
+ watchedControls: {
339
+ vCpuCoreCount: 'vCpuCoreCount',
340
+ hasGpu: 'hasGpu',
341
+ gpuModel: 'gpuModel',
342
+ ramAmount: 'ramAmount',
343
+ },
344
+ relateFn: ({ vCpuCoreCount, hasGpu, gpuModel, ramAmount }) => {
345
+ if (!hasGpu) {
346
+ return {
347
+ uiProps: {
348
+ max: 10,
349
+ },
350
+ };
351
+ }
352
+ return {
353
+ uiProps: {
354
+ max: MAX_SIZE_NODE_COUNT_WITH_GPU?.[gpuModel]?.[vCpuCoreCount]?.[ramAmount] ?? 10,
355
+ },
356
+ };
357
+ },
358
+ },
359
+ },
360
+ };
@@ -0,0 +1,53 @@
1
+ import { CONTROL, FormConfig } from '../../../../components';
2
+ import { generateRamItems } from '../../../utils';
3
+ import { guaranteedPartVCpuToRamMap } from '../constants';
4
+
5
+ export const EVOLUTION_MANAGED_TRINO_CONFIG: FormConfig = {
6
+ ui: [['vCpuCoreCount', 'ramAmount'], ['nodeCount']],
7
+ controls: {
8
+ vCpuCoreCount: {
9
+ type: CONTROL.Slider,
10
+ accessorKey: 'vCpuCoreCount',
11
+ defaultValue: '2',
12
+ items: [2, 4, 8, 16, 24, 32, 64],
13
+ decoratorProps: {
14
+ label: 'Количество ядер vCPU',
15
+ labelTooltip: 'Количество ядер vCPU',
16
+ },
17
+ },
18
+ ramAmount: {
19
+ type: CONTROL.Segmented,
20
+ decoratorProps: {
21
+ label: 'Количество оперативной памяти (RAM)',
22
+ },
23
+ defaultValue: '1',
24
+ items: generateRamItems([1, 2]),
25
+ accessorKey: 'ramAmount',
26
+ watchedControls: {
27
+ vCpuCoreCount: 'vCpuCoreCount',
28
+ },
29
+ relateFn: ({ vCpuCoreCount }) => {
30
+ const items = guaranteedPartVCpuToRamMap?.['100']?.[vCpuCoreCount];
31
+
32
+ if (items?.length > 0) {
33
+ return {
34
+ items: generateRamItems(items),
35
+ };
36
+ }
37
+ },
38
+ },
39
+ nodeCount: {
40
+ type: CONTROL.Stepper,
41
+ accessorKey: 'nodeQuantity',
42
+ defaultValue: 2,
43
+ decoratorProps: {
44
+ label: 'Количество узлов',
45
+ },
46
+ uiProps: {
47
+ min: 2,
48
+ max: 10,
49
+ postfix: 'Шт',
50
+ },
51
+ },
52
+ },
53
+ };