@postgres.ai/shared 3.5.0-pr-1027 → 3.5.0-pr-1035.1

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 (503) hide show
  1. package/components/AlertSnackbar/index.d.ts +2 -0
  2. package/components/AlertSnackbar/index.js +8 -0
  3. package/components/AlertSnackbar/useAlertSnackbar.d.ts +16 -0
  4. package/components/AlertSnackbar/useAlertSnackbar.js +37 -0
  5. package/components/Button/index.d.ts +7 -0
  6. package/components/Button/index.js +40 -0
  7. package/components/Button2/index.d.ts +13 -0
  8. package/components/Button2/index.js +10 -0
  9. package/components/DestroyCloneModal/index.d.ts +9 -0
  10. package/components/DestroyCloneModal/index.js +23 -0
  11. package/components/DestroyCloneRestrictionModal/index.d.ts +11 -0
  12. package/components/DestroyCloneRestrictionModal/index.js +16 -0
  13. package/components/ErrorStub/index.d.ts +11 -0
  14. package/components/ErrorStub/index.js +42 -0
  15. package/components/FormattedText/index.d.ts +7 -0
  16. package/components/FormattedText/index.js +23 -0
  17. package/components/GatewayLink/index.d.ts +4 -0
  18. package/components/GatewayLink/index.js +13 -0
  19. package/components/HorizontalScrollContainer/index.d.ts +13 -0
  20. package/components/HorizontalScrollContainer/index.js +72 -0
  21. package/components/HorizontalScrollContainer/types.d.ts +5 -0
  22. package/components/HorizontalScrollContainer/{types.ts → types.js} +1 -6
  23. package/components/HorizontalScrollContainer/utils.d.ts +3 -0
  24. package/components/HorizontalScrollContainer/utils.js +12 -0
  25. package/components/ImportantText/index.d.ts +6 -0
  26. package/components/ImportantText/index.js +12 -0
  27. package/components/Link2/index.d.ts +7 -0
  28. package/components/Link2/index.js +17 -0
  29. package/components/MenuButton/index.d.ts +24 -0
  30. package/components/MenuButton/index.js +16 -0
  31. package/components/Modal/index.d.ts +15 -0
  32. package/components/Modal/index.js +35 -0
  33. package/components/PageSpinner/index.d.ts +2 -0
  34. package/components/PageSpinner/{index.tsx → index.js} +5 -11
  35. package/components/ResetCloneModal/index.d.ts +13 -0
  36. package/components/ResetCloneModal/index.js +87 -0
  37. package/components/SectionTitle/index.d.ts +12 -0
  38. package/components/SectionTitle/index.js +31 -0
  39. package/components/Select/index.d.ts +18 -0
  40. package/components/Select/index.js +9 -0
  41. package/components/SimpleModalControls/index.d.ts +11 -0
  42. package/components/SimpleModalControls/index.js +19 -0
  43. package/components/Spinner/icon.d.ts +4 -0
  44. package/components/Spinner/icon.js +2 -0
  45. package/components/Spinner/index.d.ts +7 -0
  46. package/components/Spinner/index.js +8 -0
  47. package/components/Status/index.d.ts +12 -0
  48. package/components/Status/index.js +23 -0
  49. package/components/StubContainer/index.d.ts +7 -0
  50. package/components/StubContainer/index.js +14 -0
  51. package/components/StubSpinner/index.d.ts +8 -0
  52. package/components/StubSpinner/index.js +29 -0
  53. package/components/StubSpinnerFlex/index.d.ts +9 -0
  54. package/components/StubSpinnerFlex/index.js +8 -0
  55. package/components/SyntaxHighlight/index.d.ts +7 -0
  56. package/components/SyntaxHighlight/index.js +65 -0
  57. package/components/Table/RowMenu/index.d.ts +14 -0
  58. package/components/Table/RowMenu/index.js +50 -0
  59. package/components/Table/index.d.ts +12 -0
  60. package/components/Table/index.js +58 -0
  61. package/components/Text/index.d.ts +6 -0
  62. package/components/Text/index.js +11 -0
  63. package/components/TextField/index.d.ts +27 -0
  64. package/components/TextField/index.js +43 -0
  65. package/components/Tooltip/index.d.ts +12 -0
  66. package/components/Tooltip/index.js +19 -0
  67. package/config/index.d.ts +8 -0
  68. package/config/index.js +23 -0
  69. package/config/links.d.ts +6 -0
  70. package/config/links.js +6 -0
  71. package/helpers/getEntropy.d.ts +3 -0
  72. package/helpers/getEntropy.js +212 -0
  73. package/helpers/localStorage.d.ts +6 -0
  74. package/helpers/localStorage.js +13 -0
  75. package/helpers/request.d.ts +7 -0
  76. package/helpers/request.js +35 -0
  77. package/hooks/useWindowDimensions.d.ts +1 -0
  78. package/hooks/useWindowDimensions.js +12 -0
  79. package/icons/ArrowDropDown/index.d.ts +6 -0
  80. package/icons/ArrowDropDown/index.js +6 -0
  81. package/icons/Circle/index.d.ts +6 -0
  82. package/icons/Circle/index.js +5 -0
  83. package/icons/External/index.d.ts +4 -0
  84. package/icons/External/index.js +2 -0
  85. package/icons/Info/index.d.ts +4 -0
  86. package/icons/Info/index.js +2 -0
  87. package/icons/Renewable/index.d.ts +6 -0
  88. package/icons/Renewable/index.js +12 -0
  89. package/icons/Shield/index.d.ts +6 -0
  90. package/icons/Shield/index.js +12 -0
  91. package/icons/Warning/index.d.ts +6 -0
  92. package/icons/Warning/index.js +6 -0
  93. package/package.json +5 -13
  94. package/pages/Clone/Status/index.d.ts +8 -0
  95. package/pages/Clone/Status/index.js +38 -0
  96. package/pages/Clone/context.d.ts +19 -0
  97. package/pages/Clone/context.js +3 -0
  98. package/pages/Clone/index.d.ts +7 -0
  99. package/pages/Clone/index.js +221 -0
  100. package/pages/Clone/stores/Main.d.ts +45 -0
  101. package/pages/Clone/stores/Main.js +141 -0
  102. package/pages/Clone/useCreatedStores.d.ts +6 -0
  103. package/pages/Clone/useCreatedStores.js +5 -0
  104. package/pages/Configuration/Header/index.d.ts +11 -0
  105. package/pages/Configuration/Header/index.js +17 -0
  106. package/pages/Configuration/InputWithTooltip/index.d.ts +32 -0
  107. package/pages/Configuration/InputWithTooltip/index.js +60 -0
  108. package/pages/Configuration/ResponseMessage/index.d.ts +5 -0
  109. package/pages/Configuration/ResponseMessage/index.js +43 -0
  110. package/pages/Configuration/configOptions.d.ts +9 -0
  111. package/pages/Configuration/configOptions.js +59 -0
  112. package/pages/Configuration/index.d.ts +9 -0
  113. package/pages/Configuration/index.js +544 -0
  114. package/pages/Configuration/tooltipText.d.ts +20 -0
  115. package/pages/Configuration/tooltipText.js +21 -0
  116. package/pages/Configuration/useForm.d.ts +82 -0
  117. package/pages/Configuration/useForm.js +74 -0
  118. package/pages/Configuration/utils/index.d.ts +22 -0
  119. package/pages/Configuration/utils/index.js +105 -0
  120. package/pages/CreateClone/index.d.ts +17 -0
  121. package/pages/CreateClone/index.js +90 -0
  122. package/pages/CreateClone/stores/Main.d.ts +26 -0
  123. package/pages/CreateClone/stores/Main.js +61 -0
  124. package/pages/CreateClone/useCreatedStores.d.ts +6 -0
  125. package/pages/CreateClone/useCreatedStores.js +5 -0
  126. package/pages/CreateClone/useForm.d.ts +54 -0
  127. package/pages/CreateClone/useForm.js +25 -0
  128. package/pages/Instance/Clones/Header/Item/index.d.ts +7 -0
  129. package/pages/Instance/Clones/Header/Item/index.js +5 -0
  130. package/pages/Instance/Clones/Header/index.d.ts +9 -0
  131. package/pages/Instance/Clones/Header/index.js +16 -0
  132. package/pages/Instance/Clones/index.d.ts +4 -0
  133. package/pages/Instance/Clones/index.js +66 -0
  134. package/pages/Instance/ClonesModal/index.d.ts +4 -0
  135. package/pages/Instance/ClonesModal/index.js +38 -0
  136. package/pages/Instance/ClonesModal/utils.d.ts +7 -0
  137. package/pages/Instance/ClonesModal/utils.js +14 -0
  138. package/pages/Instance/InactiveInstance/index.d.ts +6 -0
  139. package/pages/Instance/InactiveInstance/index.js +65 -0
  140. package/pages/Instance/InactiveInstance/utils.d.ts +2 -0
  141. package/pages/Instance/InactiveInstance/utils.js +7 -0
  142. package/pages/Instance/Info/Connection/ConnectModal/Content/index.d.ts +4 -0
  143. package/pages/Instance/Info/Connection/ConnectModal/Content/index.js +73 -0
  144. package/pages/Instance/Info/Connection/ConnectModal/Content/utils.d.ts +3 -0
  145. package/pages/Instance/Info/Connection/ConnectModal/Content/utils.js +20 -0
  146. package/pages/Instance/Info/Connection/ConnectModal/index.d.ts +6 -0
  147. package/pages/Instance/Info/Connection/ConnectModal/index.js +17 -0
  148. package/pages/Instance/Info/Connection/index.d.ts +4 -0
  149. package/pages/Instance/Info/Connection/index.js +44 -0
  150. package/pages/Instance/Info/Details/index.d.ts +2 -0
  151. package/pages/Instance/Info/Details/index.js +6 -0
  152. package/pages/Instance/Info/Disks/Disk/ActionsMenu/index.d.ts +8 -0
  153. package/pages/Instance/Info/Disks/Disk/ActionsMenu/index.js +47 -0
  154. package/pages/Instance/Info/Disks/Disk/Marker/index.d.ts +6 -0
  155. package/pages/Instance/Info/Disks/Disk/Marker/index.js +15 -0
  156. package/pages/Instance/Info/Disks/Disk/ProgressBar/PointerIcon.d.ts +5 -0
  157. package/pages/Instance/Info/Disks/Disk/ProgressBar/PointerIcon.js +2 -0
  158. package/pages/Instance/Info/Disks/Disk/ProgressBar/index.d.ts +8 -0
  159. package/pages/Instance/Info/Disks/Disk/ProgressBar/index.js +45 -0
  160. package/pages/Instance/Info/Disks/Disk/Status/index.d.ts +6 -0
  161. package/pages/Instance/Info/Disks/Disk/Status/index.js +52 -0
  162. package/pages/Instance/Info/Disks/Disk/index.d.ts +15 -0
  163. package/pages/Instance/Info/Disks/Disk/index.js +69 -0
  164. package/pages/Instance/Info/Disks/index.d.ts +4 -0
  165. package/pages/Instance/Info/Disks/index.js +24 -0
  166. package/pages/Instance/Info/Icons/index.d.ts +7 -0
  167. package/pages/Instance/Info/Icons/index.js +3 -0
  168. package/pages/Instance/Info/Retrieval/RefreshFailedAlert/index.d.ts +4 -0
  169. package/pages/Instance/Info/Retrieval/RefreshFailedAlert/index.js +15 -0
  170. package/pages/Instance/Info/Retrieval/RetrievalModal/index.d.ts +10 -0
  171. package/pages/Instance/Info/Retrieval/RetrievalModal/index.js +15 -0
  172. package/pages/Instance/Info/Retrieval/RetrievalTable/index.d.ts +6 -0
  173. package/pages/Instance/Info/Retrieval/RetrievalTable/index.js +6 -0
  174. package/pages/Instance/Info/Retrieval/index.d.ts +4 -0
  175. package/pages/Instance/Info/Retrieval/index.js +49 -0
  176. package/pages/Instance/Info/Retrieval/utils.d.ts +2 -0
  177. package/pages/Instance/Info/Retrieval/utils.js +12 -0
  178. package/pages/Instance/Info/Snapshots/Calendar/Day/index.d.ts +11 -0
  179. package/pages/Instance/Info/Snapshots/Calendar/Day/index.js +71 -0
  180. package/pages/Instance/Info/Snapshots/Calendar/index.d.ts +8 -0
  181. package/pages/Instance/Info/Snapshots/Calendar/index.js +67 -0
  182. package/pages/Instance/Info/Snapshots/Calendar/utils.d.ts +23 -0
  183. package/pages/Instance/Info/Snapshots/Calendar/utils.js +41 -0
  184. package/pages/Instance/Info/Snapshots/TimeLine/Day/index.d.ts +6 -0
  185. package/pages/Instance/Info/Snapshots/TimeLine/Day/index.js +58 -0
  186. package/pages/Instance/Info/Snapshots/TimeLine/index.d.ts +2 -0
  187. package/pages/Instance/Info/Snapshots/TimeLine/index.js +32 -0
  188. package/pages/Instance/Info/Snapshots/index.d.ts +4 -0
  189. package/pages/Instance/Info/Snapshots/index.js +35 -0
  190. package/pages/Instance/Info/Snapshots/utils.d.ts +23 -0
  191. package/pages/Instance/Info/Snapshots/utils.js +16 -0
  192. package/pages/Instance/Info/Status/InstanceResponseModal/index.d.ts +9 -0
  193. package/pages/Instance/Info/Status/InstanceResponseModal/index.js +12 -0
  194. package/pages/Instance/Info/Status/index.d.ts +4 -0
  195. package/pages/Instance/Info/Status/index.js +31 -0
  196. package/pages/Instance/Info/Status/utils.d.ts +8 -0
  197. package/pages/Instance/Info/Status/utils.js +23 -0
  198. package/pages/Instance/Info/components/Property/index.d.ts +11 -0
  199. package/pages/Instance/Info/components/Property/index.js +14 -0
  200. package/pages/Instance/Info/components/Section/index.d.ts +8 -0
  201. package/pages/Instance/Info/components/Section/index.js +18 -0
  202. package/pages/Instance/Info/components/ValueStatus/index.d.ts +9 -0
  203. package/pages/Instance/Info/components/ValueStatus/index.js +18 -0
  204. package/pages/Instance/Info/index.d.ts +2 -0
  205. package/pages/Instance/Info/index.js +75 -0
  206. package/pages/Instance/SnapshotsModal/index.d.ts +4 -0
  207. package/pages/Instance/SnapshotsModal/index.js +81 -0
  208. package/pages/Instance/SnapshotsModal/utils.d.ts +7 -0
  209. package/{components/HorizontalScrollContainer/utils.ts → pages/Instance/SnapshotsModal/utils.js} +8 -9
  210. package/pages/Instance/Tabs/index.d.ts +9 -0
  211. package/pages/Instance/Tabs/index.js +40 -0
  212. package/pages/Instance/components/ClonesList/ConnectionModal/index.d.ts +10 -0
  213. package/pages/Instance/components/ClonesList/ConnectionModal/index.js +74 -0
  214. package/pages/Instance/components/ClonesList/MenuCell/index.d.ts +11 -0
  215. package/pages/Instance/components/ClonesList/MenuCell/index.js +49 -0
  216. package/pages/Instance/components/ClonesList/MenuCell/utils.d.ts +3 -0
  217. package/pages/Instance/components/ClonesList/MenuCell/utils.js +18 -0
  218. package/pages/Instance/components/ClonesList/index.d.ts +9 -0
  219. package/pages/Instance/components/ClonesList/index.js +52 -0
  220. package/pages/Instance/components/ErrorStub/index.d.ts +9 -0
  221. package/pages/Instance/components/ErrorStub/index.js +42 -0
  222. package/pages/Instance/components/ModalReloadButton/index.d.ts +7 -0
  223. package/pages/Instance/components/ModalReloadButton/index.js +22 -0
  224. package/pages/Instance/components/Tags/Tag/index.d.ts +7 -0
  225. package/pages/Instance/components/Tags/Tag/index.js +35 -0
  226. package/pages/Instance/components/Tags/index.d.ts +8 -0
  227. package/pages/Instance/components/Tags/index.js +16 -0
  228. package/pages/Instance/context.d.ts +31 -0
  229. package/pages/Instance/{ClonesModal/utils.ts → context.js} +5 -15
  230. package/pages/Instance/index.d.ts +8 -0
  231. package/pages/Instance/index.js +93 -0
  232. package/pages/Instance/stores/ClonesModal.d.ts +13 -0
  233. package/pages/Instance/stores/ClonesModal.js +24 -0
  234. package/pages/Instance/stores/Main.d.ts +115 -0
  235. package/pages/Instance/stores/Main.js +243 -0
  236. package/pages/Instance/stores/SnapshotsModal.d.ts +13 -0
  237. package/pages/Instance/stores/SnapshotsModal.js +24 -0
  238. package/pages/Instance/useCreatedStores.d.ts +10 -0
  239. package/pages/Instance/useCreatedStores.js +9 -0
  240. package/pages/Logs/Icons/PlusIcon.d.ts +2 -0
  241. package/pages/Logs/Icons/PlusIcon.js +2 -0
  242. package/pages/Logs/constants/index.d.ts +5 -0
  243. package/pages/Logs/constants/index.js +5 -0
  244. package/pages/Logs/hooks/useWsScroll.d.ts +1 -0
  245. package/pages/Logs/hooks/useWsScroll.js +39 -0
  246. package/pages/Logs/index.d.ts +5 -0
  247. package/pages/Logs/index.js +189 -0
  248. package/pages/Logs/utils/index.d.ts +2 -0
  249. package/pages/Logs/utils/index.js +15 -0
  250. package/pages/Logs/wsLogs.d.ts +2 -0
  251. package/pages/Logs/wsLogs.js +76 -0
  252. package/pages/Logs/wsSnackbar.d.ts +1 -0
  253. package/pages/Logs/wsSnackbar.js +25 -0
  254. package/stores/Snapshots.d.ts +15 -0
  255. package/stores/Snapshots.js +35 -0
  256. package/styles/colors.d.ts +60 -0
  257. package/styles/colors.js +66 -0
  258. package/styles/icons.d.ts +63 -0
  259. package/styles/icons.js +69 -0
  260. package/styles/styles.d.ts +1 -0
  261. package/styles/styles.js +83 -0
  262. package/styles/theme.d.ts +1 -0
  263. package/styles/theme.js +50 -0
  264. package/styles/vars.d.ts +25 -0
  265. package/styles/{vars.ts → vars.js} +20 -28
  266. package/types/api/endpoints/createClone.d.ts +12 -0
  267. package/types/api/endpoints/createClone.js +1 -0
  268. package/types/api/endpoints/destroyClone.d.ts +7 -0
  269. package/types/api/endpoints/destroyClone.js +1 -0
  270. package/types/api/endpoints/getClone.d.ts +8 -0
  271. package/types/api/endpoints/getClone.js +1 -0
  272. package/types/api/endpoints/getConfig.d.ts +5 -0
  273. package/types/api/endpoints/getConfig.js +1 -0
  274. package/types/api/endpoints/getEngine.d.ts +10 -0
  275. package/types/api/endpoints/getEngine.js +1 -0
  276. package/types/api/endpoints/getFullConfig.d.ts +4 -0
  277. package/types/api/endpoints/getFullConfig.js +1 -0
  278. package/types/api/endpoints/getInstance.d.ts +7 -0
  279. package/types/api/endpoints/getInstance.js +1 -0
  280. package/types/api/endpoints/getInstanceRetrieval.d.ts +7 -0
  281. package/types/api/endpoints/getInstanceRetrieval.js +1 -0
  282. package/types/api/endpoints/getSeImages.d.ts +19 -0
  283. package/types/api/endpoints/getSeImages.js +1 -0
  284. package/types/api/endpoints/getSnapshots.d.ts +7 -0
  285. package/types/api/endpoints/getSnapshots.js +1 -0
  286. package/types/api/endpoints/getWSToken.d.ts +7 -0
  287. package/types/api/endpoints/getWSToken.js +1 -0
  288. package/types/api/endpoints/initWS.d.ts +1 -0
  289. package/types/api/endpoints/initWS.js +1 -0
  290. package/types/api/endpoints/refreshInstance.d.ts +6 -0
  291. package/types/api/endpoints/refreshInstance.js +1 -0
  292. package/types/api/endpoints/resetClone.d.ts +8 -0
  293. package/types/api/endpoints/resetClone.js +1 -0
  294. package/types/api/endpoints/testDbSource.d.ts +22 -0
  295. package/types/api/endpoints/testDbSource.js +23 -0
  296. package/types/api/endpoints/updateClone.d.ts +10 -0
  297. package/types/api/endpoints/updateClone.js +1 -0
  298. package/types/api/endpoints/updateConfig.d.ts +5 -0
  299. package/types/api/endpoints/updateConfig.js +1 -0
  300. package/types/api/entities/clone.d.ts +50 -0
  301. package/{components/Text/index.tsx → types/api/entities/clone.js} +8 -22
  302. package/types/api/entities/config.d.ts +72 -0
  303. package/types/api/entities/config.js +35 -0
  304. package/types/api/entities/dbSource.d.ts +12 -0
  305. package/types/api/entities/dbSource.js +1 -0
  306. package/types/api/entities/instance.d.ts +109 -0
  307. package/types/api/entities/instance.js +31 -0
  308. package/types/api/entities/instanceRetrieval.d.ts +42 -0
  309. package/types/api/entities/instanceRetrieval.js +19 -0
  310. package/types/api/entities/instanceState.d.ts +109 -0
  311. package/types/api/entities/instanceState.js +42 -0
  312. package/types/api/entities/pool.d.ts +18 -0
  313. package/{utils/numbers.ts → types/api/entities/pool.js} +1 -5
  314. package/types/api/entities/snapshot.d.ts +19 -0
  315. package/types/api/entities/snapshot.js +6 -0
  316. package/types/api/entities/wsToken.d.ts +5 -0
  317. package/types/api/entities/wsToken.js +1 -0
  318. package/utils/api.d.ts +1 -0
  319. package/utils/api.js +28 -0
  320. package/utils/clone.d.ts +13 -0
  321. package/utils/clone.js +21 -0
  322. package/utils/connection.d.ts +5 -0
  323. package/utils/connection.js +28 -0
  324. package/utils/date.d.ts +16 -0
  325. package/utils/date.js +33 -0
  326. package/utils/instance.d.ts +5 -0
  327. package/utils/instance.js +11 -0
  328. package/utils/numbers.d.ts +1 -0
  329. package/utils/{strings.ts → numbers.js} +4 -5
  330. package/utils/react.d.ts +5 -0
  331. package/utils/react.js +8 -0
  332. package/utils/snapshot.d.ts +2 -0
  333. package/utils/snapshot.js +1 -0
  334. package/utils/strings.d.ts +1 -0
  335. package/utils/strings.js +10 -0
  336. package/utils/units.d.ts +5 -0
  337. package/utils/units.js +15 -0
  338. package/.gitlab-ci.yml +0 -64
  339. package/components/AlertSnackbar/index.tsx +0 -23
  340. package/components/AlertSnackbar/useAlertSnackbar.tsx +0 -65
  341. package/components/Button/index.tsx +0 -79
  342. package/components/Button2/index.tsx +0 -43
  343. package/components/DestroyCloneModal/index.tsx +0 -56
  344. package/components/DestroyCloneRestrictionModal/index.tsx +0 -50
  345. package/components/ErrorStub/index.tsx +0 -83
  346. package/components/FormattedText/index.tsx +0 -44
  347. package/components/GatewayLink/index.tsx +0 -33
  348. package/components/HorizontalScrollContainer/index.tsx +0 -131
  349. package/components/ImportantText/index.tsx +0 -29
  350. package/components/Link2/index.tsx +0 -31
  351. package/components/MenuButton/index.tsx +0 -80
  352. package/components/Modal/index.tsx +0 -93
  353. package/components/ResetCloneModal/index.tsx +0 -154
  354. package/components/SectionTitle/index.tsx +0 -74
  355. package/components/Select/index.tsx +0 -42
  356. package/components/SimpleModalControls/index.tsx +0 -56
  357. package/components/Spinner/icon.tsx +0 -29
  358. package/components/Spinner/index.tsx +0 -16
  359. package/components/Status/index.tsx +0 -61
  360. package/components/StubContainer/index.tsx +0 -41
  361. package/components/StubSpinner/index.tsx +0 -49
  362. package/components/StubSpinnerFlex/index.tsx +0 -20
  363. package/components/SyntaxHighlight/index.tsx +0 -107
  364. package/components/Table/RowMenu/index.tsx +0 -111
  365. package/components/Table/index.tsx +0 -140
  366. package/components/TextField/index.tsx +0 -117
  367. package/components/Tooltip/index.tsx +0 -52
  368. package/config/index.ts +0 -32
  369. package/config/links.ts +0 -6
  370. package/craco.config.js +0 -80
  371. package/helpers/getEntropy.ts +0 -232
  372. package/helpers/localStorage.ts +0 -15
  373. package/helpers/request.ts +0 -47
  374. package/hooks/useWindowDimensions.ts +0 -16
  375. package/icons/ArrowDropDown/index.tsx +0 -29
  376. package/icons/Circle/index.tsx +0 -27
  377. package/icons/External/index.tsx +0 -14
  378. package/icons/Info/index.tsx +0 -12
  379. package/icons/Renewable/index.tsx +0 -65
  380. package/icons/Shield/index.tsx +0 -33
  381. package/icons/Warning/index.tsx +0 -29
  382. package/pages/Clone/Status/index.tsx +0 -73
  383. package/pages/Clone/context.ts +0 -22
  384. package/pages/Clone/index.tsx +0 -634
  385. package/pages/Clone/stores/Main.ts +0 -206
  386. package/pages/Clone/useCreatedStores.ts +0 -11
  387. package/pages/Configuration/Header/index.tsx +0 -84
  388. package/pages/Configuration/InputWithTooltip/index.tsx +0 -240
  389. package/pages/Configuration/ResponseMessage/index.tsx +0 -71
  390. package/pages/Configuration/configOptions.ts +0 -60
  391. package/pages/Configuration/index.tsx +0 -1184
  392. package/pages/Configuration/tooltipText.tsx +0 -157
  393. package/pages/Configuration/useForm.ts +0 -108
  394. package/pages/Configuration/utils/index.ts +0 -153
  395. package/pages/CreateClone/index.tsx +0 -311
  396. package/pages/CreateClone/stores/Main.ts +0 -107
  397. package/pages/CreateClone/useCreatedStores.ts +0 -11
  398. package/pages/CreateClone/useForm.ts +0 -36
  399. package/pages/Instance/Clones/Header/Item/index.tsx +0 -15
  400. package/pages/Instance/Clones/Header/index.tsx +0 -74
  401. package/pages/Instance/Clones/index.tsx +0 -135
  402. package/pages/Instance/ClonesModal/index.tsx +0 -71
  403. package/pages/Instance/InactiveInstance/index.tsx +0 -165
  404. package/pages/Instance/InactiveInstance/utils.ts +0 -9
  405. package/pages/Instance/Info/Connection/ConnectModal/Content/index.tsx +0 -176
  406. package/pages/Instance/Info/Connection/ConnectModal/Content/utils.ts +0 -24
  407. package/pages/Instance/Info/Connection/ConnectModal/index.tsx +0 -36
  408. package/pages/Instance/Info/Connection/index.tsx +0 -81
  409. package/pages/Instance/Info/Details/index.tsx +0 -20
  410. package/pages/Instance/Info/Disks/Disk/ActionsMenu/index.tsx +0 -100
  411. package/pages/Instance/Info/Disks/Disk/Marker/index.tsx +0 -26
  412. package/pages/Instance/Info/Disks/Disk/ProgressBar/PointerIcon.tsx +0 -20
  413. package/pages/Instance/Info/Disks/Disk/ProgressBar/index.tsx +0 -73
  414. package/pages/Instance/Info/Disks/Disk/Status/index.tsx +0 -75
  415. package/pages/Instance/Info/Disks/Disk/index.tsx +0 -168
  416. package/pages/Instance/Info/Disks/index.tsx +0 -65
  417. package/pages/Instance/Info/Icons/index.tsx +0 -39
  418. package/pages/Instance/Info/Retrieval/RefreshFailedAlert/index.tsx +0 -32
  419. package/pages/Instance/Info/Retrieval/RetrievalModal/index.tsx +0 -49
  420. package/pages/Instance/Info/Retrieval/RetrievalTable/index.tsx +0 -53
  421. package/pages/Instance/Info/Retrieval/index.tsx +0 -95
  422. package/pages/Instance/Info/Retrieval/utils.ts +0 -10
  423. package/pages/Instance/Info/Snapshots/Calendar/Day/index.tsx +0 -125
  424. package/pages/Instance/Info/Snapshots/Calendar/index.tsx +0 -133
  425. package/pages/Instance/Info/Snapshots/Calendar/utils.ts +0 -74
  426. package/pages/Instance/Info/Snapshots/TimeLine/Day/index.tsx +0 -79
  427. package/pages/Instance/Info/Snapshots/TimeLine/index.tsx +0 -57
  428. package/pages/Instance/Info/Snapshots/index.tsx +0 -97
  429. package/pages/Instance/Info/Snapshots/utils.ts +0 -18
  430. package/pages/Instance/Info/Status/InstanceResponseModal/index.tsx +0 -32
  431. package/pages/Instance/Info/Status/index.tsx +0 -85
  432. package/pages/Instance/Info/Status/utils.ts +0 -24
  433. package/pages/Instance/Info/components/Property/index.tsx +0 -32
  434. package/pages/Instance/Info/components/Section/index.tsx +0 -50
  435. package/pages/Instance/Info/components/ValueStatus/index.tsx +0 -51
  436. package/pages/Instance/Info/index.tsx +0 -129
  437. package/pages/Instance/SnapshotsModal/index.tsx +0 -169
  438. package/pages/Instance/SnapshotsModal/utils.ts +0 -17
  439. package/pages/Instance/Tabs/index.tsx +0 -98
  440. package/pages/Instance/components/ClonesList/ConnectionModal/index.tsx +0 -196
  441. package/pages/Instance/components/ClonesList/MenuCell/index.tsx +0 -98
  442. package/pages/Instance/components/ClonesList/MenuCell/utils.ts +0 -21
  443. package/pages/Instance/components/ClonesList/index.tsx +0 -189
  444. package/pages/Instance/components/ErrorStub/index.tsx +0 -77
  445. package/pages/Instance/components/ModalReloadButton/index.tsx +0 -43
  446. package/pages/Instance/components/Tags/Tag/index.tsx +0 -60
  447. package/pages/Instance/components/Tags/index.tsx +0 -42
  448. package/pages/Instance/context.ts +0 -39
  449. package/pages/Instance/index.tsx +0 -235
  450. package/pages/Instance/stores/ClonesModal.ts +0 -35
  451. package/pages/Instance/stores/Main.ts +0 -335
  452. package/pages/Instance/stores/SnapshotsModal.ts +0 -35
  453. package/pages/Instance/useCreatedStores.ts +0 -14
  454. package/pages/Logs/Icons/PlusIcon.tsx +0 -8
  455. package/pages/Logs/constants/index.ts +0 -7
  456. package/pages/Logs/hooks/useWsScroll.tsx +0 -44
  457. package/pages/Logs/index.tsx +0 -267
  458. package/pages/Logs/utils/index.ts +0 -20
  459. package/pages/Logs/wsLogs.ts +0 -110
  460. package/pages/Logs/wsSnackbar.ts +0 -27
  461. package/postgres.ai-shared-3.5.0.tgz +0 -0
  462. package/scripts/copy-assets.js +0 -30
  463. package/scripts/pack.js +0 -70
  464. package/stores/Snapshots.ts +0 -54
  465. package/styles/colors.ts +0 -67
  466. package/styles/icons.tsx +0 -1917
  467. package/styles/styles.ts +0 -87
  468. package/styles/theme.ts +0 -53
  469. package/types/api/endpoints/createClone.ts +0 -10
  470. package/types/api/endpoints/destroyClone.ts +0 -7
  471. package/types/api/endpoints/getClone.ts +0 -6
  472. package/types/api/endpoints/getConfig.ts +0 -6
  473. package/types/api/endpoints/getEngine.ts +0 -13
  474. package/types/api/endpoints/getFullConfig.ts +0 -4
  475. package/types/api/endpoints/getInstance.ts +0 -6
  476. package/types/api/endpoints/getInstanceRetrieval.ts +0 -6
  477. package/types/api/endpoints/getSeImages.ts +0 -22
  478. package/types/api/endpoints/getSnapshots.ts +0 -6
  479. package/types/api/endpoints/getWSToken.ts +0 -6
  480. package/types/api/endpoints/initWS.ts +0 -1
  481. package/types/api/endpoints/refreshInstance.ts +0 -4
  482. package/types/api/endpoints/resetClone.ts +0 -8
  483. package/types/api/endpoints/testDbSource.ts +0 -48
  484. package/types/api/endpoints/updateClone.ts +0 -10
  485. package/types/api/endpoints/updateConfig.ts +0 -6
  486. package/types/api/entities/clone.ts +0 -42
  487. package/types/api/entities/config.ts +0 -114
  488. package/types/api/entities/dbSource.ts +0 -13
  489. package/types/api/entities/instance.ts +0 -67
  490. package/types/api/entities/instanceRetrieval.ts +0 -46
  491. package/types/api/entities/instanceState.ts +0 -102
  492. package/types/api/entities/pool.ts +0 -27
  493. package/types/api/entities/snapshot.ts +0 -18
  494. package/types/api/entities/wsToken.ts +0 -7
  495. package/types/byte-size/index.d.ts +0 -22
  496. package/utils/api.ts +0 -30
  497. package/utils/clone.ts +0 -31
  498. package/utils/connection.ts +0 -38
  499. package/utils/date.ts +0 -87
  500. package/utils/instance.ts +0 -10
  501. package/utils/react.ts +0 -10
  502. package/utils/snapshot.ts +0 -4
  503. package/utils/units.ts +0 -23
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styles from './styles.module.scss';
3
+ export const tooltipText = {
4
+ dockerTag: () => (_jsx("div", { children: "Docker image version - latest ones listed first. If unsure, pick the top one" })),
5
+ dockerImage: () => (_jsxs("div", { children: ["Major PostgreSQL version (e.g., \"9.6\", \"15\"). For logical provisioning mode, the version used by DBLab doesn't need to match the version used on the source (although, it's recommended). ", _jsx("br", {}), "If you need a version that is not listed here, contact support."] })),
6
+ dockerImageType: () => (_jsxs("div", { children: ["Docker image used to run all database containers \u2013 clones, snapshot preparation containers, sync containers. Although such images are based on traditional Docker images for Postgres, DBLab expects slightly different behavior: e.g., Postgres is not the first process used to start container, so Postgres restarts are possible, they do not trigger container state change. For details, see", ' ', _jsx("a", { target: '_blank', href: 'https://postgres.ai/docs/database-lab/supported-databases', className: styles.externalLink, children: "the docs" }), "."] })),
7
+ sharedBuffers: () => (_jsxs("div", { children: ["Defines default buffer pool size of each Postgres instance managed by DBLab. Note, that this amount of RAM is immediately allocated at Postgres startup time. For example, if the machine running DBLab has 32 GiB of RAM, and the value used here is '1GB', then the theoretical limit of the number of clones is 32. Practically, this limit is even lower because some memory is consumed by various other processes. If you need more clones, reduce the value of", ' ', _jsx("span", { className: styles.firaCodeFont, children: "configs.shared_buffers" }), "."] })),
8
+ sharedPreloadLibraries: () => (_jsxs("div", { children: ["Specifies one or more shared libraries (comma-separated list) to be preloaded at Postgres server start (", _jsx("a", { target: '_blank', href: 'https://postgresqlco.nf/doc/en/param/shared_preload_libraries/', className: styles.externalLink, children: "details" }), "). If some libraries/extensions are missing, Postgres fails to start, so make sure that ", _jsx("span", { className: styles.firaCodeFont, children: "dockerImage" }), ' ', "used above contains all the needed extensions."] })),
9
+ host: () => (_jsx("div", { children: "Hostname/IP of database that will be used as source for data retrieval (full data refresh)." })),
10
+ port: () => (_jsx("div", { children: "Port of database that will be used as source for data retrieval (full data refresh)." })),
11
+ username: () => (_jsx("div", { children: "Username used to connect to database that will be used as source for data retrieval (full data refresh)." })),
12
+ password: () => (_jsx("div", { children: "Password used to connect to database that will be used as source for data retrieval (full data refresh)." })),
13
+ dbname: () => (_jsxs("div", { children: ["Database name used to connect to the source to run diagnostics queries. This database is not necesserarily to be copied (another field,", ' ', _jsx("span", { className: styles.firaCodeFont, children: "databases" }), ", defines which database to copy)."] })),
14
+ databases: () => (_jsx("div", { children: "Specifies list of databases Postgres server to copy at data retrieval (full data refresh). To specify multiple database names, provide each value in a separte line or use space as a divider. To copy all available databases, leave this value empty." })),
15
+ dumpParallelJobs: () => (_jsx("div", { children: "Number of parallel workers used to dump the source databases to disk. If the source is production server under load, it is not recommended to use more than 50% of its number of vCPUs. The higher number, the faster dumping is, but the higher risks of performance issues on the source (e.g., due to CPU or disk IO saturation)." })),
16
+ pgDumpCustomOptions: () => (_jsx("div", { children: "pg_dump options to be used to create a database dump, for example: '--exclude-schema=repack --exclude-schema=\"camelStyleSchemaName\"'. Note that due to security reasons, the current implementation supports only letters, numbers, hyphen, underscore, equal sign, and double quotes." })),
17
+ restoreParallelJobs: () => (_jsx("div", { children: "Number of parallel workers used to restore databases from dump to Postgres managed by DBLab. For initial data retrieval (very first data refresh), it is recommended to use the number of vCPUs available on machine running DBLab. With this approach, we have faster restore time, but we need to keep in mind that we can also have higher usage of CPU and disk IO on this machine (up to temporary saturation of resources). For subsequent refreshes, if DBLab is constantly used, it is recommended to reduce this value by 50% to keep some room for normal use of DBLab (such as work with clones)." })),
18
+ pgRestoreCustomOptions: () => (_jsx("div", { children: "pg_restore options to be used to restore from a database dump, for example: '--exclude-schema=repack --exclude-schema=\"camelStyleSchemaName\"'. Note that due to security reasons, the current implementation supports only letters, numbers, hyphen, underscore, equal sign, and double quotes." })),
19
+ timetable: () => (_jsxs("div", { children: ["Schedule for full data refreshes, in", ' ', _jsx("a", { target: '_blank', href: 'https://en.wikipedia.org/wiki/Cron#Overview', className: styles.externalLink, children: "crontab format" }), "."] })),
20
+ tuningParams: () => _jsx("div", { children: "Test" }),
21
+ };
@@ -0,0 +1,82 @@
1
+ /// <reference types="react" />
2
+ export declare type FormValues = {
3
+ debug: boolean;
4
+ dockerImage: string;
5
+ dockerTag: string;
6
+ dockerPath: string;
7
+ dockerImageType: string;
8
+ sharedBuffers: string;
9
+ sharedPreloadLibraries: string;
10
+ tuningParams: string;
11
+ timetable: string;
12
+ dbname: string;
13
+ host: string;
14
+ port: string;
15
+ username: string;
16
+ password: string;
17
+ databases: string;
18
+ dumpParallelJobs: string;
19
+ dumpIgnoreErrors: boolean;
20
+ restoreParallelJobs: string;
21
+ restoreIgnoreErrors: boolean;
22
+ pgDumpCustomOptions: string;
23
+ pgRestoreCustomOptions: string;
24
+ };
25
+ export declare const useForm: (onSubmit: (values: FormValues) => void) => {
26
+ formik: {
27
+ initialValues: FormValues;
28
+ initialErrors: import("formik").FormikErrors<unknown>;
29
+ initialTouched: import("formik").FormikTouched<unknown>;
30
+ initialStatus: any;
31
+ handleBlur: {
32
+ (e: import("react").FocusEvent<any, Element>): void;
33
+ <T = any>(fieldOrEvent: T): T extends string ? (e: any) => void : void;
34
+ };
35
+ handleChange: {
36
+ (e: import("react").ChangeEvent<any>): void;
37
+ <T_1 = string | import("react").ChangeEvent<any>>(field: T_1): T_1 extends import("react").ChangeEvent<any> ? void : (e: string | import("react").ChangeEvent<any>) => void;
38
+ };
39
+ handleReset: (e: any) => void;
40
+ handleSubmit: (e?: import("react").FormEvent<HTMLFormElement> | undefined) => void;
41
+ resetForm: (nextState?: Partial<import("formik").FormikState<FormValues>> | undefined) => void;
42
+ setErrors: (errors: import("formik").FormikErrors<FormValues>) => void;
43
+ setFormikState: (stateOrCb: import("formik").FormikState<FormValues> | ((state: import("formik").FormikState<FormValues>) => import("formik").FormikState<FormValues>)) => void;
44
+ setFieldTouched: (field: string, touched?: boolean | undefined, shouldValidate?: boolean | undefined) => Promise<void> | Promise<import("formik").FormikErrors<FormValues>>;
45
+ setFieldValue: (field: string, value: any, shouldValidate?: boolean | undefined) => Promise<void> | Promise<import("formik").FormikErrors<FormValues>>;
46
+ setFieldError: (field: string, value: string | undefined) => void;
47
+ setStatus: (status: any) => void;
48
+ setSubmitting: (isSubmitting: boolean) => void;
49
+ setTouched: (touched: import("formik").FormikTouched<FormValues>, shouldValidate?: boolean | undefined) => Promise<void> | Promise<import("formik").FormikErrors<FormValues>>;
50
+ setValues: (values: import("react").SetStateAction<FormValues>, shouldValidate?: boolean | undefined) => Promise<void> | Promise<import("formik").FormikErrors<FormValues>>;
51
+ submitForm: () => Promise<any>;
52
+ validateForm: (values?: FormValues | undefined) => Promise<import("formik").FormikErrors<FormValues>>;
53
+ validateField: (name: string) => Promise<void> | Promise<string | undefined>;
54
+ isValid: boolean;
55
+ dirty: boolean;
56
+ unregisterField: (name: string) => void;
57
+ registerField: (name: string, { validate }: any) => void;
58
+ getFieldProps: (nameOrOptions: any) => import("formik").FieldInputProps<any>;
59
+ getFieldMeta: (name: string) => import("formik").FieldMetaProps<any>;
60
+ getFieldHelpers: (name: string) => import("formik").FieldHelperProps<any>;
61
+ validateOnBlur: boolean;
62
+ validateOnChange: boolean;
63
+ validateOnMount: boolean;
64
+ values: FormValues;
65
+ errors: import("formik").FormikErrors<FormValues>;
66
+ touched: import("formik").FormikTouched<FormValues>;
67
+ isSubmitting: boolean;
68
+ isValidating: boolean;
69
+ status?: any;
70
+ submitCount: number;
71
+ };
72
+ connectionData: {
73
+ dockerImage?: string | undefined;
74
+ db_list?: string[] | undefined;
75
+ host: string;
76
+ port: string;
77
+ username: string;
78
+ password: string;
79
+ dbname: string;
80
+ };
81
+ isConnectionDataValid: string;
82
+ }[];
@@ -0,0 +1,74 @@
1
+ /*--------------------------------------------------------------------------
2
+ * Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
3
+ * All Rights Reserved. Proprietary and confidential.
4
+ * Unauthorized copying of this file, via any medium is strictly prohibited
5
+ *--------------------------------------------------------------------------
6
+ */
7
+ import { useFormik } from 'formik';
8
+ import * as Yup from 'yup';
9
+ const Schema = Yup.object().shape({
10
+ dockerImage: Yup.string().required('Docker image is required'),
11
+ dbname: Yup.string().required('Dbname is required'),
12
+ host: Yup.string().required('Host is required'),
13
+ port: Yup.string().required('Port is required'),
14
+ username: Yup.string().required('Username is required'),
15
+ });
16
+ export const useForm = (onSubmit) => {
17
+ const formik = useFormik({
18
+ initialValues: {
19
+ debug: false,
20
+ dockerImage: '',
21
+ dockerTag: '',
22
+ dockerPath: '',
23
+ dockerImageType: '',
24
+ sharedBuffers: '',
25
+ sharedPreloadLibraries: '',
26
+ tuningParams: '',
27
+ timetable: '',
28
+ dbname: '',
29
+ host: '',
30
+ port: '',
31
+ username: '',
32
+ password: '',
33
+ databases: '',
34
+ dumpParallelJobs: '',
35
+ restoreParallelJobs: '',
36
+ pgDumpCustomOptions: '',
37
+ pgRestoreCustomOptions: '',
38
+ dumpIgnoreErrors: false,
39
+ restoreIgnoreErrors: false,
40
+ },
41
+ validationSchema: Schema,
42
+ onSubmit,
43
+ validateOnBlur: false,
44
+ validateOnChange: false,
45
+ });
46
+ const formatDatabaseArray = (database) => {
47
+ let databases = [];
48
+ const splitDatabaseArray = database.split(/[,(\s)(\n)(\r)(\t)(\r\n)]/);
49
+ for (let i = 0; i < splitDatabaseArray.length; i++) {
50
+ if (splitDatabaseArray[i] !== '') {
51
+ databases.push(splitDatabaseArray[i]);
52
+ }
53
+ }
54
+ return databases;
55
+ };
56
+ const connectionData = {
57
+ host: formik.values.host,
58
+ port: formik.values.port,
59
+ username: formik.values.username,
60
+ password: formik.values.password,
61
+ dbname: formik.values.dbname,
62
+ ...(formik.values.databases && {
63
+ db_list: formatDatabaseArray(formik.values.databases),
64
+ }),
65
+ ...(formik.values.dockerImageType === 'custom' && {
66
+ dockerImage: formik.values.dockerImage,
67
+ }),
68
+ };
69
+ const isConnectionDataValid = formik.values.host &&
70
+ formik.values.port &&
71
+ formik.values.username &&
72
+ formik.values.dbname;
73
+ return [{ formik, connectionData, isConnectionDataValid }];
74
+ };
@@ -0,0 +1,22 @@
1
+ import { DatabaseType } from '@postgres.ai/shared/types/api/entities/config';
2
+ import { FormValues } from '../useForm';
3
+ export declare type FormValuesKey = keyof FormValues;
4
+ interface DockerImage {
5
+ package_group: string;
6
+ pg_major_version: string;
7
+ tag: string;
8
+ location: string;
9
+ }
10
+ export declare const uniqueChipValue: (values: string) => string;
11
+ export declare const postUniqueDatabases: (values: string) => {
12
+ [k: string]: string | Object;
13
+ } | null;
14
+ export declare const genericDockerImages: DockerImage[];
15
+ export declare const isSeDockerImage: (dockerImage: string | undefined) => boolean;
16
+ export declare const getImageType: (imageUrl: string) => string;
17
+ export declare const getImageMajorVersion: (pgImage: string | undefined) => string | undefined;
18
+ export declare const formatDatabases: (databases: DatabaseType | null) => string;
19
+ export declare const formatDumpCustomOptions: (options: string[] | null) => string;
20
+ export declare const postUniqueCustomOptions: (options: string) => string[];
21
+ export declare const customOrGenericImage: (dockerImage: string | undefined) => boolean;
22
+ export {};
@@ -0,0 +1,105 @@
1
+ import { dockerImageOptions } from '../configOptions';
2
+ const seContainerRegistry = 'se-images';
3
+ const genericImagePrefix = 'postgresai/extended-postgres';
4
+ // since some tags are rc, we need to specify the exact tags to use
5
+ const dockerImagesConfig = {
6
+ '9.6': ['0.5.3', '0.5.2', '0.5.1'],
7
+ '10': ['0.5.3', '0.5.2', '0.5.1'],
8
+ '11': ['0.5.3', '0.5.2', '0.5.1'],
9
+ '12': ['0.5.3', '0.5.2', '0.5.1'],
10
+ '13': ['0.5.3', '0.5.2', '0.5.1'],
11
+ '14': ['0.5.3', '0.5.2', '0.5.1'],
12
+ '15': ['0.5.3', '0.5.2', '0.5.1'],
13
+ '16': ['0.5.3', '0.5.2', '0.5.1'],
14
+ '17': ['0.5.3', '0.5.2', '0.5.1'],
15
+ };
16
+ export const uniqueChipValue = (values) => {
17
+ const splitChipArray = values.split(/[,(\s)(\n)(\r)(\t)(\r\n)]/);
18
+ let databaseArray = [];
19
+ for (let i in splitChipArray) {
20
+ if (splitChipArray[i] !== '' &&
21
+ databaseArray.indexOf(splitChipArray[i]) === -1) {
22
+ databaseArray.push(splitChipArray[i]);
23
+ }
24
+ }
25
+ return databaseArray.join(' ');
26
+ };
27
+ export const postUniqueDatabases = (values) => {
28
+ const splitDatabaseArray = values.split(/[,(\s)(\n)(\r)(\t)(\r\n)]/);
29
+ const databases = splitDatabaseArray.reduce((acc, curr) => {
30
+ acc[curr] = {};
31
+ return acc;
32
+ }, {});
33
+ const nonEmptyDatabase = Object.fromEntries(Object.entries(databases).filter(([name]) => name != ''));
34
+ return values.length !== 0 ? nonEmptyDatabase : null;
35
+ };
36
+ const createDockerImages = (dockerImagesConfig) => {
37
+ const dockerImages = [];
38
+ for (const pg_major_version in dockerImagesConfig) {
39
+ if (dockerImagesConfig.hasOwnProperty(pg_major_version)) {
40
+ const customTags = dockerImagesConfig[pg_major_version];
41
+ customTags.forEach((tag) => {
42
+ const image = {
43
+ package_group: 'postgresai',
44
+ pg_major_version,
45
+ tag: `${pg_major_version}-${tag}`,
46
+ location: `${genericImagePrefix}:${pg_major_version}-${tag}`,
47
+ };
48
+ dockerImages.push(image);
49
+ });
50
+ }
51
+ }
52
+ return dockerImages;
53
+ };
54
+ export const genericDockerImages = createDockerImages(dockerImagesConfig);
55
+ export const isSeDockerImage = (dockerImage) => {
56
+ var _a;
57
+ const dockerImageType = (dockerImage === null || dockerImage === void 0 ? void 0 : dockerImage.includes(seContainerRegistry)) &&
58
+ ((_a = dockerImage.split(`${seContainerRegistry}/`)[1]) === null || _a === void 0 ? void 0 : _a.split(':')[0]);
59
+ return dockerImageOptions.some((element) => element.type === dockerImageType);
60
+ };
61
+ export const getImageType = (imageUrl) => {
62
+ var _a;
63
+ const postgresCustomImageType = imageUrl.includes(seContainerRegistry) &&
64
+ ((_a = imageUrl.split(`${seContainerRegistry}/`)[1]) === null || _a === void 0 ? void 0 : _a.split(':')[0]);
65
+ if (imageUrl.includes(genericImagePrefix)) {
66
+ return 'Generic Postgres';
67
+ }
68
+ else if (postgresCustomImageType && isSeDockerImage(imageUrl)) {
69
+ return postgresCustomImageType;
70
+ }
71
+ else {
72
+ return 'custom';
73
+ }
74
+ };
75
+ export const getImageMajorVersion = (pgImage) => {
76
+ const pgImageVersion = pgImage === null || pgImage === void 0 ? void 0 : pgImage.split(':')[1];
77
+ const pgServerVersion = pgImageVersion === null || pgImageVersion === void 0 ? void 0 : pgImageVersion.split('-')[0];
78
+ return (pgServerVersion === null || pgServerVersion === void 0 ? void 0 : pgServerVersion.includes('.'))
79
+ ? pgServerVersion === null || pgServerVersion === void 0 ? void 0 : pgServerVersion.split('.')[0]
80
+ : pgServerVersion;
81
+ };
82
+ export const formatDatabases = (databases) => {
83
+ let formattedDatabases = '';
84
+ if (databases !== null) {
85
+ Object.keys(databases).forEach(function (key) {
86
+ formattedDatabases += key + ' ';
87
+ });
88
+ }
89
+ return formattedDatabases;
90
+ };
91
+ export const formatDumpCustomOptions = (options) => {
92
+ let formattedOptions = '';
93
+ if (options !== null) {
94
+ options.forEach(function (key) {
95
+ formattedOptions += key + ' ';
96
+ });
97
+ }
98
+ return formattedOptions;
99
+ };
100
+ export const postUniqueCustomOptions = (options) => {
101
+ const splitOptionsArray = options.split(/[,(\s)(\n)(\r)(\t)(\r\n)]/);
102
+ const uniqueOptions = splitOptionsArray.filter((item, index) => splitOptionsArray.indexOf(item) === index && item !== '');
103
+ return uniqueOptions;
104
+ };
105
+ export const customOrGenericImage = (dockerImage) => dockerImage === 'Generic Postgres' || dockerImage === 'custom';
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { MainStoreApi } from './useCreatedStores';
3
+ declare type Host = {
4
+ instanceId: string;
5
+ routes: {
6
+ clone: (cloneId: string) => string;
7
+ };
8
+ api: MainStoreApi;
9
+ elements: {
10
+ breadcrumbs: React.ReactNode;
11
+ };
12
+ };
13
+ declare type Props = Host;
14
+ export declare const CreateClone: ((props: Props) => JSX.Element) & {
15
+ displayName: string;
16
+ };
17
+ export {};
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import cn from 'classnames';
3
+ import { useEffect } from 'react';
4
+ import { useHistory } from 'react-router-dom';
5
+ import { observer } from 'mobx-react-lite';
6
+ import { useTimer } from 'use-timer';
7
+ import { Paper, FormControlLabel, Checkbox } from '@material-ui/core';
8
+ import { Info as InfoIcon } from '@material-ui/icons';
9
+ import { StubSpinner } from '@postgres.ai/shared/components/StubSpinnerFlex';
10
+ import { TextField } from '@postgres.ai/shared/components/TextField';
11
+ import { Select } from '@postgres.ai/shared/components/Select';
12
+ import { Button } from '@postgres.ai/shared/components/Button';
13
+ import { Spinner } from '@postgres.ai/shared/components/Spinner';
14
+ import { ErrorStub } from '@postgres.ai/shared/components/ErrorStub';
15
+ import { compareSnapshotsDesc } from '@postgres.ai/shared/utils/snapshot';
16
+ import { round } from '@postgres.ai/shared/utils/numbers';
17
+ import { formatBytesIEC } from '@postgres.ai/shared/utils/units';
18
+ import { SectionTitle } from '@postgres.ai/shared/components/SectionTitle';
19
+ import { MIN_ENTROPY, getEntropy, validatePassword, } from '@postgres.ai/shared/helpers/getEntropy';
20
+ import { useCreatedStores } from './useCreatedStores';
21
+ import { useForm } from './useForm';
22
+ import styles from './styles.module.scss';
23
+ export const CreateClone = observer((props) => {
24
+ var _a, _b, _c, _d;
25
+ const history = useHistory();
26
+ const stores = useCreatedStores(props.api);
27
+ const cloneError = stores.main.cloneError;
28
+ const timer = useTimer();
29
+ // Form.
30
+ const onSubmit = async (values) => {
31
+ if (!values.dbPassword || getEntropy(values.dbPassword) < MIN_ENTROPY) {
32
+ formik.setFieldError('dbPassword', validatePassword(values.dbPassword, MIN_ENTROPY));
33
+ return;
34
+ }
35
+ timer.start();
36
+ const isSuccess = await stores.main.createClone(values);
37
+ formik.setFieldError('dbPassword', '');
38
+ if (!isSuccess || cloneError) {
39
+ timer.pause();
40
+ timer.reset();
41
+ }
42
+ };
43
+ const formik = useForm(onSubmit);
44
+ // Initial loading data.
45
+ useEffect(() => {
46
+ stores.main.load(props.instanceId);
47
+ }, []);
48
+ // Redirect when clone is created and stable.
49
+ useEffect(() => {
50
+ if (!stores.main.clone)
51
+ return;
52
+ if (!stores.main.isCloneStable)
53
+ return;
54
+ history.push(props.routes.clone(stores.main.clone.id));
55
+ }, [stores.main.clone, stores.main.isCloneStable]);
56
+ // Snapshots.
57
+ const sortedSnapshots = (_a = stores.main.snapshots.data) === null || _a === void 0 ? void 0 : _a.slice().sort(compareSnapshotsDesc);
58
+ useEffect(() => {
59
+ const [firstSnapshot] = sortedSnapshots !== null && sortedSnapshots !== void 0 ? sortedSnapshots : [];
60
+ if (!firstSnapshot)
61
+ return;
62
+ formik.setFieldValue('snapshotId', firstSnapshot.id);
63
+ }, [Boolean(sortedSnapshots)]);
64
+ const headRendered = (_jsxs(_Fragment, { children: [_jsx("style", { children: 'p { margin: 0; }' }), props.elements.breadcrumbs, _jsx(SectionTitle, { className: styles.title, tag: "h1", level: 1, text: "Create clone" })] }));
65
+ // Initial loading spinner.
66
+ if (!stores.main.instance || !stores.main.snapshots.data)
67
+ return (_jsxs(_Fragment, { children: [headRendered, _jsx(StubSpinner, {})] }));
68
+ // Instance getting error.
69
+ if (stores.main.instanceError)
70
+ return (_jsxs(_Fragment, { children: [headRendered, _jsx(ErrorStub, { message: stores.main.instanceError })] }));
71
+ // Snapshots getting error.
72
+ if (stores.main.snapshots.error)
73
+ return _jsx(ErrorStub, { message: stores.main.snapshots.error });
74
+ const isCloneUnstable = Boolean(stores.main.clone && !stores.main.isCloneStable);
75
+ const isCreatingClone = formik.isSubmitting || isCloneUnstable;
76
+ return (_jsxs(_Fragment, { children: [headRendered, _jsxs("div", { className: styles.form, children: [stores.main.cloneError && (_jsx("div", { className: styles.section, children: _jsx(ErrorStub, { message: stores.main.cloneError }) })), _jsxs("div", { className: styles.section, children: [_jsx(TextField, { fullWidth: true, label: "Clone ID", value: formik.values.cloneId, onChange: (e) => formik.setFieldValue('cloneId', e.target.value), error: Boolean(formik.errors.cloneId), disabled: isCreatingClone }), _jsx(Select, { fullWidth: true, label: "Data state time *", value: formik.values.snapshotId, disabled: !sortedSnapshots || isCreatingClone, onChange: (e) => formik.setFieldValue('snapshotId', e.target.value), error: Boolean(formik.errors.snapshotId), items: (_b = sortedSnapshots === null || sortedSnapshots === void 0 ? void 0 : sortedSnapshots.map((snapshot, i) => {
77
+ const isLatest = i === 0;
78
+ return {
79
+ value: snapshot.id,
80
+ children: (_jsxs(_Fragment, { children: [snapshot.dataStateAt, isLatest && (_jsx("span", { className: styles.snapshotTag, children: "Latest" }))] })),
81
+ };
82
+ })) !== null && _b !== void 0 ? _b : [] }), _jsx("p", { className: styles.remark, children: "By default latest snapshot of database is used. You can select\u00A0 different snapshots if earlier database state is needed" })] }), _jsxs("div", { className: styles.section, children: [_jsx("h2", { className: styles.title, children: "Database credentials *" }), _jsx("p", { className: styles.text, children: "Set custom credentials for the new clone. Save the password in reliable place, it can\u2019t be read later." }), _jsx(TextField, { fullWidth: true, label: "Database username *", value: formik.values.dbUser, onChange: (e) => formik.setFieldValue('dbUser', e.target.value), error: Boolean(formik.errors.dbUser), disabled: isCreatingClone }), _jsx(TextField, { fullWidth: true, label: "Database password *", type: "password", value: formik.values.dbPassword, onChange: (e) => {
83
+ formik.setFieldValue('dbPassword', e.target.value);
84
+ if (formik.errors.dbPassword) {
85
+ formik.setFieldError('dbPassword', '');
86
+ }
87
+ }, error: Boolean(formik.errors.dbPassword), disabled: isCreatingClone }), _jsx("p", { className: cn(formik.errors.dbPassword && styles.error, styles.remark), children: formik.errors.dbPassword })] }), _jsx("div", { className: styles.section, children: _jsxs(Paper, { className: styles.summary, children: [_jsx(InfoIcon, { className: styles.summaryIcon }), _jsxs("div", { className: styles.params, children: [_jsxs("p", { className: styles.param, children: [_jsx("span", { children: "Data size:" }), _jsx("strong", { children: ((_c = stores.main.instance.state) === null || _c === void 0 ? void 0 : _c.dataSize)
88
+ ? formatBytesIEC(stores.main.instance.state.dataSize)
89
+ : '-' })] }), _jsxs("p", { className: styles.param, children: [_jsx("span", { children: "Expected cloning time:" }), _jsxs("strong", { children: [round((_d = stores.main.instance.state) === null || _d === void 0 ? void 0 : _d.cloning.expectedCloningTime, 2), ' ', "s"] })] })] })] }) }), _jsxs("div", { className: styles.section, children: [_jsx(FormControlLabel, { label: "Enable deletion protection", control: _jsx(Checkbox, { checked: formik.values.isProtected, onChange: (e) => formik.setFieldValue('isProtected', e.target.checked), name: "protected", disabled: isCreatingClone }) }), _jsxs("p", { className: styles.remark, children: ["When enabled no one can delete this clone and automated deletion is also disabled.", _jsx("br", {}), "Please be careful: abandoned clones with this checkbox enabled may cause out-of-disk-space events. Check disk space on daily basis and delete this clone once the work is done."] })] }), _jsx("div", { className: styles.section, children: _jsxs("div", { className: styles.controls, children: [_jsxs(Button, { onClick: formik.submitForm, variant: "primary", size: "medium", isDisabled: isCreatingClone, children: ["Create clone", isCreatingClone && (_jsx(Spinner, { size: "sm", className: styles.spinner }))] }), isCreatingClone && (_jsxs("p", { className: styles.elapsedTime, children: ["Elapsed time: ", timer.time, " s"] }))] }) })] })] }));
90
+ });
@@ -0,0 +1,26 @@
1
+ import { Instance } from '@postgres.ai/shared/types/api/entities/instance';
2
+ import { Clone } from '@postgres.ai/shared/types/api/entities/clone';
3
+ import { GetInstance } from '@postgres.ai/shared/types/api/endpoints/getInstance';
4
+ import { CreateClone } from '@postgres.ai/shared/types/api/endpoints/createClone';
5
+ import { GetClone } from '@postgres.ai/shared/types/api/endpoints/getClone';
6
+ import { SnapshotsStore, SnapshotsApi } from '@postgres.ai/shared/stores/Snapshots';
7
+ import { FormValues } from '../useForm';
8
+ export declare type MainStoreApi = SnapshotsApi & {
9
+ getInstance: GetInstance;
10
+ createClone: CreateClone;
11
+ getClone: GetClone;
12
+ };
13
+ export declare class MainStore {
14
+ instance: Instance | null;
15
+ instanceError: string | null;
16
+ clone: Clone | null;
17
+ cloneError: string | null;
18
+ private cloneUpdateTimeout?;
19
+ private readonly api;
20
+ readonly snapshots: SnapshotsStore;
21
+ constructor(api: MainStoreApi);
22
+ get isCloneStable(): boolean | undefined;
23
+ load: (instanceId: string) => Promise<boolean>;
24
+ createClone: (data: FormValues) => Promise<boolean>;
25
+ private updateCloneUntilStable;
26
+ }
@@ -0,0 +1,61 @@
1
+ import { makeAutoObservable } from 'mobx';
2
+ import { SnapshotsStore, } from '@postgres.ai/shared/stores/Snapshots';
3
+ import { getTextFromUnknownApiError } from '@postgres.ai/shared/utils/api';
4
+ import { checkIsCloneStable } from '@postgres.ai/shared/utils/clone';
5
+ const UNSTABLE_CLONE_UPDATE_TIMEOUT = 1000;
6
+ export class MainStore {
7
+ constructor(api) {
8
+ this.instance = null;
9
+ this.instanceError = null;
10
+ this.clone = null;
11
+ this.cloneError = null;
12
+ this.load = async (instanceId) => {
13
+ const [instance, isLoadedSnapshots] = await Promise.all([
14
+ this.api.getInstance({ instanceId }),
15
+ this.snapshots.load(instanceId),
16
+ ]);
17
+ if (instance.response)
18
+ this.instance = instance.response;
19
+ if (instance.error)
20
+ this.instanceError = await getTextFromUnknownApiError(instance.error);
21
+ return Boolean(instance.response) && isLoadedSnapshots;
22
+ };
23
+ this.createClone = async (data) => {
24
+ if (!this.instance)
25
+ return false;
26
+ const { response, error } = await this.api.createClone({
27
+ ...data,
28
+ instanceId: this.instance.id,
29
+ });
30
+ if (response) {
31
+ this.clone = response;
32
+ this.updateCloneUntilStable({
33
+ instanceId: this.instance.id,
34
+ cloneId: this.clone.id,
35
+ });
36
+ }
37
+ if (error)
38
+ this.cloneError = await error.json().then((err) => (err === null || err === void 0 ? void 0 : err.message) || err);
39
+ return Boolean(response);
40
+ };
41
+ this.updateCloneUntilStable = async (args) => {
42
+ window.clearTimeout(this.cloneUpdateTimeout);
43
+ const { response, error } = await this.api.getClone(args);
44
+ if (response) {
45
+ this.clone = response;
46
+ if (!this.isCloneStable)
47
+ this.cloneUpdateTimeout = window.setTimeout(() => this.updateCloneUntilStable(args), UNSTABLE_CLONE_UPDATE_TIMEOUT);
48
+ }
49
+ if (error)
50
+ this.cloneError = await error.json().then((err) => (err === null || err === void 0 ? void 0 : err.message) || err);
51
+ };
52
+ makeAutoObservable(this);
53
+ this.api = api;
54
+ this.snapshots = new SnapshotsStore(api);
55
+ }
56
+ get isCloneStable() {
57
+ if (!this.clone)
58
+ return;
59
+ return checkIsCloneStable(this.clone);
60
+ }
61
+ }
@@ -0,0 +1,6 @@
1
+ import { MainStore, MainStoreApi } from './stores/Main';
2
+ export declare const useCreatedStores: (api: MainStoreApi) => {
3
+ main: MainStore;
4
+ };
5
+ export declare type Stores = ReturnType<typeof useCreatedStores>;
6
+ export type { MainStoreApi };
@@ -0,0 +1,5 @@
1
+ import { useMemo } from 'react';
2
+ import { MainStore } from './stores/Main';
3
+ export const useCreatedStores = (api) => ({
4
+ main: useMemo(() => new MainStore(api), []),
5
+ });
@@ -0,0 +1,54 @@
1
+ /// <reference types="react" />
2
+ export declare type FormValues = {
3
+ cloneId: string;
4
+ snapshotId: string;
5
+ dbUser: string;
6
+ dbPassword: string;
7
+ isProtected: boolean;
8
+ };
9
+ export declare const useForm: (onSubmit: (values: FormValues) => void) => {
10
+ initialValues: FormValues;
11
+ initialErrors: import("formik").FormikErrors<unknown>;
12
+ initialTouched: import("formik").FormikTouched<unknown>;
13
+ initialStatus: any;
14
+ handleBlur: {
15
+ (e: import("react").FocusEvent<any, Element>): void;
16
+ <T = any>(fieldOrEvent: T): T extends string ? (e: any) => void : void;
17
+ };
18
+ handleChange: {
19
+ (e: import("react").ChangeEvent<any>): void;
20
+ <T_1 = string | import("react").ChangeEvent<any>>(field: T_1): T_1 extends import("react").ChangeEvent<any> ? void : (e: string | import("react").ChangeEvent<any>) => void;
21
+ };
22
+ handleReset: (e: any) => void;
23
+ handleSubmit: (e?: import("react").FormEvent<HTMLFormElement> | undefined) => void;
24
+ resetForm: (nextState?: Partial<import("formik").FormikState<FormValues>> | undefined) => void;
25
+ setErrors: (errors: import("formik").FormikErrors<FormValues>) => void;
26
+ setFormikState: (stateOrCb: import("formik").FormikState<FormValues> | ((state: import("formik").FormikState<FormValues>) => import("formik").FormikState<FormValues>)) => void;
27
+ setFieldTouched: (field: string, touched?: boolean | undefined, shouldValidate?: boolean | undefined) => Promise<void> | Promise<import("formik").FormikErrors<FormValues>>;
28
+ setFieldValue: (field: string, value: any, shouldValidate?: boolean | undefined) => Promise<void> | Promise<import("formik").FormikErrors<FormValues>>;
29
+ setFieldError: (field: string, value: string | undefined) => void;
30
+ setStatus: (status: any) => void;
31
+ setSubmitting: (isSubmitting: boolean) => void;
32
+ setTouched: (touched: import("formik").FormikTouched<FormValues>, shouldValidate?: boolean | undefined) => Promise<void> | Promise<import("formik").FormikErrors<FormValues>>;
33
+ setValues: (values: import("react").SetStateAction<FormValues>, shouldValidate?: boolean | undefined) => Promise<void> | Promise<import("formik").FormikErrors<FormValues>>;
34
+ submitForm: () => Promise<any>;
35
+ validateForm: (values?: FormValues | undefined) => Promise<import("formik").FormikErrors<FormValues>>;
36
+ validateField: (name: string) => Promise<void> | Promise<string | undefined>;
37
+ isValid: boolean;
38
+ dirty: boolean;
39
+ unregisterField: (name: string) => void;
40
+ registerField: (name: string, { validate }: any) => void;
41
+ getFieldProps: (nameOrOptions: any) => import("formik").FieldInputProps<any>;
42
+ getFieldMeta: (name: string) => import("formik").FieldMetaProps<any>;
43
+ getFieldHelpers: (name: string) => import("formik").FieldHelperProps<any>;
44
+ validateOnBlur: boolean;
45
+ validateOnChange: boolean;
46
+ validateOnMount: boolean;
47
+ values: FormValues;
48
+ errors: import("formik").FormikErrors<FormValues>;
49
+ touched: import("formik").FormikTouched<FormValues>;
50
+ isSubmitting: boolean;
51
+ isValidating: boolean;
52
+ status?: any;
53
+ submitCount: number;
54
+ };
@@ -0,0 +1,25 @@
1
+ import { useFormik } from 'formik';
2
+ import * as Yup from 'yup';
3
+ const Schema = Yup.object().shape({
4
+ cloneId: Yup.string(),
5
+ snapshotId: Yup.string().required('Date state time is required'),
6
+ dbUser: Yup.string().required('Database username is required'),
7
+ dbPassword: Yup.string().required('Database password is required'),
8
+ isProtected: Yup.boolean(),
9
+ });
10
+ export const useForm = (onSubmit) => {
11
+ const formik = useFormik({
12
+ initialValues: {
13
+ cloneId: '',
14
+ snapshotId: '',
15
+ dbUser: '',
16
+ dbPassword: '',
17
+ isProtected: false,
18
+ },
19
+ validationSchema: Schema,
20
+ onSubmit,
21
+ validateOnBlur: false,
22
+ validateOnChange: false,
23
+ });
24
+ return formik;
25
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ value: React.ReactNode;
4
+ children: React.ReactNode;
5
+ };
6
+ export declare const Item: (props: Props) => JSX.Element;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styles from './styles.module.scss';
3
+ export const Item = (props) => {
4
+ return (_jsxs("div", { className: styles.root, children: [_jsx("div", { className: styles.value, children: props.value }), _jsx("div", { className: styles.description, children: props.children })] }));
5
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ expectedCloningTimeS: number;
4
+ logicalSize: number | null;
5
+ clonesCount: number;
6
+ clonesCountLastMonth?: number;
7
+ };
8
+ export declare const Header: (props: Props) => JSX.Element;
9
+ export {};