@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,526 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+
3
+ import { CONTROL, FormConfig } from '../../../../components';
4
+ import { CALCULATOR_TYPE } from '../../../../types';
5
+ import { generateRamItems, getDisk, getEip, SpecificationItem } from '../../../utils';
6
+
7
+ export const EcsSpecificationItem = {
8
+ GeneralPurpose: 'General-Purpose (ECS)',
9
+ DedicatedGeneralPurpose: 'Dedicated General-Purpose (ECS)',
10
+ MemoryOptimized: 'Memory-optimized (ECS)',
11
+ DiskIntensive: 'Disk-intensive (ECS)',
12
+ UltraHigh: 'Ultra high I/O (ECS)',
13
+ } as const;
14
+
15
+ export type EcsSpecificationType = ValueOf<typeof EcsSpecificationItem>;
16
+
17
+ export const ecsSpecificationItems = [
18
+ {
19
+ value: EcsSpecificationItem.GeneralPurpose,
20
+ label: 'General-Purpose',
21
+ description: (
22
+ <ul>
23
+ <li>Базовый сервер</li>
24
+ <li>Переподписка по&nbsp;ядрам 1:3</li>
25
+ <li>
26
+ Для базовых вычислений,
27
+ <br />
28
+ не требующих высокой нагрузки
29
+ </li>
30
+ </ul>
31
+ ) as unknown as string,
32
+ },
33
+ {
34
+ value: EcsSpecificationItem.DedicatedGeneralPurpose,
35
+ label: 'Dedicated General-Purpose',
36
+ description: (
37
+ <ul>
38
+ <li>
39
+ Выделенный стандартный сервер с&nbsp;механизмом ускорения сети последнего поколения и&nbsp;набором библиотек
40
+ и&nbsp;драйверов для быстрой обработки пакетов (DPDK)
41
+ </li>
42
+ <li>Без переподписки</li>
43
+ <li>Для вычислений с&nbsp;высокими требованиями к&nbsp;CPU</li>
44
+ </ul>
45
+ ) as unknown as string,
46
+ },
47
+ {
48
+ value: EcsSpecificationItem.MemoryOptimized,
49
+ label: 'Memory-optimized',
50
+ description: (
51
+ <ul>
52
+ <li>
53
+ Сервер с увеличенным объемом памяти на&nbsp;платформе виртуализации последнего поколения, обеспечивающий
54
+ высокоэффективный доступ к&nbsp;памяти
55
+ </li>
56
+ <li>Без переподписки</li>
57
+ <li>
58
+ Для приложений, которым требуется хранить и&nbsp;обрабатывать большие объемы данных в&nbsp;оперативной памяти
59
+ </li>
60
+ </ul>
61
+ ) as unknown as string,
62
+ },
63
+ {
64
+ value: EcsSpecificationItem.DiskIntensive,
65
+ label: 'Disk-intensive',
66
+ description: (
67
+ <ul>
68
+ <li>
69
+ Сервер с высокопроизводительными локальными дисками для последовательного чтения/записи файлов и
70
+ их&nbsp;низкой задержки
71
+ </li>
72
+ <li>Без переподписки</li>
73
+ <li>
74
+ Для задач, в&nbsp;которых требуется чтение и/или&nbsp;запись файлов большого объема
75
+ <br />
76
+ <br />
77
+ <b>Тарифицируются в&nbsp;выключенном (остановленном) режиме</b>
78
+ </li>
79
+ </ul>
80
+ ) as unknown as string,
81
+ },
82
+ {
83
+ value: EcsSpecificationItem.UltraHigh,
84
+ label: 'Ultra-high I/O',
85
+ description: (
86
+ <ul>
87
+ <li>
88
+ Сервер с&nbsp;высокопроизводительными локальными NVMe SSD дисками, обеспечивающий повышенное количество
89
+ I/O-операций в&nbsp;секунду и&nbsp;минимальную задержку
90
+ <br />
91
+ чтения/записи данных
92
+ </li>
93
+ <li>Без переподписки</li>
94
+ <li>Для приложений с&nbsp;повышенными требованиями к&nbsp;производительности дисков</li>
95
+ </ul>
96
+ ) as unknown as string,
97
+ },
98
+ ];
99
+
100
+ export const OsItem = {
101
+ Linux: 'Linux',
102
+ Essentials: 'Essentials',
103
+ };
104
+
105
+ export const osItems = [
106
+ {
107
+ value: OsItem.Linux,
108
+ label: 'Linux',
109
+ },
110
+ {
111
+ value: OsItem.Essentials,
112
+ label: 'Essentials',
113
+ },
114
+ ];
115
+
116
+ export const ServerGenItem = {
117
+ SkyLake: '3',
118
+ CascadeLake: '6',
119
+ IceLake: '7',
120
+ } as const;
121
+
122
+ export type ServerGenType = ValueOf<typeof ServerGenItem>;
123
+
124
+ export const skyLakeServerGenItem = {
125
+ value: ServerGenItem.SkyLake,
126
+ label: 'Sky Lake',
127
+ };
128
+ export const cascadeLakeServerGenItem = {
129
+ value: ServerGenItem.CascadeLake,
130
+ label: 'Cascade Lake',
131
+ };
132
+ export const iceLakeServerGenItem = {
133
+ value: ServerGenItem.IceLake,
134
+ label: 'Ice Lake',
135
+ };
136
+
137
+ export const ecsSpecificationToGenMap = {
138
+ [EcsSpecificationItem.GeneralPurpose]: [cascadeLakeServerGenItem, iceLakeServerGenItem],
139
+ [EcsSpecificationItem.DedicatedGeneralPurpose]: [
140
+ skyLakeServerGenItem,
141
+ cascadeLakeServerGenItem,
142
+ iceLakeServerGenItem,
143
+ ],
144
+ [EcsSpecificationItem.MemoryOptimized]: [skyLakeServerGenItem, cascadeLakeServerGenItem, iceLakeServerGenItem],
145
+ [EcsSpecificationItem.DiskIntensive]: [skyLakeServerGenItem, cascadeLakeServerGenItem],
146
+ [EcsSpecificationItem.UltraHigh]: [skyLakeServerGenItem],
147
+ };
148
+
149
+ export const ecsSpecificationGenToCpuMap: Record<EcsSpecificationType, Record<string, number[]>> = {
150
+ [EcsSpecificationItem.GeneralPurpose]: {
151
+ [ServerGenItem.CascadeLake]: [1, 2, 4, 8],
152
+ [ServerGenItem.IceLake]: [1, 2, 4, 8, 16],
153
+ },
154
+ [EcsSpecificationItem.DedicatedGeneralPurpose]: {
155
+ [ServerGenItem.SkyLake]: [2, 4, 8, 12, 16, 24, 32, 60],
156
+ [ServerGenItem.CascadeLake]: [2, 4, 8, 12, 16, 24, 32, 48, 64],
157
+ [ServerGenItem.IceLake]: [2, 4, 8, 12, 16, 24, 32, 48, 64, 96],
158
+ },
159
+ [EcsSpecificationItem.MemoryOptimized]: {
160
+ [ServerGenItem.SkyLake]: [2, 4, 8, 12, 16, 24, 32, 60],
161
+ [ServerGenItem.CascadeLake]: [2, 4, 8, 12, 16, 24, 32, 64],
162
+ [ServerGenItem.IceLake]: [2, 4, 8, 12, 16, 24, 32, 48, 64, 96],
163
+ },
164
+ [EcsSpecificationItem.DiskIntensive]: {
165
+ [ServerGenItem.SkyLake]: [4, 8, 16, 24, 32, 48, 56],
166
+ [ServerGenItem.CascadeLake]: [4, 8, 16, 24, 32, 48, 64, 72],
167
+ },
168
+ [EcsSpecificationItem.UltraHigh]: {
169
+ [ServerGenItem.SkyLake]: [2, 4, 8, 16, 32, 96],
170
+ },
171
+ };
172
+
173
+ export const ecsSpecificationGenCpuToRamMap: Record<EcsSpecificationType, Record<string, Record<string, number[]>>> = {
174
+ [EcsSpecificationItem.GeneralPurpose]: {
175
+ [ServerGenItem.CascadeLake]: {
176
+ '1': [1, 2, 4],
177
+ '2': [4, 8],
178
+ '4': [8, 16],
179
+ '8': [16, 32],
180
+ },
181
+ [ServerGenItem.IceLake]: {
182
+ '1': [2, 4],
183
+ '2': [4, 8],
184
+ '4': [8, 16],
185
+ '8': [16, 32],
186
+ '16': [32, 64],
187
+ },
188
+ },
189
+ [EcsSpecificationItem.DedicatedGeneralPurpose]: {
190
+ [ServerGenItem.SkyLake]: {
191
+ '2': [4, 8],
192
+ '4': [8, 16],
193
+ '8': [16, 32],
194
+ '12': [24, 48],
195
+ '16': [32, 64],
196
+ '24': [48, 96],
197
+ '32': [64, 128],
198
+ '60': [128, 256],
199
+ },
200
+ [ServerGenItem.CascadeLake]: {
201
+ '2': [4, 8],
202
+ '4': [8, 16],
203
+ '8': [16, 32],
204
+ '12': [24, 48],
205
+ '16': [32, 64],
206
+ '24': [48, 96],
207
+ '32': [64, 128],
208
+ '48': [96, 192],
209
+ '64': [128, 256],
210
+ },
211
+ [ServerGenItem.IceLake]: {
212
+ '2': [8],
213
+ '4': [16],
214
+ '8': [32],
215
+ '12': [48],
216
+ '16': [64],
217
+ '24': [96],
218
+ '32': [128],
219
+ '48': [192],
220
+ '64': [256],
221
+ '96': [384],
222
+ },
223
+ },
224
+ [EcsSpecificationItem.MemoryOptimized]: {
225
+ [ServerGenItem.SkyLake]: {
226
+ '2': [16],
227
+ '4': [32],
228
+ '8': [64],
229
+ '12': [96],
230
+ '16': [128],
231
+ '24': [192],
232
+ '32': [256],
233
+ '60': [512],
234
+ },
235
+ [ServerGenItem.CascadeLake]: {
236
+ '2': [16],
237
+ '4': [32],
238
+ '8': [64],
239
+ '12': [96],
240
+ '16': [128],
241
+ '24': [192],
242
+ '32': [256],
243
+ '64': [512],
244
+ },
245
+ [ServerGenItem.IceLake]: {
246
+ '2': [16],
247
+ '4': [32],
248
+ '8': [64],
249
+ '12': [96],
250
+ '16': [128],
251
+ '24': [192],
252
+ '32': [256],
253
+ '48': [384],
254
+ '64': [512],
255
+ '96': [768],
256
+ },
257
+ },
258
+ [EcsSpecificationItem.DiskIntensive]: {
259
+ [ServerGenItem.SkyLake]: { '4': [32], '8': [64], '16': [128], '24': [192], '32': [256], '48': [284], '56': [560] },
260
+ [ServerGenItem.CascadeLake]: {
261
+ '4': [16],
262
+ '8': [32],
263
+ '16': [64],
264
+ '24': [96],
265
+ '32': [128],
266
+ '48': [192],
267
+ '64': [256],
268
+ '72': [288],
269
+ },
270
+ },
271
+ [EcsSpecificationItem.UltraHigh]: {
272
+ [ServerGenItem.SkyLake]: { '2': [8], '4': [16], '8': [32], '16': [64], '32': [128], '96': [384] },
273
+ },
274
+ };
275
+
276
+ const shortSpecificationItems = [
277
+ {
278
+ value: SpecificationItem.HDD,
279
+ label: 'HDD',
280
+ },
281
+ {
282
+ value: SpecificationItem.SSD,
283
+ label: 'SSD',
284
+ },
285
+ ];
286
+
287
+ const specificationItems = [
288
+ {
289
+ value: SpecificationItem.HDD,
290
+ label: 'HDD',
291
+ },
292
+ {
293
+ value: SpecificationItem.SSD,
294
+ label: 'SSD',
295
+ },
296
+ {
297
+ value: SpecificationItem.ESSD,
298
+ label: 'ESSD',
299
+ },
300
+ ];
301
+
302
+ export const getCpuFrequency = (ecsSpecification: EcsSpecificationType, serverGen: ServerGenType) => {
303
+ switch (ecsSpecification) {
304
+ case EcsSpecificationItem.UltraHigh:
305
+ case EcsSpecificationItem.GeneralPurpose: {
306
+ return '2.6';
307
+ }
308
+ case EcsSpecificationItem.DiskIntensive: {
309
+ if (serverGen === ServerGenItem.SkyLake) {
310
+ return '3.0';
311
+ }
312
+
313
+ return '2.6';
314
+ }
315
+
316
+ case EcsSpecificationItem.DedicatedGeneralPurpose:
317
+ case EcsSpecificationItem.MemoryOptimized: {
318
+ if (serverGen === ServerGenItem.IceLake) {
319
+ return '2.6';
320
+ }
321
+
322
+ return '3.0';
323
+ }
324
+ default: {
325
+ return '3.0';
326
+ }
327
+ }
328
+ };
329
+
330
+ const generateCpuGHItems = (items: number[], frequency: string) =>
331
+ items.map(item => ({
332
+ value: String(item),
333
+ label: `${item} (${frequency} GHz)`,
334
+ }));
335
+
336
+ export const CLOUD_SERVER_FORM_CONFIG: FormConfig = {
337
+ ui: [
338
+ 'ecsSpecification',
339
+ 'ecsOs',
340
+ 'nonPartnersAlert',
341
+ ['ecsCpu', 'ecsRam'],
342
+ ['ecsGen', 'evsSystemDisk'],
343
+ ['evsAdditionalDisks'],
344
+ 'eip',
345
+ ],
346
+ controls: {
347
+ ecsSpecification: {
348
+ type: CONTROL.Carousel,
349
+ accessorKey: 'ecs.specification',
350
+ defaultValue: EcsSpecificationItem.GeneralPurpose,
351
+ items: ecsSpecificationItems,
352
+ decoratorProps: {
353
+ label: 'Тип сервера',
354
+ },
355
+ },
356
+ ecsOs: {
357
+ type: CONTROL.Object,
358
+ ui: [['ecsOs']],
359
+ controls: {
360
+ ecsOs: {
361
+ type: CONTROL.Segmented,
362
+ accessorKey: 'ecs.os',
363
+ defaultValue: OsItem.Linux,
364
+ items: osItems,
365
+ decoratorProps: {
366
+ label: 'Операционная система',
367
+ },
368
+ },
369
+ },
370
+ relateFn: ({ calculatorType }) => {
371
+ if (calculatorType !== CALCULATOR_TYPE.Partners) {
372
+ return {
373
+ visible: false,
374
+ };
375
+ }
376
+ },
377
+ },
378
+
379
+ nonPartnersAlert: {
380
+ type: CONTROL.Alert,
381
+ uiProps: {
382
+ visible: false,
383
+ description:
384
+ 'По умолчанию в стоимость расчета входит ОС Linux. Для расчета стоимости виртуальных машин с другими ОС оставьте заявку на консультацию',
385
+ },
386
+ accessorKey: 'default',
387
+ relateFn: ({ calculatorType }) => {
388
+ if (calculatorType !== CALCULATOR_TYPE.Partners) {
389
+ return {
390
+ uiProps: {
391
+ visible: true,
392
+ },
393
+ };
394
+ }
395
+ },
396
+ },
397
+
398
+ ecsCpu: {
399
+ type: CONTROL.SelectSingle,
400
+ accessorKey: 'ecs.cpu',
401
+ defaultValue: '1',
402
+ items: generateCpuGHItems([1, 2, 4, 8], '2.6'),
403
+ decoratorProps: {
404
+ label: 'Количество vCPU, шт',
405
+ labelTooltip: 'Виртуальный процессор',
406
+ },
407
+ watchedControls: { ecsSpecification: 'ecs.specification', serverGen: 'ecs.gen' },
408
+ relateFn: ({
409
+ ecsSpecification,
410
+ serverGen,
411
+ }: {
412
+ ecsSpecification: EcsSpecificationType;
413
+ serverGen: ServerGenType;
414
+ }) => {
415
+ const items = ecsSpecificationGenToCpuMap?.[ecsSpecification]?.[serverGen];
416
+
417
+ if (items?.length > 0) {
418
+ return {
419
+ items: generateCpuGHItems(items, getCpuFrequency(ecsSpecification, serverGen)),
420
+ };
421
+ }
422
+ },
423
+ },
424
+
425
+ ecsRam: {
426
+ type: CONTROL.Segmented,
427
+ accessorKey: 'ecs.ram',
428
+ defaultValue: '1',
429
+ items: generateRamItems([1, 2, 4]),
430
+ decoratorProps: {
431
+ label: 'Объём RAM',
432
+ labelTooltip: 'Оперативная память',
433
+ },
434
+ watchedControls: { ecsSpecification: 'ecs.specification', serverGen: 'ecs.gen', cpu: 'ecs.cpu' },
435
+ relateFn: ({
436
+ ecsSpecification,
437
+ serverGen,
438
+ cpu,
439
+ }: {
440
+ ecsSpecification: EcsSpecificationType;
441
+ serverGen: ServerGenType;
442
+ cpu: string;
443
+ }) => {
444
+ const items = ecsSpecificationGenCpuToRamMap?.[ecsSpecification]?.[serverGen]?.[cpu];
445
+
446
+ if (items?.length > 0) {
447
+ return {
448
+ items: generateRamItems(items),
449
+ };
450
+ }
451
+ },
452
+ },
453
+
454
+ ecsGen: {
455
+ type: CONTROL.Segmented,
456
+ accessorKey: 'ecs.gen',
457
+ defaultValue: cascadeLakeServerGenItem.value,
458
+ items: [cascadeLakeServerGenItem, iceLakeServerGenItem],
459
+ decoratorProps: {
460
+ label: 'Поколение GEN',
461
+ },
462
+ watchedControls: { ecsSpecification: 'ecs.specification' },
463
+ relateFn: ({ ecsSpecification }: { ecsSpecification: EcsSpecificationType }) => ({
464
+ items: ecsSpecificationToGenMap[ecsSpecification] || [],
465
+ }),
466
+ },
467
+
468
+ evsSystemDisk: getDisk({
469
+ space: {
470
+ accessorKey: 'evs.systemDisk.diskSpace',
471
+ defaultValue: 40,
472
+ uiProps: {
473
+ min: 40,
474
+ max: 1_530,
475
+ postfix: 'ГБ',
476
+ },
477
+ },
478
+ specification: {
479
+ accessorKey: 'evs.systemDisk.specification',
480
+ items: specificationItems,
481
+ watchedControls: { escSpecification: 'ecs.specification' },
482
+ relateFn: ({ escSpecification }) => {
483
+ switch (escSpecification) {
484
+ case EcsSpecificationItem.DiskIntensive:
485
+ case EcsSpecificationItem.UltraHigh:
486
+ return {
487
+ items: shortSpecificationItems,
488
+ };
489
+
490
+ default: {
491
+ return undefined;
492
+ }
493
+ }
494
+ },
495
+ },
496
+ }),
497
+
498
+ evsAdditionalDisks: {
499
+ type: CONTROL.Array,
500
+ max: 23,
501
+ accessorKey: 'evs.additionalDisks',
502
+ defaultValue: [],
503
+ addText: 'Добавить диск',
504
+ ui: ['disk'],
505
+ controls: {
506
+ disk: getDisk({
507
+ space: {
508
+ accessorKey: 'diskSpace',
509
+ defaultValue: 10,
510
+ uiProps: {
511
+ min: 10,
512
+ max: 32_760,
513
+ },
514
+ },
515
+ specification: {
516
+ accessorKey: 'specification',
517
+ },
518
+ }),
519
+ },
520
+ },
521
+
522
+ eip: getEip({
523
+ trafficKey: 'eip.traffic',
524
+ }),
525
+ },
526
+ };
@@ -0,0 +1,159 @@
1
+ import { CONTROL, FormConfig } from '../../../../components';
2
+ import { generateInstanceConfigItems } from '../../../utils';
3
+
4
+ const componentTypeItem = {
5
+ Cdm: 'CDM',
6
+ Dis: 'DIS',
7
+ };
8
+
9
+ const componentTypeItems = [
10
+ {
11
+ value: componentTypeItem.Cdm,
12
+ label: 'Cloud Data Migration (CDM)',
13
+ description:
14
+ 'Позволяет осуществлять пакетную миграцию данных между однородными и разнородными источниками данных. Миграция данных из разных источников, включая локальные и облачные файловые системы, реляционные базы данных, хранилища данных, NoSQL, большие данные и хранилище объектов',
15
+ },
16
+ {
17
+ value: componentTypeItem.Dis,
18
+ label: 'Data Ingestion Service (DIS)',
19
+ description:
20
+ 'Решает проблему передачи данных за пределами облака внутрь облака. DIS создает потоки приема данных для пользовательских приложений, способных обрабатывать или анализировать потоковые данные. DIS непрерывно собирает, передает и хранит терабайты данных из сотен тысяч источников каждый час, таких как журналы, каналы социальных сетей, потоки посещений веб-сайтов и события отслеживания местоположения',
21
+ },
22
+ ];
23
+
24
+ const streamTypeItem = {
25
+ GeneralCommon: 'General/Common',
26
+ Advanced: 'Advanced',
27
+ };
28
+
29
+ const streamTypeItems = [
30
+ {
31
+ value: streamTypeItem.GeneralCommon,
32
+ label: 'General/Common',
33
+ description:
34
+ 'Каждая партиция поддерживает максимальную скорость чтения 2 Мб/с и максимальную скорость записи 1 Мб/с',
35
+ },
36
+ {
37
+ value: streamTypeItem.Advanced,
38
+ label: 'Advanced',
39
+ description:
40
+ 'Каждая партиция поддерживает максимальную скорость чтения 10 Мб/с и максимальную скорость записи 5 Мб/с',
41
+ },
42
+ ];
43
+
44
+ const clusterTypeItems = generateInstanceConfigItems([
45
+ [8, 16],
46
+ [16, 32],
47
+ [64, 128],
48
+ ]);
49
+
50
+ export const DATA_AS_YOU_USE_FORM_CONFIG: FormConfig = {
51
+ ui: ['componentType', ['clusterType', 'workTime'], 'streamType', ['partitionCount']],
52
+ controls: {
53
+ componentType: {
54
+ type: CONTROL.Carousel,
55
+ accessorKey: 'componentType',
56
+ defaultValue: componentTypeItem.Cdm,
57
+ items: componentTypeItems,
58
+ decoratorProps: {
59
+ label: 'Тип очереди запроса',
60
+ },
61
+ uiProps: {
62
+ showItems: 2,
63
+ pagination: false,
64
+ arrows: false,
65
+ },
66
+ },
67
+
68
+ clusterType: {
69
+ type: CONTROL.SelectSingle,
70
+ accessorKey: 'clusterType',
71
+ defaultValue: '8 16',
72
+ items: clusterTypeItems,
73
+ decoratorProps: {
74
+ label: 'Кластер',
75
+ },
76
+ uiProps: {
77
+ searchable: false,
78
+ showClearButton: false,
79
+ },
80
+ watchedControls: { componentType: 'componentType' },
81
+ relateFn: ({ componentType }) => {
82
+ if (componentType === componentTypeItem.Dis) {
83
+ return {
84
+ uiProps: {
85
+ visible: false,
86
+ },
87
+ };
88
+ }
89
+ },
90
+ },
91
+
92
+ workTime: {
93
+ type: CONTROL.Stepper,
94
+ accessorKey: 'workTime',
95
+ defaultValue: 1,
96
+ decoratorProps: {
97
+ label: 'Время работы в день',
98
+ },
99
+ uiProps: {
100
+ min: 1,
101
+ max: 24,
102
+ postfix: 'ч',
103
+ },
104
+ },
105
+
106
+ streamType: {
107
+ type: CONTROL.Carousel,
108
+ accessorKey: 'streamType',
109
+ defaultValue: streamTypeItem.GeneralCommon,
110
+ items: streamTypeItems,
111
+ decoratorProps: {
112
+ label: 'Тип потока',
113
+ },
114
+ uiProps: {
115
+ showItems: 2,
116
+ pagination: false,
117
+ arrows: false,
118
+ },
119
+ watchedControls: { componentType: 'componentType' },
120
+ relateFn: ({ componentType }) => {
121
+ if (componentType === componentTypeItem.Cdm) {
122
+ return {
123
+ uiProps: {
124
+ visible: false,
125
+ },
126
+ };
127
+ }
128
+ },
129
+ },
130
+ partitionCount: {
131
+ type: CONTROL.Stepper,
132
+ accessorKey: 'partitionCount',
133
+ defaultValue: 1,
134
+ decoratorProps: {
135
+ label: 'Количество партиций',
136
+ },
137
+ uiProps: {
138
+ min: 1,
139
+ max: 50,
140
+ postfix: 'Шт',
141
+ },
142
+ watchedControls: { streamType: 'streamType', componentType: 'componentType' },
143
+ relateFn: ({ streamType, componentType }) => {
144
+ if (componentType === componentTypeItem.Cdm) {
145
+ return {
146
+ uiProps: {
147
+ visible: false,
148
+ },
149
+ };
150
+ }
151
+ if (streamType === streamTypeItem.Advanced) {
152
+ return {
153
+ uiProps: { max: 10 },
154
+ };
155
+ }
156
+ },
157
+ },
158
+ },
159
+ };