@postgres.ai/shared 3.5.0-pr-1027.1 → 4.0.0-pr-1028.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 (186) hide show
  1. package/components/DestroyCloneModal/index.js +3 -3
  2. package/components/DestroyCloneRestrictionModal/index.js +1 -1
  3. package/components/MenuButton/index.d.ts +2 -0
  4. package/components/MenuButton/index.js +1 -1
  5. package/components/ResetCloneModal/index.js +5 -3
  6. package/icons/ArrowDropDown/index.d.ts +1 -0
  7. package/icons/ArrowDropDown/index.js +1 -1
  8. package/icons/PostgresSQL/index.d.ts +2 -0
  9. package/icons/PostgresSQL/index.js +40 -0
  10. package/package.json +1 -1
  11. package/pages/Branches/Branch/context.d.ts +22 -0
  12. package/pages/Branches/Branch/context.js +3 -0
  13. package/pages/Branches/Branch/index.d.ts +9 -0
  14. package/pages/Branches/Branch/index.js +172 -0
  15. package/pages/Branches/Branch/stores/Main.d.ts +37 -0
  16. package/pages/Branches/Branch/stores/Main.js +90 -0
  17. package/pages/Branches/Branch/useCreatedStores.d.ts +6 -0
  18. package/pages/Branches/Branch/useCreatedStores.js +5 -0
  19. package/pages/Branches/components/BranchesTable/index.d.ts +10 -0
  20. package/pages/Branches/components/BranchesTable/index.js +107 -0
  21. package/pages/Branches/components/Modals/DeleteBranchModal/index.d.ts +11 -0
  22. package/pages/Branches/components/Modals/DeleteBranchModal/index.js +49 -0
  23. package/pages/Branches/components/Modals/types.d.ts +4 -0
  24. package/pages/Branches/components/Modals/types.js +1 -0
  25. package/pages/Branches/index.d.ts +6 -0
  26. package/pages/Branches/index.js +60 -0
  27. package/pages/Clone/context.d.ts +2 -0
  28. package/pages/Clone/index.d.ts +3 -1
  29. package/pages/Clone/index.js +54 -23
  30. package/pages/Clone/stores/Main.d.ts +4 -2
  31. package/pages/Clone/utils/index.d.ts +4 -0
  32. package/pages/Clone/utils/index.js +12 -0
  33. package/pages/CreateBranch/index.d.ts +17 -0
  34. package/pages/CreateBranch/index.js +135 -0
  35. package/pages/CreateBranch/stores/Main.d.ts +43 -0
  36. package/pages/CreateBranch/stores/Main.js +59 -0
  37. package/pages/CreateBranch/useCreatedStores.d.ts +6 -0
  38. package/pages/CreateBranch/useCreatedStores.js +5 -0
  39. package/pages/CreateBranch/useForm.d.ts +51 -0
  40. package/pages/CreateBranch/useForm.js +30 -0
  41. package/pages/CreateBranch/utils/index.d.ts +2 -0
  42. package/pages/CreateBranch/utils/index.js +10 -0
  43. package/pages/CreateClone/index.d.ts +4 -2
  44. package/pages/CreateClone/index.js +92 -40
  45. package/pages/CreateClone/stores/Main.d.ts +25 -2
  46. package/pages/CreateClone/stores/Main.js +26 -2
  47. package/pages/CreateClone/styles.module.scss +47 -4
  48. package/pages/CreateClone/useForm.d.ts +1 -0
  49. package/pages/CreateClone/useForm.js +1 -0
  50. package/pages/CreateClone/utils/index.d.ts +3 -0
  51. package/pages/CreateClone/utils/index.js +17 -0
  52. package/pages/CreateSnapshot/index.d.ts +17 -0
  53. package/pages/CreateSnapshot/index.js +117 -0
  54. package/pages/CreateSnapshot/stores/Main.d.ts +21 -0
  55. package/pages/CreateSnapshot/stores/Main.js +31 -0
  56. package/pages/CreateSnapshot/useCreatedStores.d.ts +6 -0
  57. package/pages/CreateSnapshot/useCreatedStores.js +5 -0
  58. package/pages/CreateSnapshot/useForm.d.ts +53 -0
  59. package/pages/CreateSnapshot/useForm.js +25 -0
  60. package/pages/CreateSnapshot/utils/index.d.ts +1 -0
  61. package/pages/CreateSnapshot/utils/index.js +3 -0
  62. package/pages/Instance/{components → Clones}/ClonesList/MenuCell/index.js +1 -1
  63. package/pages/Instance/{components → Clones}/ClonesList/MenuCell/utils.js +2 -2
  64. package/pages/Instance/Clones/ClonesList/index.js +96 -0
  65. package/pages/Instance/{components → Clones}/ClonesList/styles.module.scss +10 -0
  66. package/pages/Instance/{ClonesModal → Clones/ClonesModal}/index.js +5 -5
  67. package/pages/Instance/Clones/Header/styles.module.scss +4 -1
  68. package/pages/Instance/Clones/index.d.ts +5 -1
  69. package/pages/Instance/Clones/index.js +6 -8
  70. package/pages/{Configuration → Instance/Configuration}/InputWithTooltip/index.js +15 -11
  71. package/pages/{Configuration → Instance/Configuration}/index.d.ts +2 -1
  72. package/pages/{Configuration → Instance/Configuration}/index.js +9 -6
  73. package/pages/{Configuration → Instance/Configuration}/tooltipText.js +1 -1
  74. package/pages/Instance/Info/Disks/Disk/index.js +6 -4
  75. package/pages/Instance/Info/Retrieval/RetrievalModal/index.js +0 -4
  76. package/pages/Instance/Info/Retrieval/index.js +1 -3
  77. package/pages/Instance/Info/Snapshots/Calendar/utils.d.ts +4 -0
  78. package/pages/Instance/Info/Snapshots/index.js +10 -5
  79. package/pages/Instance/Info/Snapshots/utils.d.ts +13 -2
  80. package/pages/Instance/Info/Snapshots/utils.js +16 -6
  81. package/pages/Instance/Info/Status/index.js +2 -2
  82. package/pages/Instance/Info/index.js +2 -1
  83. package/pages/Instance/Snapshots/components/SnapshotHeader/index.d.ts +11 -0
  84. package/pages/Instance/Snapshots/components/SnapshotHeader/index.js +36 -0
  85. package/pages/Instance/Snapshots/components/SnapshotsList/index.d.ts +11 -0
  86. package/pages/Instance/Snapshots/components/SnapshotsList/index.js +157 -0
  87. package/pages/Instance/Snapshots/components/SnapshotsTable/index.d.ts +6 -0
  88. package/pages/Instance/Snapshots/components/SnapshotsTable/index.js +125 -0
  89. package/pages/Instance/Snapshots/index.d.ts +6 -0
  90. package/pages/Instance/Snapshots/index.js +92 -0
  91. package/pages/Instance/Snapshots/utils/index.d.ts +16 -0
  92. package/pages/Instance/Snapshots/utils/index.js +30 -0
  93. package/pages/Instance/SnapshotsModal/index.js +1 -1
  94. package/pages/Instance/Tabs/PlatformTabs.d.ts +10 -0
  95. package/pages/Instance/Tabs/PlatformTabs.js +51 -0
  96. package/pages/Instance/Tabs/index.d.ts +19 -2
  97. package/pages/Instance/Tabs/index.js +71 -36
  98. package/pages/Instance/Tabs/styles.d.ts +1 -0
  99. package/pages/Instance/Tabs/styles.js +62 -0
  100. package/pages/Instance/components/ModalReloadButton/index.js +1 -1
  101. package/pages/Instance/context.d.ts +7 -0
  102. package/pages/Instance/index.js +14 -13
  103. package/pages/Instance/stores/Main.d.ts +36 -10
  104. package/pages/Instance/stores/Main.js +83 -24
  105. package/pages/Instance/styles.scss +1 -4
  106. package/pages/Logs/hooks/useWsScroll.js +6 -8
  107. package/pages/Logs/index.d.ts +2 -1
  108. package/pages/Logs/index.js +42 -31
  109. package/pages/Logs/wsLogs.d.ts +3 -2
  110. package/pages/Logs/wsLogs.js +24 -8
  111. package/pages/Logs/wsSnackbar.js +7 -7
  112. package/pages/Snapshots/Snapshot/DestorySnapshotModal/index.d.ts +12 -0
  113. package/pages/Snapshots/Snapshot/DestorySnapshotModal/index.js +69 -0
  114. package/pages/Snapshots/Snapshot/context.d.ts +23 -0
  115. package/pages/Snapshots/Snapshot/context.js +3 -0
  116. package/pages/Snapshots/Snapshot/index.d.ts +9 -0
  117. package/pages/Snapshots/Snapshot/index.js +171 -0
  118. package/pages/Snapshots/Snapshot/stores/Main.d.ts +33 -0
  119. package/pages/Snapshots/Snapshot/stores/Main.js +71 -0
  120. package/pages/Snapshots/Snapshot/useCreatedStores.d.ts +6 -0
  121. package/pages/Snapshots/Snapshot/useCreatedStores.js +5 -0
  122. package/stores/Snapshots.d.ts +12 -3
  123. package/stores/Snapshots.js +27 -3
  124. package/types/api/endpoints/createBranch.d.ts +12 -0
  125. package/types/api/endpoints/createBranch.js +1 -0
  126. package/types/api/endpoints/createClone.d.ts +1 -0
  127. package/types/api/endpoints/createSnapshot.d.ts +5 -0
  128. package/types/api/endpoints/createSnapshot.js +1 -0
  129. package/types/api/endpoints/deleteBranch.d.ts +4 -0
  130. package/types/api/endpoints/deleteBranch.js +1 -0
  131. package/types/api/endpoints/destroySnapshot.d.ts +4 -0
  132. package/types/api/endpoints/destroySnapshot.js +1 -0
  133. package/types/api/endpoints/getBranchSnapshot.d.ts +5 -0
  134. package/types/api/endpoints/getBranchSnapshot.js +1 -0
  135. package/types/api/endpoints/getBranches.d.ts +18 -0
  136. package/types/api/endpoints/getBranches.js +5 -0
  137. package/types/api/endpoints/getConfig.d.ts +2 -2
  138. package/types/api/endpoints/getEngine.d.ts +1 -1
  139. package/types/api/endpoints/getFullConfig.d.ts +1 -1
  140. package/types/api/endpoints/getSnapshotList.d.ts +10 -0
  141. package/types/api/endpoints/getSnapshotList.js +1 -0
  142. package/types/api/endpoints/getSnapshots.d.ts +1 -0
  143. package/types/api/endpoints/updateConfig.d.ts +1 -1
  144. package/types/api/entities/branchSnapshot.d.ts +6 -0
  145. package/types/api/entities/branchSnapshot.js +1 -0
  146. package/types/api/entities/branchSnapshots.d.ts +15 -0
  147. package/types/api/entities/branchSnapshots.js +7 -0
  148. package/types/api/entities/clone.d.ts +6 -0
  149. package/types/api/entities/config.js +1 -1
  150. package/types/api/entities/createBranch.d.ts +5 -0
  151. package/types/api/entities/createBranch.js +1 -0
  152. package/types/api/entities/createSnapshot.d.ts +5 -0
  153. package/types/api/entities/createSnapshot.js +1 -0
  154. package/types/api/entities/dbSource.d.ts +1 -0
  155. package/types/api/entities/instance.d.ts +5 -0
  156. package/types/api/entities/instanceState.d.ts +5 -0
  157. package/types/api/entities/snapshot.d.ts +8 -0
  158. package/types/api/entities/snapshot.js +1 -1
  159. package/utils/date.d.ts +2 -0
  160. package/utils/date.js +7 -0
  161. package/utils/snapshot.d.ts +5 -2
  162. package/utils/snapshot.js +6 -1
  163. package/pages/Instance/components/ClonesList/index.js +0 -52
  164. /package/pages/Instance/{components → Clones}/ClonesList/ConnectionModal/index.d.ts +0 -0
  165. /package/pages/Instance/{components → Clones}/ClonesList/ConnectionModal/index.js +0 -0
  166. /package/pages/Instance/{components → Clones}/ClonesList/MenuCell/index.d.ts +0 -0
  167. /package/pages/Instance/{components → Clones}/ClonesList/MenuCell/utils.d.ts +0 -0
  168. /package/pages/Instance/{components → Clones}/ClonesList/index.d.ts +0 -0
  169. /package/pages/Instance/{ClonesModal → Clones/ClonesModal}/index.d.ts +0 -0
  170. /package/pages/Instance/{ClonesModal → Clones/ClonesModal}/utils.d.ts +0 -0
  171. /package/pages/Instance/{ClonesModal → Clones/ClonesModal}/utils.js +0 -0
  172. /package/pages/{Configuration → Instance/Configuration}/Header/index.d.ts +0 -0
  173. /package/pages/{Configuration → Instance/Configuration}/Header/index.js +0 -0
  174. /package/pages/{Configuration → Instance/Configuration}/InputWithTooltip/index.d.ts +0 -0
  175. /package/pages/{Configuration → Instance/Configuration}/ResponseMessage/index.d.ts +0 -0
  176. /package/pages/{Configuration → Instance/Configuration}/ResponseMessage/index.js +0 -0
  177. /package/pages/{Configuration → Instance/Configuration}/configOptions.d.ts +0 -0
  178. /package/pages/{Configuration → Instance/Configuration}/configOptions.js +0 -0
  179. /package/pages/{Configuration → Instance/Configuration}/styles.module.scss +0 -0
  180. /package/pages/{Configuration → Instance/Configuration}/tooltipText.d.ts +0 -0
  181. /package/pages/{Configuration → Instance/Configuration}/useForm.d.ts +0 -0
  182. /package/pages/{Configuration → Instance/Configuration}/useForm.js +0 -0
  183. /package/pages/{Configuration → Instance/Configuration}/utils/index.d.ts +0 -0
  184. /package/pages/{Configuration → Instance/Configuration}/utils/index.js +0 -0
  185. /package/pages/Instance/{SnapshotsModal → Snapshots/components/SnapshotsModal}/utils.d.ts +0 -0
  186. /package/pages/Instance/{SnapshotsModal → Snapshots/components/SnapshotsModal}/utils.js +0 -0
@@ -1,14 +1,17 @@
1
1
  import moment from 'moment';
2
- import { LOGS_ENDPOINT, LOGS_LINE_LIMIT, LOGS_TIME_LIMIT, } from '@postgres.ai/shared/pages/Logs/constants';
3
- import { stringWithoutBrackets, stringContainsPattern, } from '@postgres.ai/shared/pages/Logs/utils';
4
- export const establishConnection = async (api) => {
2
+ import { stringContainsPattern, stringWithoutBrackets } from './utils';
3
+ const logsEndpoint = '/instance/logs';
4
+ const LOGS_TIME_LIMIT = 20;
5
+ const LOGS_LINE_LIMIT = 1000;
6
+ export const establishConnection = async (api, instanceId) => {
7
+ if (!api.getWSToken)
8
+ return;
5
9
  const logElement = document.getElementById('logs-container');
6
10
  if (logElement === null) {
7
11
  console.log('Not found container element');
8
12
  return;
9
13
  }
10
14
  const appendLogElement = (logEntry, logType) => {
11
- var _a;
12
15
  const tag = document.createElement('p');
13
16
  const logLevel = logEntry.split(' ')[3];
14
17
  const logInitiator = logEntry.split(' ')[2];
@@ -34,17 +37,21 @@ export const establishConnection = async (api) => {
34
37
  tag.classList.add('error-log');
35
38
  }
36
39
  if (logType === 'message') {
37
- const logEntryTime = (_a = logElement.children[1]) === null || _a === void 0 ? void 0 : _a.innerHTML.split(' ').slice(0, 2).join(' ');
40
+ const logEntryTime = moment.utc(logElement.children[0].innerHTML.split(' ').slice(0, 2).join(' '));
38
41
  const timeDifference = moment(logEntryTime).isValid() &&
39
42
  moment.duration(moment.utc(Date.now()).diff(logEntryTime)).asMinutes();
40
43
  if (logElement.childElementCount > LOGS_LINE_LIMIT &&
41
44
  Number(timeDifference) > LOGS_TIME_LIMIT) {
42
- logElement.removeChild(logElement.children[1]);
45
+ logElement.removeChild(logElement.children[0]);
43
46
  }
44
47
  }
48
+ if (logEntry.split(' ')[2] === '[ERROR]' ||
49
+ logEntry.split(' ')[3] === '[ERROR]') {
50
+ tag.classList.add('error-log');
51
+ }
45
52
  };
46
53
  const { response, error } = await api.getWSToken({
47
- instanceId: '',
54
+ instanceId: instanceId,
48
55
  });
49
56
  if (error || response == null) {
50
57
  console.log('Not authorized:', error);
@@ -56,7 +63,7 @@ export const establishConnection = async (api) => {
56
63
  appendLogElement('WebSocket Connection is not configured');
57
64
  return;
58
65
  }
59
- const socket = api.initWS(LOGS_ENDPOINT, response.token);
66
+ const socket = api.initWS(logsEndpoint, response.token);
60
67
  socket.onopen = () => {
61
68
  console.log('Successfully Connected');
62
69
  };
@@ -74,3 +81,12 @@ export const establishConnection = async (api) => {
74
81
  appendLogElement(logEntry, 'message');
75
82
  };
76
83
  };
84
+ export const restartConnection = (api, instanceId) => {
85
+ const logElement = document.getElementById('logs-container');
86
+ if (logElement && logElement.childElementCount > 1) {
87
+ while (logElement.firstChild) {
88
+ logElement.removeChild(logElement.firstChild);
89
+ }
90
+ }
91
+ establishConnection(api, instanceId);
92
+ };
@@ -1,25 +1,25 @@
1
- import { LOGS_NEW_DATA_MESSAGE } from '@postgres.ai/shared/pages/Logs/constants';
1
+ const LOGS_NEW_DATA_MESSAGE = 'New data arrived below - scroll down to see it 👇🏻';
2
2
  export const wsSnackbar = (clientAtBottom, isNewData) => {
3
- var _a, _b;
3
+ var _a;
4
4
  const targetNode = document.getElementById('logs-container');
5
5
  const snackbarTag = document.createElement('div');
6
6
  if (!clientAtBottom && isNewData) {
7
7
  if (!(targetNode === null || targetNode === void 0 ? void 0 : targetNode.querySelector('.snackbar-tag'))) {
8
8
  targetNode === null || targetNode === void 0 ? void 0 : targetNode.appendChild(snackbarTag);
9
9
  snackbarTag.classList.add('snackbar-tag');
10
- if (snackbarTag.childNodes.length === 0 &&
11
- ((_a = targetNode === null || targetNode === void 0 ? void 0 : targetNode.querySelector('p')) === null || _a === void 0 ? void 0 : _a.textContent) !== 'Not authorized') {
10
+ if (snackbarTag.childNodes.length === 0) {
12
11
  snackbarTag.appendChild(document.createTextNode(LOGS_NEW_DATA_MESSAGE));
13
12
  }
14
13
  snackbarTag.onclick = () => {
15
- targetNode === null || targetNode === void 0 ? void 0 : targetNode.scroll({
16
- top: targetNode.scrollHeight,
14
+ targetNode === null || targetNode === void 0 ? void 0 : targetNode.scrollIntoView({
17
15
  behavior: 'smooth',
16
+ block: 'end',
17
+ inline: 'end',
18
18
  });
19
19
  };
20
20
  }
21
21
  }
22
22
  else {
23
- (_b = targetNode === null || targetNode === void 0 ? void 0 : targetNode.querySelector('.snackbar-tag')) === null || _b === void 0 ? void 0 : _b.remove();
23
+ (_a = targetNode === null || targetNode === void 0 ? void 0 : targetNode.querySelector('.snackbar-tag')) === null || _a === void 0 ? void 0 : _a.remove();
24
24
  }
25
25
  };
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { DestroySnapshot } from '@postgres.ai/shared/types/api/endpoints/destroySnapshot';
3
+ declare type Props = {
4
+ snapshotId: string;
5
+ instanceId: string;
6
+ isOpen: boolean;
7
+ onClose: () => void;
8
+ afterSubmitClick: () => void;
9
+ destroySnapshot: DestroySnapshot;
10
+ };
11
+ export declare const DestroySnapshotModal: ({ snapshotId, instanceId, isOpen, onClose, afterSubmitClick, destroySnapshot, }: Props) => JSX.Element;
12
+ export {};
@@ -0,0 +1,69 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*--------------------------------------------------------------------------
3
+ * Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
4
+ * All Rights Reserved. Proprietary and confidential.
5
+ * Unauthorized copying of this file, via any medium is strictly prohibited
6
+ *--------------------------------------------------------------------------
7
+ */
8
+ import { useState } from 'react';
9
+ import { Checkbox, FormControlLabel, Typography, makeStyles, } from '@material-ui/core';
10
+ import { Modal } from '@postgres.ai/shared/components/Modal';
11
+ import { ImportantText } from '@postgres.ai/shared/components/ImportantText';
12
+ import { Text } from '@postgres.ai/shared/components/Text';
13
+ import { SimpleModalControls } from '@postgres.ai/shared/components/SimpleModalControls';
14
+ const useStyles = makeStyles({
15
+ errorMessage: {
16
+ color: 'red',
17
+ marginTop: '10px',
18
+ wordBreak: 'break-all',
19
+ },
20
+ checkboxRoot: {
21
+ padding: '9px 10px',
22
+ },
23
+ grayText: {
24
+ color: '#8a8a8a',
25
+ fontSize: '12px',
26
+ wordBreak: 'break-word',
27
+ },
28
+ marginTop: {
29
+ marginTop: '6px',
30
+ },
31
+ }, { index: 1 });
32
+ export const DestroySnapshotModal = ({ snapshotId, instanceId, isOpen, onClose, afterSubmitClick, destroySnapshot, }) => {
33
+ const classes = useStyles();
34
+ const [forceDelete, setForceDelete] = useState(false);
35
+ const [deleteError, setDeleteError] = useState(null);
36
+ const [isForceDeleteOptionVisible, setForceDeleteOptionVisible] = useState(false);
37
+ const handleClose = () => {
38
+ setDeleteError(null);
39
+ onClose();
40
+ };
41
+ const handleClickDestroy = () => {
42
+ destroySnapshot(snapshotId, forceDelete, instanceId).then((res) => {
43
+ var _a, _b;
44
+ if (res === null || res === void 0 ? void 0 : res.error) {
45
+ const errorMessage = ((_a = res === null || res === void 0 ? void 0 : res.error) === null || _a === void 0 ? void 0 : _a.message) ||
46
+ ((_b = res === null || res === void 0 ? void 0 : res.error) === null || _b === void 0 ? void 0 : _b.details);
47
+ setDeleteError(errorMessage || null);
48
+ setForceDeleteOptionVisible(true);
49
+ }
50
+ else {
51
+ afterSubmitClick();
52
+ handleClose();
53
+ }
54
+ });
55
+ };
56
+ return (_jsxs(Modal, { title: 'Confirmation', onClose: handleClose, isOpen: isOpen, size: "sm", children: [_jsxs(Text, { children: ["Are you sure you want to delete snapshot", ' ', _jsx(ImportantText, { children: snapshotId }), "? This action cannot be undone."] }), deleteError && _jsx("p", { className: classes.errorMessage, children: deleteError }), isForceDeleteOptionVisible && (_jsxs("div", { className: classes.marginTop, children: [_jsx(FormControlLabel, { control: _jsx(Checkbox, { name: "debug", checked: forceDelete, onChange: (e) => setForceDelete(e.target.checked), classes: {
57
+ root: classes.checkboxRoot,
58
+ } }), label: 'Force delete' }), _jsx(Typography, { className: classes.grayText, children: "If the snapshot cannot be deleted due to dependencies, enabling \u201CForce delete\u201D will remove it along with all dependent snapshots and clones." })] })), _jsx(SimpleModalControls, { items: [
59
+ {
60
+ text: 'Cancel',
61
+ onClick: handleClose,
62
+ },
63
+ {
64
+ text: 'Delete snapshot',
65
+ variant: 'primary',
66
+ onClick: handleClickDestroy,
67
+ },
68
+ ] })] }));
69
+ };
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { Api } from './stores/Main';
3
+ export declare type Host = {
4
+ instanceId: string;
5
+ snapshotId: string;
6
+ routes: {
7
+ snapshot: () => string;
8
+ snapshots: () => string;
9
+ branch: (branchName: string) => string;
10
+ clone: (cloneId: string) => string;
11
+ createClone: (branchId: string, snapshotId: string) => string;
12
+ };
13
+ api: Api;
14
+ elements: {
15
+ breadcrumbs: React.ReactNode;
16
+ };
17
+ };
18
+ export declare const useHost: () => Host, HostProvider: import("react").Provider<Host>;
19
+ export declare const useStores: () => {
20
+ main: import("./stores/Main").MainStore;
21
+ }, StoresProvider: import("react").Provider<{
22
+ main: import("./stores/Main").MainStore;
23
+ }>;
@@ -0,0 +1,3 @@
1
+ import { createStrictContext } from '@postgres.ai/shared/utils/react';
2
+ export const { useStrictContext: useHost, Provider: HostProvider } = createStrictContext();
3
+ export const { useStrictContext: useStores, Provider: StoresProvider } = createStrictContext();
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { Host } from './context';
3
+ declare type Props = Host & {
4
+ isPlatform?: boolean;
5
+ };
6
+ export declare const SnapshotPage: ((props: Props) => JSX.Element) & {
7
+ displayName: string;
8
+ };
9
+ export {};
@@ -0,0 +1,171 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*--------------------------------------------------------------------------
3
+ * Copyright (c) 2019-2021, Postgres.ai, Nikolay Samokhvalov nik@postgres.ai
4
+ * All Rights Reserved. Proprietary and confidential.
5
+ * Unauthorized copying of this file, via any medium is strictly prohibited
6
+ *--------------------------------------------------------------------------
7
+ */
8
+ import { useEffect, useState } from 'react';
9
+ import { useHistory } from 'react-router';
10
+ import { observer } from 'mobx-react-lite';
11
+ import copyToClipboard from 'copy-to-clipboard';
12
+ import { makeStyles, Button, TextField, IconButton, Table, TableHead, TableRow, TableBody, } from '@material-ui/core';
13
+ import { ErrorStub } from '@postgres.ai/shared/components/ErrorStub';
14
+ import { PageSpinner } from '@postgres.ai/shared/components/PageSpinner';
15
+ import { SectionTitle } from '@postgres.ai/shared/components/SectionTitle';
16
+ import { DestroySnapshotModal } from '@postgres.ai/shared/pages/Snapshots/Snapshot/DestorySnapshotModal';
17
+ import { HorizontalScrollContainer } from '@postgres.ai/shared/components/HorizontalScrollContainer';
18
+ import { Tooltip } from '@postgres.ai/shared/components/Tooltip';
19
+ import { icons } from '@postgres.ai/shared/styles/icons';
20
+ import { formatBytesIEC } from '@postgres.ai/shared/utils/units';
21
+ import { styles } from '@postgres.ai/shared/styles/styles';
22
+ import { SyntaxHighlight } from '@postgres.ai/shared/components/SyntaxHighlight';
23
+ import { TableBodyCell, TableBodyCellMenu, TableHeaderCell, } from '@postgres.ai/shared/components/Table';
24
+ import { useCreatedStores } from './useCreatedStores';
25
+ import { InstanceTabs, TABS_INDEX } from "../../Instance/Tabs";
26
+ const useStyles = makeStyles(() => ({
27
+ wrapper: {
28
+ display: 'flex',
29
+ gap: '60px',
30
+ maxWidth: '1200px',
31
+ fontSize: '14px',
32
+ marginTop: '20px',
33
+ '@media (max-width: 1300px)': {
34
+ flexDirection: 'column',
35
+ gap: '20px',
36
+ },
37
+ },
38
+ marginTop: {
39
+ marginTop: '16px',
40
+ },
41
+ title: {
42
+ marginTop: '8px',
43
+ lineHeight: '26px'
44
+ },
45
+ container: {
46
+ maxWidth: '100%',
47
+ flex: '1 1 0',
48
+ minWidth: 0,
49
+ '& p,span': {
50
+ fontSize: 14,
51
+ },
52
+ },
53
+ snippetContainer: {
54
+ flex: '1 1 0',
55
+ minWidth: 0,
56
+ boxShadow: 'rgba(0, 0, 0, 0.1) 0px 4px 12px',
57
+ padding: '10px 20px 10px 20px',
58
+ height: 'max-content',
59
+ borderRadius: '4px',
60
+ },
61
+ actions: {
62
+ display: 'flex',
63
+ marginRight: '-16px',
64
+ },
65
+ spinner: {
66
+ marginLeft: '8px',
67
+ },
68
+ actionButton: {
69
+ marginRight: '16px',
70
+ },
71
+ summary: {
72
+ marginTop: 20,
73
+ },
74
+ text: {
75
+ marginTop: '4px',
76
+ },
77
+ cliText: {
78
+ marginTop: '8px',
79
+ },
80
+ paramTitle: {
81
+ display: 'inline-block',
82
+ width: 200,
83
+ },
84
+ copyFieldContainer: {
85
+ position: 'relative',
86
+ display: 'block',
87
+ maxWidth: 525,
88
+ width: '100%',
89
+ },
90
+ tableContainer: {
91
+ position: 'relative',
92
+ maxWidth: 525,
93
+ width: '100%',
94
+ margin: '10px 0',
95
+ },
96
+ textField: {
97
+ ...styles.inputField,
98
+ 'max-width': 525,
99
+ display: 'inline-block',
100
+ '& .MuiOutlinedInput-input': {
101
+ paddingRight: '32px!important',
102
+ },
103
+ },
104
+ copyButton: {
105
+ position: 'absolute',
106
+ top: 16,
107
+ right: 0,
108
+ zIndex: 100,
109
+ width: 32,
110
+ height: 32,
111
+ padding: 8,
112
+ },
113
+ pointerCursor: {
114
+ cursor: 'pointer',
115
+ },
116
+ centerContent: {
117
+ display: 'flex',
118
+ gap: 1,
119
+ alignItems: 'center',
120
+ },
121
+ tableCellMenu: {
122
+ width: 50,
123
+ display: 'table-cell',
124
+ },
125
+ }), { index: 1 });
126
+ export const SnapshotPage = observer((props) => {
127
+ var _a;
128
+ const classes = useStyles();
129
+ const history = useHistory();
130
+ const stores = useCreatedStores(props.api);
131
+ const [isOpenDestroyModal, setIsOpenDestroyModal] = useState(false);
132
+ const { snapshot, branchSnapshot, isSnapshotsLoading, snapshotError, branchSnapshotError, load, } = stores.main;
133
+ const afterSubmitClick = () => {
134
+ history.push(props.routes.snapshots());
135
+ load(props.snapshotId, props.instanceId);
136
+ };
137
+ const headRendered = (_jsxs(_Fragment, { children: [_jsx("style", { children: 'p { margin: 0;}' }), props.elements.breadcrumbs, _jsx(SectionTitle, { className: classes.title, tag: "h1", level: 1, text: `Snapshot ${props.snapshotId}`, children: _jsx(InstanceTabs, { tab: TABS_INDEX.SNAPSHOTS, isPlatform: props.isPlatform, instanceId: props.instanceId, hasLogs: props.api.initWS !== undefined }) })] }));
138
+ useEffect(() => {
139
+ load(props.snapshotId, props.instanceId);
140
+ }, []);
141
+ if (isSnapshotsLoading)
142
+ return _jsx(PageSpinner, {});
143
+ if (snapshotError || branchSnapshotError) {
144
+ return (_jsxs(_Fragment, { children: [headRendered, _jsx(ErrorStub, { title: (snapshotError === null || snapshotError === void 0 ? void 0 : snapshotError.title) || (branchSnapshotError === null || branchSnapshotError === void 0 ? void 0 : branchSnapshotError.title), message: (snapshotError === null || snapshotError === void 0 ? void 0 : snapshotError.message) || (branchSnapshotError === null || branchSnapshotError === void 0 ? void 0 : branchSnapshotError.message), className: classes.marginTop })] }));
145
+ }
146
+ return (_jsxs(_Fragment, { children: [headRendered, _jsxs("div", { className: classes.wrapper, children: [_jsxs("div", { className: classes.container, children: [_jsxs("div", { className: classes.actions, children: [_jsx(Button, { variant: "contained", color: "primary", onClick: () => history.push(props.routes.createClone(snapshot === null || snapshot === void 0 ? void 0 : snapshot.branch, snapshot === null || snapshot === void 0 ? void 0 : snapshot.id)), title: 'Create clone', className: classes.actionButton, children: "Create clone" }), _jsx(Button, { variant: "contained", color: "primary", onClick: () => setIsOpenDestroyModal(true), title: 'Delete this snapshot', className: classes.actionButton, children: "Delete snapshot" })] }), _jsx("br", {}), _jsxs("div", { children: [_jsxs("div", { children: [_jsx("p", { children: _jsx("strong", { children: "Created" }) }), _jsx("p", { className: classes.text, children: snapshot === null || snapshot === void 0 ? void 0 : snapshot.createdAt })] }), _jsx("br", {}), _jsxs("div", { children: [_jsxs("p", { children: [_jsx("strong", { children: "Data state at" }), "\u00A0", _jsx(Tooltip, { content: _jsxs(_Fragment, { children: [_jsx("strong", { children: "Data state time" }), " is a time at which data is\u00A0 recovered for this snapshot."] }), children: icons.infoIcon })] }), _jsx("p", { className: classes.text, children: (snapshot === null || snapshot === void 0 ? void 0 : snapshot.dataStateAt) || '-' })] }), _jsxs("div", { className: classes.summary, children: [_jsxs("p", { children: [_jsx("strong", { children: "Summary" }), "\u00A0"] }), _jsxs("p", { className: classes.text, children: [_jsx("span", { className: classes.paramTitle, children: "Number of clones:" }), snapshot === null || snapshot === void 0 ? void 0 : snapshot.numClones] }), _jsxs("p", { className: classes.text, children: [_jsx("span", { className: classes.paramTitle, children: "Logical data size:" }), (snapshot === null || snapshot === void 0 ? void 0 : snapshot.logicalSize)
147
+ ? formatBytesIEC(snapshot.logicalSize)
148
+ : '-'] }), _jsxs("p", { className: classes.text, children: [_jsx("span", { className: classes.paramTitle, children: "Physical data diff size:" }), (snapshot === null || snapshot === void 0 ? void 0 : snapshot.physicalSize)
149
+ ? formatBytesIEC(snapshot.physicalSize)
150
+ : '-'] }), (branchSnapshot === null || branchSnapshot === void 0 ? void 0 : branchSnapshot.message) && (_jsxs("p", { className: classes.text, children: [_jsx("span", { className: classes.paramTitle, children: "Message:" }), branchSnapshot.message] }))] }), _jsx("br", {}), _jsx("p", { children: _jsx("strong", { children: "Snapshot info" }) }), (snapshot === null || snapshot === void 0 ? void 0 : snapshot.pool) && (_jsxs("div", { className: classes.copyFieldContainer, children: [_jsx(TextField, { variant: "outlined", label: "snapshot pool", value: snapshot.pool, className: classes.textField, margin: "normal", fullWidth: true, InputLabelProps: {
151
+ shrink: true,
152
+ style: styles.inputFieldLabel,
153
+ }, FormHelperTextProps: {
154
+ style: styles.inputFieldHelper,
155
+ } }), _jsx(IconButton, { className: classes.copyButton, "aria-label": "Copy", onClick: () => copyToClipboard(snapshot.pool), children: icons.copyIcon })] })), _jsxs("div", { className: classes.copyFieldContainer, children: [_jsx(TextField, { variant: "outlined", label: "snapshot ID", value: snapshot === null || snapshot === void 0 ? void 0 : snapshot.id, className: classes.textField, margin: "normal", fullWidth: true, InputLabelProps: {
156
+ shrink: true,
157
+ style: styles.inputFieldLabel,
158
+ }, FormHelperTextProps: {
159
+ style: styles.inputFieldHelper,
160
+ } }), _jsx(IconButton, { className: classes.copyButton, "aria-label": "Copy", onClick: () => copyToClipboard(String(snapshot === null || snapshot === void 0 ? void 0 : snapshot.id)), children: icons.copyIcon })] }), _jsx("br", {}), (branchSnapshot === null || branchSnapshot === void 0 ? void 0 : branchSnapshot.branch) && ((_a = branchSnapshot.branch) === null || _a === void 0 ? void 0 : _a.length) > 0 && (_jsxs(_Fragment, { children: [_jsxs("p", { className: classes.centerContent, children: [_jsxs("strong", { children: ["Related branches (", branchSnapshot.branch.length, ")"] }), "\u00A0", _jsx(Tooltip, { content: _jsx(_Fragment, { children: "List of branches pointing at the same snapshot. \u00A0" }), children: icons.infoIcon })] }), _jsx(HorizontalScrollContainer, { children: _jsxs(Table, { className: classes.tableContainer, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableHeaderCell, {}), _jsx(TableHeaderCell, { children: "Name" })] }) }), _jsx(TableBody, { children: branchSnapshot.branch.map((branch, id) => (_jsxs(TableRow, { className: classes.pointerCursor, hover: true, onClick: () => history.push(props.routes.branch(branch)), children: [_jsx("div", { className: classes.tableCellMenu, children: _jsx(TableBodyCellMenu, { actions: [
161
+ {
162
+ name: 'Copy branch name',
163
+ onClick: () => copyToClipboard(branch),
164
+ },
165
+ ] }) }), _jsx(TableBodyCell, { children: branch })] }, id))) })] }) })] })), _jsx("br", {}), (snapshot === null || snapshot === void 0 ? void 0 : snapshot.clones) && snapshot.clones.length > 0 && (_jsxs(_Fragment, { children: [_jsx("p", { children: _jsxs("strong", { children: ["Clones (", snapshot.clones.length, ")"] }) }), _jsx(HorizontalScrollContainer, { children: _jsxs(Table, { className: classes.tableContainer, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableHeaderCell, {}), _jsx(TableHeaderCell, { children: "Name" })] }) }), _jsx(TableBody, { children: snapshot.clones.map((clone, id) => (_jsxs(TableRow, { className: classes.pointerCursor, hover: true, onClick: () => history.push(props.routes.clone(clone)), children: [_jsx("div", { className: classes.tableCellMenu, children: _jsx(TableBodyCellMenu, { actions: [
166
+ {
167
+ name: 'Copy clone name',
168
+ onClick: () => copyToClipboard(clone),
169
+ },
170
+ ] }) }), _jsx(TableBodyCell, { children: clone })] }, id))) })] }) })] }))] })] }), _jsxs("div", { className: classes.snippetContainer, children: [_jsx(SectionTitle, { className: classes.marginTop, tag: "h2", level: 2, text: 'Delete snapshot using CLI' }), _jsx("p", { className: classes.cliText, children: "You can delete this snapshot using CLI. To do this, run the command below:" }), _jsx(SyntaxHighlight, { content: `dblab snapshot delete ${snapshot === null || snapshot === void 0 ? void 0 : snapshot.id}` }), _jsx(SectionTitle, { className: classes.marginTop, tag: "h2", level: 2, text: 'Get snapshots using CLI' }), _jsx("p", { className: classes.cliText, children: "You can get a list of all snapshots using CLI. To do this, run the command below:" }), _jsx(SyntaxHighlight, { content: `dblab snapshot list` })] }), snapshot && (_jsx(DestroySnapshotModal, { isOpen: isOpenDestroyModal, onClose: () => setIsOpenDestroyModal(false), snapshotId: snapshot.id, instanceId: props.instanceId, afterSubmitClick: afterSubmitClick, destroySnapshot: stores.main.destroySnapshot }))] })] }));
171
+ });
@@ -0,0 +1,33 @@
1
+ import { SnapshotsStore, SnapshotsApi } from '@postgres.ai/shared/stores/Snapshots';
2
+ import { DestroySnapshot } from '@postgres.ai/shared/types/api/endpoints/destroySnapshot';
3
+ import { SnapshotDto } from '@postgres.ai/shared/types/api/entities/snapshot';
4
+ import { GetBranchSnapshot } from '@postgres.ai/shared/types/api/endpoints/getBranchSnapshot';
5
+ import { BranchSnapshotDto } from '@postgres.ai/shared/types/api/entities/branchSnapshot';
6
+ import { InitWS } from '@postgres.ai/shared/types/api/endpoints/initWS';
7
+ declare type Error = {
8
+ title?: string;
9
+ message: string;
10
+ };
11
+ export declare type Api = SnapshotsApi & {
12
+ destroySnapshot: DestroySnapshot;
13
+ getBranchSnapshot?: GetBranchSnapshot;
14
+ initWS: InitWS;
15
+ };
16
+ export declare class MainStore {
17
+ snapshot: SnapshotDto | null;
18
+ branchSnapshot: BranchSnapshotDto | null;
19
+ snapshotError: Error | null;
20
+ branchSnapshotError: Error | null;
21
+ isSnapshotsLoading: boolean;
22
+ private readonly api;
23
+ readonly snapshots: SnapshotsStore;
24
+ constructor(api: Api);
25
+ load: (snapshotId: string, instanceId: string) => Promise<void>;
26
+ getSnapshot: (snapshotId: string, instanceId: string) => Promise<boolean | undefined>;
27
+ getBranchSnapshot: (snapshotId: string, instanceId: string) => Promise<import("@postgres.ai/shared/types/api/entities/branchSnapshot").BranchSnapshotDTO | null | undefined>;
28
+ destroySnapshot: (snapshotId: string, forceDelete: boolean, instanceId: string) => Promise<{
29
+ response: boolean | null;
30
+ error: any;
31
+ } | undefined>;
32
+ }
33
+ export {};
@@ -0,0 +1,71 @@
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 { makeAutoObservable } from 'mobx';
8
+ import { SnapshotsStore, } from '@postgres.ai/shared/stores/Snapshots';
9
+ import { generateSnapshotPageId } from '@postgres.ai/shared/pages/Instance/Snapshots/utils';
10
+ export class MainStore {
11
+ constructor(api) {
12
+ this.snapshot = null;
13
+ this.branchSnapshot = null;
14
+ this.snapshotError = null;
15
+ this.branchSnapshotError = null;
16
+ this.isSnapshotsLoading = false;
17
+ this.load = async (snapshotId, instanceId) => {
18
+ if (!snapshotId)
19
+ return;
20
+ this.isSnapshotsLoading = true;
21
+ await this.snapshots.load(instanceId).then((loaded) => {
22
+ loaded && this.getSnapshot(snapshotId, instanceId);
23
+ });
24
+ };
25
+ this.getSnapshot = async (snapshotId, instanceId) => {
26
+ if (!snapshotId)
27
+ return;
28
+ const allSnapshots = this.snapshots.data;
29
+ const snapshot = allSnapshots === null || allSnapshots === void 0 ? void 0 : allSnapshots.filter((s) => {
30
+ return snapshotId === generateSnapshotPageId(s.id);
31
+ });
32
+ if (snapshot && (snapshot === null || snapshot === void 0 ? void 0 : snapshot.length) > 0) {
33
+ this.snapshot = snapshot[0];
34
+ this.getBranchSnapshot(snapshot[0].id, instanceId);
35
+ }
36
+ else {
37
+ this.isSnapshotsLoading = false;
38
+ this.snapshotError = {
39
+ title: 'Error',
40
+ message: `Snapshot "${snapshotId}" not found`,
41
+ };
42
+ }
43
+ return !!snapshot;
44
+ };
45
+ this.getBranchSnapshot = async (snapshotId, instanceId) => {
46
+ if (!snapshotId || !this.api.getBranchSnapshot)
47
+ return;
48
+ const { response, error } = await this.api.getBranchSnapshot(snapshotId, instanceId);
49
+ this.isSnapshotsLoading = false;
50
+ if (error) {
51
+ this.branchSnapshotError = await error.json().then((err) => err);
52
+ }
53
+ if (response) {
54
+ this.branchSnapshot = response;
55
+ }
56
+ return response;
57
+ };
58
+ this.destroySnapshot = async (snapshotId, forceDelete, instanceId) => {
59
+ if (!this.api.destroySnapshot || !snapshotId)
60
+ return;
61
+ const { response, error } = await this.api.destroySnapshot(snapshotId, forceDelete, instanceId);
62
+ return {
63
+ response,
64
+ error: error ? await error.json().then((err) => err) : null,
65
+ };
66
+ };
67
+ this.api = api;
68
+ this.snapshots = new SnapshotsStore(api);
69
+ makeAutoObservable(this);
70
+ }
71
+ }
@@ -0,0 +1,6 @@
1
+ import { MainStore } from './stores/Main';
2
+ import { Host } from './context';
3
+ export declare const useCreatedStores: (api: Host["api"]) => {
4
+ main: MainStore;
5
+ };
6
+ export declare type Stores = ReturnType<typeof useCreatedStores>;
@@ -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
+ });
@@ -1,15 +1,24 @@
1
1
  import { Snapshot } from '@postgres.ai/shared/types/api/entities/snapshot';
2
2
  import { GetSnapshots } from '@postgres.ai/shared/types/api/endpoints/getSnapshots';
3
+ import { CreateSnapshot } from '@postgres.ai/shared/types/api/endpoints/createSnapshot';
3
4
  export declare type SnapshotsApi = {
4
- getSnapshots: GetSnapshots;
5
+ getSnapshots?: GetSnapshots;
6
+ createSnapshot?: CreateSnapshot;
5
7
  };
6
8
  export declare class SnapshotsStore {
7
9
  data: Snapshot[] | null;
8
10
  error: string | null;
9
11
  isLoading: boolean;
12
+ snapshotDataLoading: boolean;
13
+ snapshotData: boolean | null;
14
+ snapshotDataError: {
15
+ title?: string;
16
+ message?: string;
17
+ } | null;
10
18
  private readonly api;
11
19
  constructor(api: SnapshotsApi);
12
- load: (instanceId: string) => Promise<boolean>;
13
- reload: (instanceId: string) => Promise<boolean>;
20
+ load: (instanceId: string) => Promise<boolean | undefined>;
21
+ reload: (instanceId: string, branchName?: string) => Promise<boolean | undefined>;
22
+ createSnapshot: (cloneId: string, message: string, instanceId: string) => Promise<import("../types/api/entities/createSnapshot").CreateSnapshotDTO | null | undefined>;
14
23
  private loadData;
15
24
  }
@@ -10,15 +10,39 @@ export class SnapshotsStore {
10
10
  this.data = null;
11
11
  this.error = null;
12
12
  this.isLoading = false;
13
+ this.snapshotDataLoading = false;
14
+ this.snapshotData = null;
15
+ this.snapshotDataError = null;
13
16
  this.load = (instanceId) => {
14
17
  this.data = null;
15
18
  this.error = null;
16
19
  return this.loadData(instanceId);
17
20
  };
18
- this.reload = (instanceId) => this.loadData(instanceId);
19
- this.loadData = async (instanceId) => {
21
+ this.reload = (instanceId, branchName) => this.loadData(instanceId, branchName);
22
+ this.createSnapshot = async (cloneId, message, instanceId) => {
23
+ if (!this.api.createSnapshot || !cloneId)
24
+ return;
25
+ this.snapshotDataLoading = true;
26
+ this.snapshotDataError = null;
27
+ const { response, error } = await this.api.createSnapshot(cloneId, message, instanceId);
28
+ this.snapshotDataLoading = false;
29
+ if (response) {
30
+ this.snapshotData = !!response;
31
+ this.reload('');
32
+ }
33
+ if (error) {
34
+ this.snapshotDataError = await error.json().then((err) => err);
35
+ }
36
+ return response;
37
+ };
38
+ this.loadData = async (instanceId, branchName) => {
39
+ if (!this.api.getSnapshots)
40
+ return;
20
41
  this.isLoading = true;
21
- const { response, error } = await this.api.getSnapshots({ instanceId });
42
+ const { response, error } = await this.api.getSnapshots({
43
+ instanceId,
44
+ branchName,
45
+ });
22
46
  this.isLoading = false;
23
47
  if (response)
24
48
  this.data = response;
@@ -0,0 +1,12 @@
1
+ import { CreateBranchResponse } from '@postgres.ai/shared/types/api/entities/createBranch';
2
+ export declare type CreateBranchFormValues = {
3
+ branchName: string;
4
+ instanceId: string;
5
+ baseBranch: string;
6
+ snapshotID: string;
7
+ creationType?: 'branch' | 'snapshot';
8
+ };
9
+ export declare type CreateBranch = (values: CreateBranchFormValues) => Promise<{
10
+ response: CreateBranchResponse | null;
11
+ error: Response | null;
12
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -6,6 +6,7 @@ export declare type CreateClone = (args: {
6
6
  dbUser: string;
7
7
  dbPassword: string;
8
8
  isProtected: boolean;
9
+ branch?: string;
9
10
  }) => Promise<{
10
11
  response: Clone | null;
11
12
  error: Response | null;
@@ -0,0 +1,5 @@
1
+ import { CreateSnapshotResponse } from '@postgres.ai/shared/types/api/entities/createSnapshot';
2
+ export declare type CreateSnapshot = (cloneID: string, message: string, instanceId: string) => Promise<{
3
+ response: CreateSnapshotResponse | null;
4
+ error: Response | null;
5
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare type DeleteBranch = (branchName: string, instanceId: string) => Promise<{
2
+ response: Response | null;
3
+ error: Error | null;
4
+ }>;
@@ -0,0 +1 @@
1
+ export {};