@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,58 @@
1
+ import { CONTROL, FormConfig } from '../../../../components';
2
+
3
+ export const VM_WARE_VIRTUAL_MACHINES_BACKUP_FORM_CONFIG: FormConfig = {
4
+ ui: ['vmWareVirtualMachinesBackup'],
5
+ controls: {
6
+ vmWareVirtualMachinesBackup: {
7
+ type: CONTROL.Table,
8
+ accessorKey: 'vmWareVirtualMachinesBackup',
9
+ defaultValue: {
10
+ backupVM: 0,
11
+ localStorage: 0,
12
+ remoteStorage: 0,
13
+ },
14
+ rows: [
15
+ {
16
+ label: 'Резервное копирование ВМ',
17
+ accessorKey: 'backupVM',
18
+ uiProps: {
19
+ min: 0,
20
+ max: 50_000,
21
+ postfix: 'Шт',
22
+ },
23
+ },
24
+ {
25
+ label: 'Локальное хранилище',
26
+ accessorKey: 'localStorage',
27
+ uiProps: {
28
+ min: 0,
29
+ max: 2_044_977,
30
+ postfix: 'ГБ',
31
+ },
32
+ labelTooltip: 'Резервные копии хранятся на основной площадке',
33
+ },
34
+ {
35
+ label: 'Удаленное хранилище',
36
+ accessorKey: 'remoteStorage',
37
+ uiProps: {
38
+ min: 0,
39
+ max: 2_044_977,
40
+ postfix: 'ГБ',
41
+ },
42
+ labelTooltip:
43
+ 'Резервные копии хранятся на площадке, удаленной от основного ЦОДа. Рекомендуется выбирать удаленный репозиторий для повышения уровня безопасности',
44
+ },
45
+ {
46
+ label: 'Неудаляемое хранилище',
47
+ accessorKey: 'unremovableStorage',
48
+ uiProps: {
49
+ min: 0,
50
+ max: 1_999_000,
51
+ postfix: 'ГБ',
52
+ },
53
+ labelTooltip: 'Неудаляемое хранение резервных копий (Immutable Storage)',
54
+ },
55
+ ],
56
+ },
57
+ },
58
+ };
@@ -0,0 +1,210 @@
1
+ import { Link } from '@snack-uikit/link';
2
+
3
+ import { CONTROL, FormConfig } from '../../../../components';
4
+
5
+ const networkSpeedValues = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 5000, 10000];
6
+
7
+ const OsTypeItem = {
8
+ Desktop: 'Desktop',
9
+ Linux: 'Linux',
10
+ };
11
+
12
+ const osTypeItems = [
13
+ {
14
+ value: OsTypeItem.Desktop,
15
+ label: 'Десктопная',
16
+ },
17
+ {
18
+ value: OsTypeItem.Linux,
19
+ label: 'Linux',
20
+ },
21
+ ];
22
+
23
+ const TariffPlanItem = {
24
+ Linux: 'Linux',
25
+ Standard: 'Standard',
26
+ Advanced: 'Advanced',
27
+ };
28
+
29
+ const tariffPlanItems = [
30
+ {
31
+ value: TariffPlanItem.Linux,
32
+ label: 'Linux',
33
+ description: 'Удаленные рабочие столы будут развернуты на операционной системе Linux',
34
+ },
35
+ {
36
+ value: TariffPlanItem.Standard,
37
+ label: 'Стандартный',
38
+ description: 'Удаленные рабочие столы будут развернуты на десктопной операционной системе',
39
+ },
40
+ {
41
+ value: TariffPlanItem.Advanced,
42
+ label: 'Продвинутый',
43
+ description: 'Удаленные рабочие столы будут развернуты на десктопной операционной системе или Linux',
44
+ },
45
+ ];
46
+
47
+ export const VM_WARE_VIRTUAL_WORKSPACES_FORM_CONFIG: FormConfig = {
48
+ ui: [
49
+ ['osType'],
50
+ 'tariffPlan',
51
+ ['workSpacesCount'],
52
+ ['vcpuCount'],
53
+ ['ramVolume'],
54
+ ['ssdVolume'],
55
+ ['videoMemoryVolume'],
56
+ ['networkSpeed'],
57
+ ],
58
+ controls: {
59
+ osType: {
60
+ type: CONTROL.Segmented,
61
+ accessorKey: 'vdi.osType',
62
+ defaultValue: OsTypeItem.Desktop,
63
+ items: osTypeItems,
64
+ decoratorProps: {
65
+ label: 'Операционная система',
66
+ },
67
+ onChangeFn: (value, setValue) => {
68
+ const minRam = value === OsTypeItem.Linux ? 2 : 4;
69
+ setValue([
70
+ ['vdi.osType', value],
71
+ ['vdi.ramVolume', minRam],
72
+ ]);
73
+ },
74
+ },
75
+ tariffPlan: {
76
+ type: CONTROL.ToggleCards,
77
+ defaultValue: TariffPlanItem.Standard,
78
+ items: tariffPlanItems,
79
+ accessorKey: 'vdi.tariffPlan',
80
+ decoratorProps: {
81
+ label: 'Тарифный план',
82
+ labelTooltip: (
83
+ <>
84
+ Подробнее о возможностях каждого
85
+ <br />
86
+ из тарифов читайте в{' '}
87
+ <Link
88
+ target='_blank'
89
+ href='https://cloud.ru/docs/vdi/ag/topics/tariffs'
90
+ textMode='accent'
91
+ text='документации'
92
+ appearance='invert-neutral'
93
+ />
94
+ </>
95
+ ),
96
+ },
97
+ watchedControls: { osType: 'vdi.osType' },
98
+ relateFn: ({ osType }) => {
99
+ if (osType === OsTypeItem.Linux) {
100
+ return {
101
+ items: tariffPlanItems.filter(item => item.value !== TariffPlanItem.Standard),
102
+ };
103
+ }
104
+ return {
105
+ items: tariffPlanItems.filter(item => item.value !== TariffPlanItem.Linux),
106
+ };
107
+ },
108
+ },
109
+ workSpacesCount: {
110
+ type: CONTROL.Stepper,
111
+ accessorKey: 'vdi.workSpacesCount',
112
+ defaultValue: 1,
113
+ decoratorProps: {
114
+ label: 'Количество рабочих мест',
115
+ },
116
+ uiProps: {
117
+ min: 1,
118
+ max: 2_000,
119
+ postfix: 'Шт',
120
+ },
121
+ },
122
+ vcpuCount: {
123
+ type: CONTROL.Stepper,
124
+ accessorKey: 'vdi.vcpuCount',
125
+ defaultValue: 2,
126
+ decoratorProps: {
127
+ label: 'Количество ядер vCPU',
128
+ },
129
+ uiProps: {
130
+ min: 2,
131
+ max: 18,
132
+ postfix: 'Шт',
133
+ },
134
+ },
135
+ ramVolume: {
136
+ type: CONTROL.Stepper,
137
+ accessorKey: 'vdi.ramVolume',
138
+ decoratorProps: {
139
+ label: 'Объем оперативной памяти RAM',
140
+ },
141
+ defaultValue: 2,
142
+ uiProps: {
143
+ min: 4,
144
+ max: 64,
145
+ postfix: 'ГБ',
146
+ },
147
+ watchedControls: { osType: 'vdi.osType' },
148
+ relateFn: ({ osType }) => {
149
+ switch (osType) {
150
+ case OsTypeItem.Linux: {
151
+ return {
152
+ uiProps: {
153
+ min: 2,
154
+ max: 64,
155
+ },
156
+ };
157
+ }
158
+ case OsTypeItem.Desktop:
159
+ default: {
160
+ return {
161
+ uiProps: {
162
+ min: 4,
163
+ max: 64,
164
+ },
165
+ };
166
+ }
167
+ }
168
+ },
169
+ },
170
+ ssdVolume: {
171
+ type: CONTROL.Stepper,
172
+ accessorKey: 'vdi.ssdVolume',
173
+ defaultValue: 40,
174
+ decoratorProps: {
175
+ label: 'Жесткий диск SSD',
176
+ },
177
+ uiProps: {
178
+ min: 40,
179
+ max: 40_000,
180
+ postfix: 'ГБ',
181
+ },
182
+ },
183
+ videoMemoryVolume: {
184
+ type: CONTROL.Slider,
185
+ accessorKey: 'vdi.videoMemoryVolume',
186
+ decoratorProps: {
187
+ label: 'Объем видеопамяти A40 vGPU',
188
+ },
189
+ items: [0, 2, 4, 8, 12, 16, 24, 48],
190
+ uiProps: {
191
+ step: 1,
192
+ postfix: 'ГБ',
193
+ },
194
+ },
195
+ networkSpeed: {
196
+ type: CONTROL.Stepper,
197
+ accessorKey: 'vdi.networkSpeed',
198
+ defaultValue: 0,
199
+ decoratorProps: {
200
+ label: 'Скорость доступа в интернет',
201
+ },
202
+ uiProps: {
203
+ min: 0,
204
+ max: 10_000,
205
+ postfix: 'Мбит/с',
206
+ allowedValues: networkSpeedValues,
207
+ },
208
+ },
209
+ },
210
+ };
@@ -0,0 +1,4 @@
1
+ export * from './VmWareVirtualDataCenter';
2
+ export * from './VmWareCloudBackup';
3
+ export * from './VmWareVirtualMachinesBackup';
4
+ export * from './VmWareVirtualWorkspaces';
@@ -0,0 +1,63 @@
1
+ import {
2
+ BackupSVG,
3
+ VirtualDataCenterWithGpuSVG,
4
+ VirtualDesktopInfrastructureSVG,
5
+ VmBackupSVG,
6
+ } from '@cloud-ru/uikit-product-icons';
7
+
8
+ import { PLATFORM } from '../../../constants';
9
+ import { CatalogConfig } from '../../../types';
10
+ import { VM_WARE_PRODUCT } from './constants';
11
+ import {
12
+ VIRTUAL_DATA_CENTER_FORM_CONFIG,
13
+ VM_WARE_CLOUD_BACKUP_FORM_CONFIG,
14
+ VM_WARE_VIRTUAL_MACHINES_BACKUP_FORM_CONFIG,
15
+ VM_WARE_VIRTUAL_WORKSPACES_FORM_CONFIG,
16
+ } from './product-config';
17
+
18
+ export const VM_WARE_PRODUCTS: CatalogConfig['products'] = {
19
+ [VM_WARE_PRODUCT.VmWareVirtualDataCenter]: {
20
+ id: VM_WARE_PRODUCT.VmWareVirtualDataCenter,
21
+ platform: PLATFORM.VmWare,
22
+ dataTestId: VM_WARE_PRODUCT.VmWareVirtualDataCenter,
23
+ label: 'VMware: Виртуальный ЦОД',
24
+ caption: 'Публичное облако на базе VMware',
25
+ formConfig: VIRTUAL_DATA_CENTER_FORM_CONFIG,
26
+ icon: VirtualDataCenterWithGpuSVG,
27
+ enableChangeProductQuantity: false,
28
+ hasPayaGo: true,
29
+ },
30
+ [VM_WARE_PRODUCT.VmWareCloudBackup]: {
31
+ id: VM_WARE_PRODUCT.VmWareCloudBackup,
32
+ platform: PLATFORM.VmWare,
33
+ dataTestId: VM_WARE_PRODUCT.VmWareCloudBackup,
34
+ label: 'VMware: резервное копирование в облако',
35
+ caption: 'Защита от потери данных, кибератак и сбоев приложений',
36
+ formConfig: VM_WARE_CLOUD_BACKUP_FORM_CONFIG,
37
+ icon: BackupSVG,
38
+ enableChangeProductQuantity: false,
39
+ hasPayaGo: true,
40
+ },
41
+ [VM_WARE_PRODUCT.VmWareVirtualMachinesBackup]: {
42
+ id: VM_WARE_PRODUCT.VmWareVirtualMachinesBackup,
43
+ platform: PLATFORM.VmWare,
44
+ dataTestId: VM_WARE_PRODUCT.VmWareVirtualMachinesBackup,
45
+ label: 'VMware: резервное копирование виртуальных машин',
46
+ caption: 'Сервис по созданию резервных копий, восстановлению виртуальных машин и отдельных файлов',
47
+ formConfig: VM_WARE_VIRTUAL_MACHINES_BACKUP_FORM_CONFIG,
48
+ icon: VmBackupSVG,
49
+ enableChangeProductQuantity: false,
50
+ hasPayaGo: true,
51
+ },
52
+ [VM_WARE_PRODUCT.VmWareVirtualWorkspaces]: {
53
+ id: VM_WARE_PRODUCT.VmWareVirtualWorkspaces,
54
+ platform: PLATFORM.VmWare,
55
+ dataTestId: VM_WARE_PRODUCT.VmWareVirtualWorkspaces,
56
+ label: 'VMware: Удаленные рабочие столы (VDI)',
57
+ caption: 'Виртуальные рабочие столы на платформе Облако VMware',
58
+ formConfig: VM_WARE_VIRTUAL_WORKSPACES_FORM_CONFIG,
59
+ icon: VirtualDesktopInfrastructureSVG,
60
+ enableChangeProductQuantity: false,
61
+ hasPayaGo: true,
62
+ },
63
+ };
@@ -0,0 +1,9 @@
1
+ .tip {
2
+ margin: 0;
3
+ padding: 0 0 0 16px;
4
+ list-style-type: disc;
5
+
6
+ li {
7
+ list-style-type: disc;
8
+ }
9
+ }
@@ -0,0 +1,94 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+
3
+ import { CONTROL, ObjectControl, SelectSingleControl, StepperControl } from '../../components';
4
+
5
+ export const SpecificationItem = {
6
+ HDD: 'SAS',
7
+ SSD: 'SSD',
8
+ ESSD: 'ESSD',
9
+ } as const;
10
+
11
+ export const specificationItems = [
12
+ {
13
+ value: SpecificationItem.HDD,
14
+ label: 'HDD',
15
+ },
16
+ {
17
+ value: SpecificationItem.SSD,
18
+ label: 'SSD',
19
+ },
20
+ ];
21
+
22
+ type DiskSpecification = ValueOf<typeof SpecificationItem>;
23
+
24
+ type GetDiskProps = {
25
+ space: Pick<
26
+ Partial<StepperControl>,
27
+ 'defaultValue' | 'accessorKey' | 'uiProps' | 'watchedControls' | 'relateFn' | 'onChangeFn' | 'decoratorProps'
28
+ > & {
29
+ label?: string;
30
+ };
31
+ specification: Pick<
32
+ Partial<SelectSingleControl>,
33
+ 'accessorKey' | 'items' | 'uiProps' | 'watchedControls' | 'relateFn' | 'onChangeFn'
34
+ > & {
35
+ defaultValue?: DiskSpecification;
36
+ };
37
+ };
38
+
39
+ export function getDisk({ space, specification }: GetDiskProps): ObjectControl {
40
+ const {
41
+ accessorKey: spaceKey = 'systemDisk.diskSpace',
42
+ label: spaceLabel = 'Объем диска',
43
+ uiProps: spaceUiProps,
44
+ defaultValue: spaceDefaultValue = 0,
45
+ decoratorProps: decoratorProps,
46
+ ...restSpace
47
+ } = space;
48
+
49
+ const {
50
+ accessorKey: specificationKey = 'systemDisk.specification',
51
+ items = specificationItems,
52
+ uiProps: specificationUiProps,
53
+ defaultValue: specificationDefaultValue = SpecificationItem.HDD,
54
+ ...restSpecification
55
+ } = specification;
56
+
57
+ return {
58
+ type: 'object',
59
+ ui: [{ controls: ['space', 'specification'] }],
60
+ controls: {
61
+ space: {
62
+ type: CONTROL.Stepper,
63
+ decoratorProps: {
64
+ label: spaceLabel,
65
+ ...decoratorProps,
66
+ },
67
+ accessorKey: spaceKey,
68
+ defaultValue: spaceDefaultValue,
69
+ uiProps: {
70
+ min: 0,
71
+ max: 9_999_999_999,
72
+ postfix: 'ГБ',
73
+ ...spaceUiProps,
74
+ },
75
+ ...restSpace,
76
+ },
77
+ specification: {
78
+ type: CONTROL.SelectSingle,
79
+ decoratorProps: {
80
+ label: '',
81
+ },
82
+ accessorKey: specificationKey,
83
+ defaultValue: specificationDefaultValue,
84
+ items: items,
85
+ uiProps: {
86
+ showClearButton: false,
87
+ searchable: false,
88
+ ...specificationUiProps,
89
+ },
90
+ ...restSpecification,
91
+ },
92
+ },
93
+ };
94
+ }
@@ -0,0 +1,94 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+
3
+ import { CONTROL, ObjectControl, SelectSingleControl, StepperControl } from '../../components';
4
+
5
+ export const SpecificationItem = {
6
+ Extreme_SSD: 'Extreme SSD',
7
+ Cloud_SSD: 'Cloud SSD',
8
+ ESSD: 'ESSD',
9
+ } as const;
10
+
11
+ export const specificationItems = [
12
+ {
13
+ value: SpecificationItem.Extreme_SSD,
14
+ label: 'Extreme SSD',
15
+ },
16
+ {
17
+ value: SpecificationItem.Cloud_SSD,
18
+ label: 'Cloud SSD',
19
+ },
20
+ ];
21
+
22
+ type DiskSpecification = ValueOf<typeof SpecificationItem>;
23
+
24
+ type GetDiskProps = {
25
+ space: Pick<
26
+ Partial<StepperControl>,
27
+ 'defaultValue' | 'accessorKey' | 'uiProps' | 'watchedControls' | 'relateFn' | 'onChangeFn' | 'decoratorProps'
28
+ > & {
29
+ label?: string;
30
+ };
31
+ specification: Pick<
32
+ Partial<SelectSingleControl>,
33
+ 'accessorKey' | 'items' | 'uiProps' | 'watchedControls' | 'relateFn' | 'onChangeFn'
34
+ > & {
35
+ defaultValue?: DiskSpecification;
36
+ };
37
+ };
38
+
39
+ export function getDisk({ space, specification }: GetDiskProps): ObjectControl {
40
+ const {
41
+ accessorKey: spaceKey = 'systemDisk.diskSpace',
42
+ label: spaceLabel = 'Объем диска',
43
+ uiProps: spaceUiProps,
44
+ defaultValue: spaceDefaultValue = 0,
45
+ decoratorProps: decoratorProps,
46
+ ...restSpace
47
+ } = space;
48
+
49
+ const {
50
+ accessorKey: specificationKey = 'systemDisk.specification',
51
+ items = specificationItems,
52
+ uiProps: specificationUiProps,
53
+ defaultValue: specificationDefaultValue = SpecificationItem.Cloud_SSD,
54
+ ...restSpecification
55
+ } = specification;
56
+
57
+ return {
58
+ type: 'object',
59
+ ui: ['space', 'specification'],
60
+ controls: {
61
+ space: {
62
+ type: CONTROL.Stepper,
63
+ decoratorProps: {
64
+ label: spaceLabel,
65
+ ...decoratorProps,
66
+ },
67
+ accessorKey: spaceKey,
68
+ defaultValue: spaceDefaultValue,
69
+ uiProps: {
70
+ min: 0,
71
+ max: 9_999_999_999,
72
+ postfix: 'ГБ',
73
+ ...spaceUiProps,
74
+ },
75
+ ...restSpace,
76
+ },
77
+ specification: {
78
+ type: CONTROL.SelectSingle,
79
+ decoratorProps: {
80
+ label: '',
81
+ },
82
+ accessorKey: specificationKey,
83
+ defaultValue: specificationDefaultValue,
84
+ items: items,
85
+ uiProps: {
86
+ showClearButton: false,
87
+ searchable: false,
88
+ ...specificationUiProps,
89
+ },
90
+ ...restSpecification,
91
+ },
92
+ },
93
+ };
94
+ }
@@ -0,0 +1,104 @@
1
+ import { CONTROL, ToggleObjectControl } from '../../components';
2
+
3
+ const SpecificationItem = {
4
+ Velocity: 'velocity',
5
+ Traffic: 'traffic',
6
+ };
7
+
8
+ const specificationItems = [
9
+ {
10
+ value: SpecificationItem.Velocity,
11
+ label: 'Пропускная способность',
12
+ },
13
+ {
14
+ value: SpecificationItem.Traffic,
15
+ label: 'Количество трафика',
16
+ },
17
+ ];
18
+
19
+ type GetEipProps = {
20
+ switchKey?: string;
21
+ velocityKey?: string;
22
+ trafficKey?: string;
23
+ specificationKey?: string;
24
+ };
25
+
26
+ export function getEip({
27
+ switchKey = 'eipIsNeeded',
28
+ velocityKey = 'eip.velocity',
29
+ trafficKey = 'eip.trafficKey',
30
+ specificationKey = 'eip.specification',
31
+ }: GetEipProps): ToggleObjectControl {
32
+ return {
33
+ type: CONTROL.ToggleObject,
34
+ switchKey,
35
+ decoratorProps: {
36
+ label: 'Доступ в интернет',
37
+ },
38
+ control: {
39
+ type: CONTROL.Object,
40
+ ui: [['specification', 'velocity', 'traffic']],
41
+ controls: {
42
+ velocity: {
43
+ type: CONTROL.Stepper,
44
+ accessorKey: velocityKey,
45
+ defaultValue: 100,
46
+ decoratorProps: {
47
+ label: 'Скорость',
48
+ labelTooltip: 'Пропускная способность выделенной сети',
49
+ },
50
+ uiProps: {
51
+ min: 1,
52
+ max: 2000,
53
+ step: 1,
54
+ postfix: 'Mбит/сек',
55
+ },
56
+ watchedControls: { specification: specificationKey },
57
+ relateFn: ({ specification }) => {
58
+ if (specification === SpecificationItem.Traffic) {
59
+ return {
60
+ uiProps: {
61
+ visible: false,
62
+ },
63
+ };
64
+ }
65
+ },
66
+ },
67
+ traffic: {
68
+ type: CONTROL.Stepper,
69
+ accessorKey: trafficKey,
70
+ defaultValue: 1,
71
+ decoratorProps: {
72
+ label: 'Количество трафика',
73
+ },
74
+ uiProps: {
75
+ min: 1,
76
+ max: 9_999_999_999,
77
+ showHint: false,
78
+ postfix: 'ГБ',
79
+ step: 1,
80
+ },
81
+ watchedControls: { specification: specificationKey },
82
+ relateFn: ({ specification }) => {
83
+ if (specification === SpecificationItem.Velocity) {
84
+ return {
85
+ uiProps: {
86
+ visible: false,
87
+ },
88
+ };
89
+ }
90
+ },
91
+ },
92
+ specification: {
93
+ type: CONTROL.SelectSingle,
94
+ accessorKey: specificationKey,
95
+ defaultValue: SpecificationItem.Velocity,
96
+ items: specificationItems,
97
+ decoratorProps: {
98
+ label: 'Способ тарификации доступа в интернет',
99
+ },
100
+ },
101
+ },
102
+ },
103
+ };
104
+ }
@@ -0,0 +1,52 @@
1
+ import { WorkingHoursSpecification } from '../../constants';
2
+
3
+ export const generateCpuItems = (items: number[]) => items.map(item => ({ value: String(item), label: `${item} Шт` }));
4
+ export const generateRamItems = (items: number[]) => items.map(item => ({ value: String(item), label: `${item} ГБ` }));
5
+ export function generateInstanceConfigItems(items: [number, number][], valuesPostfixes?: [string, string]) {
6
+ const { 0: fisrtPostfix = 'vCPU', 1: secondPostfix = 'ГБ RAM' } = valuesPostfixes ?? [];
7
+
8
+ return items.map(([cpu, ram]) => ({
9
+ value: [cpu, ram].join(' '),
10
+ label: `${cpu}${fisrtPostfix}, ${ram}${secondPostfix}`,
11
+ }));
12
+ }
13
+ export function generateBaseItems(arr: (string | number)[], labelReplacerFn?: (value: string) => string) {
14
+ return arr.map(item => ({
15
+ value: String(item),
16
+ label: labelReplacerFn ? labelReplacerFn(String(item)) : String(item),
17
+ }));
18
+ }
19
+
20
+ export * from './disk';
21
+ export * from './eip';
22
+ export * from './obs';
23
+
24
+ export const getNumeralWord = (value: number, words: string[]) => {
25
+ const newValue = Math.abs(value) % 100;
26
+ const num = value % 10;
27
+
28
+ if (newValue > 10 && newValue < 20) return words[2];
29
+ if (num > 1 && num < 5) return words[1];
30
+ if (num === 1) return words[0];
31
+ return words[2];
32
+ };
33
+
34
+ export const getMaxWorkingHoursAmount = (
35
+ period: WorkingHoursSpecification,
36
+ maxHours: {
37
+ hour: number;
38
+ day: number;
39
+ month: number;
40
+ },
41
+ ) => {
42
+ switch (period) {
43
+ case WorkingHoursSpecification.Hour:
44
+ return maxHours.hour;
45
+ case WorkingHoursSpecification.Day:
46
+ return maxHours.day;
47
+ case WorkingHoursSpecification.Month:
48
+ return maxHours.month;
49
+ default:
50
+ return 1;
51
+ }
52
+ };