@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
@@ -12,13 +12,15 @@ import { Button } from '@postgres.ai/shared/components/Button2';
12
12
  import { StubSpinner } from '@postgres.ai/shared/components/StubSpinner';
13
13
  import { SectionTitle } from '@postgres.ai/shared/components/SectionTitle';
14
14
  import { ErrorStub } from '@postgres.ai/shared/components/ErrorStub';
15
- import { Tabs } from './Tabs';
15
+ import { TABS_INDEX, InstanceTabs } from './Tabs';
16
16
  import { Logs } from '../Logs';
17
17
  import { Clones } from './Clones';
18
18
  import { Info } from './Info';
19
- import { Configuration } from '../Configuration';
20
- import { ClonesModal } from './ClonesModal';
19
+ import { Snapshots } from './Snapshots';
20
+ import { Branches } from '../Branches';
21
+ import { Configuration } from './Configuration';
21
22
  import { SnapshotsModal } from './SnapshotsModal';
23
+ import { ClonesModal } from './Clones/ClonesModal';
22
24
  import { InactiveInstance } from './InactiveInstance';
23
25
  import { HostProvider, StoresProvider } from './context';
24
26
  import Typography from '@material-ui/core/Typography';
@@ -50,24 +52,24 @@ const useStyles = makeStyles((theme) => ({
50
52
  export const Instance = observer((props) => {
51
53
  var _a, _b, _c, _d;
52
54
  const classes = useStyles();
53
- const { instanceId, api } = props;
54
- const [activeTab, setActiveTab] = React.useState(0);
55
+ const { instanceId, api, isPlatform } = props;
56
+ const [activeTab, setActiveTab] = React.useState((props === null || props === void 0 ? void 0 : props.renderCurrentTab) || TABS_INDEX.OVERVIEW);
55
57
  const [hasBeenRedirected, setHasBeenRedirected] = React.useState(false);
56
58
  const stores = useCreatedStores(props);
57
- const { instance, instanceError, instanceRetrieval, isLoadingInstance, load, reload, } = stores.main;
59
+ const { instance, instanceError, instanceRetrieval, isLoadingInstance, load, } = stores.main;
58
60
  const switchTab = (_, tabID) => {
59
61
  const contentElement = document.getElementById('content-container');
60
62
  setActiveTab(tabID);
61
63
  if (tabID === 0) {
62
64
  load(props.instanceId);
63
65
  }
64
- contentElement === null || contentElement === void 0 ? void 0 : contentElement.scroll(0, 0);
66
+ contentElement === null || contentElement === void 0 ? void 0 : contentElement.scrollTo(0, 0);
65
67
  };
66
68
  const isInstanceIntegrated = instanceRetrieval ||
67
69
  (!isLoadingInstance && instance && (instance === null || instance === void 0 ? void 0 : instance.url) && !instanceError);
68
70
  const isConfigurationActive = (instanceRetrieval === null || instanceRetrieval === void 0 ? void 0 : instanceRetrieval.mode) !== 'physical';
69
71
  useEffect(() => {
70
- load(instanceId);
72
+ load(instanceId, isPlatform);
71
73
  }, [instanceId]);
72
74
  useEffect(() => {
73
75
  if (props.setProjectAlias)
@@ -76,16 +78,15 @@ export const Instance = observer((props) => {
76
78
  useEffect(() => {
77
79
  var _a, _b;
78
80
  if (instance &&
79
- ((_b = (_a = instance === null || instance === void 0 ? void 0 : instance.state) === null || _a === void 0 ? void 0 : _a.retrieving) === null || _b === void 0 ? void 0 : _b.status) === 'pending' &&
81
+ ((_b = (_a = instance.state) === null || _a === void 0 ? void 0 : _a.retrieving) === null || _b === void 0 ? void 0 : _b.status) === 'pending' &&
80
82
  isConfigurationActive &&
81
- !props.isPlatform &&
82
83
  !hasBeenRedirected) {
83
- setActiveTab(2);
84
+ setActiveTab(TABS_INDEX.CONFIGURATION);
84
85
  setHasBeenRedirected(true);
85
86
  }
86
87
  }, [instance, hasBeenRedirected]);
87
- return (_jsx(HostProvider, { value: props, children: _jsxs(StoresProvider, { value: stores, children: [props.elements.breadcrumbs, _jsx(SectionTitle, { text: props.title, level: 1, tag: "h1", className: classes.title, rightContent: _jsx(Button, { onClick: () => reload(props.instanceId), isDisabled: !instance && !instanceError, className: classes.reloadButton, children: "Reload info" }), children: isInstanceIntegrated && (_jsx(Tabs, { isPlatform: props.isPlatform, value: activeTab, handleChange: switchTab, hasLogs: api.initWS != undefined })) }), instanceError && (_jsx(ErrorStub, { ...instanceError, className: classes.errorStub })), isInstanceIntegrated ? (_jsxs(_Fragment, { children: [_jsxs(TabPanel, { value: activeTab, index: 0, children: [!instanceError && (_jsxs("div", { className: classes.content, children: [!instance ||
88
- (!((_b = (_a = instance === null || instance === void 0 ? void 0 : instance.state) === null || _a === void 0 ? void 0 : _a.retrieving) === null || _b === void 0 ? void 0 : _b.status) && _jsx(StubSpinner, {})), instance ? (_jsxs(_Fragment, { children: [_jsx(Clones, {}), _jsx(Info, {})] })) : (_jsx(StubSpinner, {}))] })), _jsx(ClonesModal, {}), _jsx(SnapshotsModal, {})] }), !props.isPlatform && (_jsxs(_Fragment, { children: [_jsx(TabPanel, { value: activeTab, index: 1, children: activeTab === 1 && _jsx(Logs, { api: api }) }), _jsx(TabPanel, { value: activeTab, index: 2, children: _jsx(Configuration, { isConfigurationActive: isConfigurationActive, disableConfigModification: (_c = instance === null || instance === void 0 ? void 0 : instance.state) === null || _c === void 0 ? void 0 : _c.engine.disableConfigModification, switchActiveTab: switchTab, reload: () => load(props.instanceId) }) })] }))] })) : !isLoadingInstance && !instanceError ? (_jsx(TabPanel, { value: activeTab, index: activeTab, children: _jsx(InactiveInstance, { instance: instance, org: (_d = props.elements.breadcrumbs) === null || _d === void 0 ? void 0 : _d.props.org }) })) : (!instanceError && (_jsx(TabPanel, { value: activeTab, index: 0, children: _jsx("div", { className: classes.content, children: _jsx(StubSpinner, {}) }) })))] }) }));
88
+ return (_jsx(HostProvider, { value: props, children: _jsxs(StoresProvider, { value: stores, children: [props.elements.breadcrumbs, _jsx(SectionTitle, { text: props.title, level: 1, tag: "h1", className: classes.title, rightContent: _jsx(Button, { onClick: () => load(props.instanceId, isPlatform), isDisabled: !instance && !instanceError, className: classes.reloadButton, children: "Reload info" }), children: isInstanceIntegrated && (_jsx(InstanceTabs, { instanceId: props.instanceId, tab: activeTab, onTabChange: (tabID) => setActiveTab(tabID), isPlatform: isPlatform, hasLogs: api.initWS !== undefined })) }), instanceError && (_jsx(ErrorStub, { ...instanceError, className: classes.errorStub })), isInstanceIntegrated ? (_jsxs(_Fragment, { children: [_jsxs(TabPanel, { value: activeTab, index: TABS_INDEX.OVERVIEW, children: [!instanceError && (_jsx("div", { className: classes.content, children: instance && ((_b = (_a = instance.state) === null || _a === void 0 ? void 0 : _a.retrieving) === null || _b === void 0 ? void 0 : _b.status) ? (_jsxs(_Fragment, { children: [_jsx(Clones, {}), _jsx(Info, {})] })) : (_jsx(StubSpinner, {})) })), _jsx(ClonesModal, {}), _jsx(SnapshotsModal, {})] }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.CLONES, children: activeTab === TABS_INDEX.CLONES && (_jsx("div", { className: classes.content, children: !instanceError &&
89
+ (instance ? _jsx(Clones, { onlyRenderList: true }) : _jsx(StubSpinner, {})) })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.LOGS, children: activeTab === TABS_INDEX.LOGS && (_jsx(Logs, { api: api, instanceId: props.instanceId })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.CONFIGURATION, children: activeTab === TABS_INDEX.CONFIGURATION && (_jsx(Configuration, { instanceId: instanceId, switchActiveTab: switchTab, isConfigurationActive: isConfigurationActive, reload: () => load(props.instanceId), disableConfigModification: (_c = instance === null || instance === void 0 ? void 0 : instance.state) === null || _c === void 0 ? void 0 : _c.engine.disableConfigModification })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.SNAPSHOTS, children: activeTab === TABS_INDEX.SNAPSHOTS && (_jsx(Snapshots, { instanceId: instanceId })) }), _jsx(TabPanel, { value: activeTab, index: TABS_INDEX.BRANCHES, children: activeTab === TABS_INDEX.BRANCHES && (_jsx(Branches, { instanceId: instanceId })) })] })) : !isLoadingInstance && !instanceError ? (_jsx(TabPanel, { value: activeTab, index: activeTab, children: _jsx(InactiveInstance, { instance: instance, org: (_d = props.elements.breadcrumbs) === null || _d === void 0 ? void 0 : _d.props.org }) })) : (!instanceError && (_jsx(TabPanel, { value: activeTab, index: activeTab, children: _jsx("div", { className: classes.content, children: _jsx(StubSpinner, {}) }) })))] }) }));
89
90
  });
90
91
  function TabPanel(props) {
91
92
  const { children, value, index, ...other } = props;
@@ -1,4 +1,5 @@
1
1
  import { GetSnapshots } from '@postgres.ai/shared/types/api/endpoints/getSnapshots';
2
+ import { CreateSnapshot } from '@postgres.ai/shared/types/api/endpoints/createSnapshot';
2
3
  import { GetInstance } from '@postgres.ai/shared/types/api/endpoints/getInstance';
3
4
  import { Config } from '@postgres.ai/shared/types/api/entities/config';
4
5
  import { GetConfig } from '@postgres.ai/shared/types/api/endpoints/getConfig';
@@ -16,14 +17,19 @@ import { GetFullConfig } from '@postgres.ai/shared/types/api/endpoints/getFullCo
16
17
  import { GetInstanceRetrieval } from '@postgres.ai/shared/types/api/endpoints/getInstanceRetrieval';
17
18
  import { InstanceRetrievalType } from '@postgres.ai/shared/types/api/entities/instanceRetrieval';
18
19
  import { GetEngine } from '@postgres.ai/shared/types/api/endpoints/getEngine';
20
+ import { GetSnapshotList } from '@postgres.ai/shared/types/api/endpoints/getSnapshotList';
21
+ import { GetBranches } from '@postgres.ai/shared/types/api/endpoints/getBranches';
22
+ import { DeleteBranch } from '@postgres.ai/shared/types/api/endpoints/deleteBranch';
19
23
  import { GetSeImages } from '@postgres.ai/shared/types/api/endpoints/getSeImages';
24
+ import { DestroySnapshot } from '@postgres.ai/shared/types/api/endpoints/destroySnapshot';
20
25
  export declare type Api = {
21
26
  getInstance: GetInstance;
22
- getSnapshots: GetSnapshots;
27
+ getSnapshots?: GetSnapshots;
28
+ createSnapshot?: CreateSnapshot;
23
29
  refreshInstance?: RefreshInstance;
24
- destroyClone: DestroyClone;
25
- resetClone: ResetClone;
26
- getWSToken: GetWSToken;
30
+ destroyClone?: DestroyClone;
31
+ resetClone?: ResetClone;
32
+ getWSToken?: GetWSToken;
27
33
  initWS?: InitWS;
28
34
  getConfig?: GetConfig;
29
35
  updateConfig?: UpdateConfig;
@@ -32,6 +38,10 @@ export declare type Api = {
32
38
  getSeImages?: GetSeImages;
33
39
  getEngine?: GetEngine;
34
40
  getInstanceRetrieval?: GetInstanceRetrieval;
41
+ getBranches?: GetBranches;
42
+ getSnapshotList?: GetSnapshotList;
43
+ deleteBranch?: DeleteBranch;
44
+ destroySnapshot?: DestroySnapshot;
35
45
  };
36
46
  declare type Error = {
37
47
  title?: string;
@@ -42,10 +52,14 @@ export declare class MainStore {
42
52
  instanceRetrieval: InstanceRetrievalType | null;
43
53
  config: Config | null;
44
54
  fullConfig?: string;
55
+ dleEdition?: string;
45
56
  platformUrl?: string;
57
+ uiVersion?: string;
46
58
  instanceError: Error | null;
47
59
  configError: string | null;
48
60
  getFullConfigError: string | null;
61
+ getBranchesError: Error | null;
62
+ snapshotListError: string | null;
49
63
  seImagesError: string | undefined | null;
50
64
  unstableClones: Set<string>;
51
65
  readonly snapshots: SnapshotsStore;
@@ -53,17 +67,19 @@ export declare class MainStore {
53
67
  isConfigurationLoading: boolean;
54
68
  isReloadingInstance: boolean;
55
69
  isReloadingInstanceRetrieval: boolean;
70
+ isBranchesLoading: boolean;
71
+ isConfigLoading: boolean;
56
72
  isLoadingInstance: boolean;
57
73
  private readonly api;
58
74
  constructor(api: Api);
59
75
  get isDisabledInstance(): boolean;
60
- load: (instanceId: string) => void;
76
+ load: (instanceId: string, isPlatform?: boolean) => void;
61
77
  reload: (instanceId: string) => void;
62
- reloadSnapshots: () => Promise<void>;
78
+ reloadSnapshots: (branchName?: string) => Promise<void>;
63
79
  reloadInstanceRetrieval: () => Promise<void>;
64
80
  private loadInstanceRetrieval;
65
81
  private loadInstance;
66
- getConfig: () => Promise<{
82
+ getConfig: (instanceId: string) => Promise<{
67
83
  dockerPath: string | undefined;
68
84
  tuningParams: string;
69
85
  sharedBuffers: string | undefined;
@@ -86,12 +102,12 @@ export declare class MainStore {
86
102
  debug: boolean | undefined;
87
103
  dockerImage: string | undefined;
88
104
  } | null | undefined>;
89
- updateConfig: (values: Config) => Promise<Response | null | undefined>;
90
- getFullConfig: () => Promise<string | null | undefined>;
105
+ updateConfig: (values: Config, instanceId: string) => Promise<Response | null | undefined>;
106
+ getFullConfig: (instanceId: string) => Promise<string | null | undefined>;
91
107
  getSeImages: (values: {
92
108
  packageGroup: string;
93
109
  }) => Promise<import("@postgres.ai/shared/types/api/endpoints/getSeImages").SeImages[] | null | undefined>;
94
- getEngine: () => Promise<import("@postgres.ai/shared/types/api/endpoints/getEngine").EngineDto | null | undefined>;
110
+ getEngine: (instanceId: string) => Promise<import("@postgres.ai/shared/types/api/endpoints/getEngine").EngineDto | null | undefined>;
95
111
  testDbSource: (values: dbSource) => Promise<{
96
112
  response: {
97
113
  status: number;
@@ -111,5 +127,15 @@ export declare class MainStore {
111
127
  destroyClone: (cloneId: string) => Promise<boolean | undefined>;
112
128
  private liveUpdateInstance;
113
129
  reloadClones: () => Promise<void>;
130
+ getBranches: (instanceId: string) => Promise<import("@postgres.ai/shared/types/api/endpoints/getBranches").Branch[] | null | undefined>;
131
+ deleteBranch: (branchName: string, instanceId: string) => Promise<{
132
+ response: Response | null;
133
+ error: globalThis.Error | null;
134
+ } | undefined>;
135
+ getSnapshotList: (branchName: string, instanceId: string) => Promise<import("@postgres.ai/shared/types/api/endpoints/getSnapshotList").SnapshotList[] | null | undefined>;
136
+ destroySnapshot: (snapshotId: string, forceDelete: boolean, instanceId: string) => Promise<{
137
+ response: boolean | null;
138
+ error: any;
139
+ } | undefined>;
114
140
  }
115
141
  export {};
@@ -16,28 +16,45 @@ export class MainStore {
16
16
  this.instanceError = null;
17
17
  this.configError = null;
18
18
  this.getFullConfigError = null;
19
+ this.getBranchesError = null;
20
+ this.snapshotListError = null;
19
21
  this.seImagesError = null;
20
22
  this.unstableClones = new Set();
21
23
  this.isReloadingClones = false;
22
24
  this.isConfigurationLoading = false;
23
25
  this.isReloadingInstance = false;
24
26
  this.isReloadingInstanceRetrieval = false;
27
+ this.isBranchesLoading = false;
28
+ this.isConfigLoading = false;
25
29
  this.isLoadingInstance = false;
26
- this.load = (instanceId) => {
30
+ this.load = (instanceId, isPlatform = false) => {
27
31
  this.instance = null;
28
32
  this.isReloadingInstance = true;
33
+ if (!isPlatform) {
34
+ this.getBranches(instanceId);
35
+ }
36
+ const runRetrieval = () => {
37
+ this.loadInstanceRetrieval(instanceId).then(() => {
38
+ if (this.instanceRetrieval) {
39
+ this.getConfig(instanceId);
40
+ this.getFullConfig(instanceId);
41
+ }
42
+ });
43
+ };
29
44
  this.loadInstance(instanceId, false).then(() => {
30
- var _a, _b, _c;
31
- if (((_a = this.instance) === null || _a === void 0 ? void 0 : _a.createdAt) && ((_b = this.instance) === null || _b === void 0 ? void 0 : _b.url) || !((_c = this.instance) === null || _c === void 0 ? void 0 : _c.createdAt)) {
45
+ var _a, _b, _c, _d;
46
+ if ((((_a = this.instance) === null || _a === void 0 ? void 0 : _a.createdAt) && ((_b = this.instance) === null || _b === void 0 ? void 0 : _b.url)) ||
47
+ !((_c = this.instance) === null || _c === void 0 ? void 0 : _c.createdAt)) {
32
48
  this.snapshots.load(instanceId);
33
49
  }
34
- });
35
- this.loadInstanceRetrieval(instanceId).then(() => {
36
- if (this.instanceRetrieval) {
37
- this.getConfig();
38
- this.getFullConfig();
50
+ if (isPlatform && ((_d = this.instance) === null || _d === void 0 ? void 0 : _d.url)) {
51
+ this.getBranches(instanceId);
52
+ runRetrieval();
39
53
  }
40
54
  });
55
+ if (!isPlatform) {
56
+ runRetrieval();
57
+ }
41
58
  };
42
59
  this.reload = (instanceId) => {
43
60
  this.instance = null;
@@ -46,21 +63,22 @@ export class MainStore {
46
63
  var _a, _b, _c;
47
64
  if (this.api.refreshInstance)
48
65
  this.api.refreshInstance({ instanceId: instanceId });
49
- if (((_a = this.instance) === null || _a === void 0 ? void 0 : _a.createdAt) && ((_b = this.instance) === null || _b === void 0 ? void 0 : _b.url) || !((_c = this.instance) === null || _c === void 0 ? void 0 : _c.createdAt)) {
66
+ if ((((_a = this.instance) === null || _a === void 0 ? void 0 : _a.createdAt) && ((_b = this.instance) === null || _b === void 0 ? void 0 : _b.url)) ||
67
+ !((_c = this.instance) === null || _c === void 0 ? void 0 : _c.createdAt)) {
50
68
  this.snapshots.load(instanceId);
51
69
  }
52
70
  });
53
71
  this.loadInstanceRetrieval(instanceId).then(() => {
54
72
  if (this.instanceRetrieval) {
55
- this.getConfig();
56
- this.getFullConfig();
73
+ this.getConfig(instanceId);
74
+ this.getFullConfig(instanceId);
57
75
  }
58
76
  });
59
77
  };
60
- this.reloadSnapshots = async () => {
78
+ this.reloadSnapshots = async (branchName) => {
61
79
  if (!this.instance)
62
80
  return;
63
- await this.snapshots.reload(this.instance.id);
81
+ await this.snapshots.reload(this.instance.id, branchName);
64
82
  };
65
83
  this.reloadInstanceRetrieval = async () => {
66
84
  if (!this.instance)
@@ -111,12 +129,14 @@ export class MainStore {
111
129
  this.instanceError = { message: await getTextFromUnknownApiError(error) };
112
130
  return !!response;
113
131
  };
114
- this.getConfig = async () => {
132
+ this.getConfig = async (instanceId) => {
115
133
  if (!this.api.getConfig)
116
134
  return;
117
135
  this.isConfigurationLoading = true;
118
- const { response, error } = await this.api.getConfig();
136
+ this.isConfigLoading = true;
137
+ const { response, error } = await this.api.getConfig(instanceId);
119
138
  this.isConfigurationLoading = false;
139
+ this.isConfigLoading = false;
120
140
  if (response) {
121
141
  this.config = response;
122
142
  this.configError = null;
@@ -126,23 +146,24 @@ export class MainStore {
126
146
  }
127
147
  return response;
128
148
  };
129
- this.updateConfig = async (values) => {
149
+ this.updateConfig = async (values, instanceId) => {
130
150
  if (!this.api.updateConfig)
131
151
  return;
132
- const { response, error } = await this.api.updateConfig({ ...values });
152
+ const { response, error } = await this.api.updateConfig({ ...values }, instanceId);
133
153
  if (error)
134
154
  this.configError = await error.json().then((err) => err.message);
135
155
  return response;
136
156
  };
137
- this.getFullConfig = async () => {
138
- var _a, _b;
157
+ this.getFullConfig = async (instanceId) => {
158
+ var _a, _b, _c, _d, _e;
139
159
  if (!this.api.getFullConfig)
140
160
  return;
141
- const { response, error } = await this.api.getFullConfig();
161
+ const { response, error } = await this.api.getFullConfig(instanceId);
142
162
  if (response) {
143
163
  this.fullConfig = response;
144
164
  const splitYML = this.fullConfig.split('---');
145
165
  this.platformUrl = (_b = (_a = splitYML[0]) === null || _a === void 0 ? void 0 : _a.split('url: ')[1]) === null || _b === void 0 ? void 0 : _b.split('\n')[0];
166
+ this.uiVersion = (_e = (_d = (_c = splitYML[0]) === null || _c === void 0 ? void 0 : _c.split('dockerImage: "postgresai/ce-ui:')[2]) === null || _d === void 0 ? void 0 : _d.split('\n')[0]) === null || _e === void 0 ? void 0 : _e.replace(/['"]+/g, '');
146
167
  }
147
168
  if (error)
148
169
  this.getFullConfigError = await error
@@ -165,11 +186,14 @@ export class MainStore {
165
186
  }
166
187
  return response;
167
188
  };
168
- this.getEngine = async () => {
189
+ this.getEngine = async (instanceId) => {
169
190
  if (!this.api.getEngine)
170
191
  return;
171
192
  this.configError = null;
172
- const { response, error } = await this.api.getEngine();
193
+ const { response, error } = await this.api.getEngine(instanceId);
194
+ if (response) {
195
+ this.dleEdition = response.edition;
196
+ }
173
197
  if (error)
174
198
  await getTextFromUnknownApiError(error);
175
199
  return response;
@@ -184,7 +208,7 @@ export class MainStore {
184
208
  };
185
209
  };
186
210
  this.resetClone = async (cloneId, snapshotId) => {
187
- if (!this.instance)
211
+ if (!this.instance || !this.api.resetClone)
188
212
  return;
189
213
  this.unstableClones.add(cloneId);
190
214
  const { response, error } = await this.api.resetClone({
@@ -199,7 +223,7 @@ export class MainStore {
199
223
  return !!response;
200
224
  };
201
225
  this.destroyClone = async (cloneId) => {
202
- if (!this.instance)
226
+ if (!this.instance || !this.api.destroyClone)
203
227
  return;
204
228
  this.unstableClones.add(cloneId);
205
229
  const { response, error } = await this.api.destroyClone({
@@ -230,6 +254,41 @@ export class MainStore {
230
254
  await this.loadInstanceRetrieval(this.instance.id);
231
255
  this.isReloadingClones = false;
232
256
  };
257
+ this.getBranches = async (instanceId) => {
258
+ if (!this.api.getBranches)
259
+ return;
260
+ this.isBranchesLoading = true;
261
+ const { response, error } = await this.api.getBranches(instanceId);
262
+ this.isBranchesLoading = false;
263
+ if (error)
264
+ this.getBranchesError = await error.json().then((err) => err);
265
+ return response;
266
+ };
267
+ this.deleteBranch = async (branchName, instanceId) => {
268
+ if (!branchName || !this.api.deleteBranch)
269
+ return;
270
+ const { response, error } = await this.api.deleteBranch(branchName, instanceId);
271
+ return { response, error };
272
+ };
273
+ this.getSnapshotList = async (branchName, instanceId) => {
274
+ if (!this.api.getSnapshotList)
275
+ return;
276
+ const { response, error } = await this.api.getSnapshotList(branchName, instanceId);
277
+ this.isBranchesLoading = false;
278
+ if (error) {
279
+ this.snapshotListError = await error.json().then((err) => err.message);
280
+ }
281
+ return response;
282
+ };
283
+ this.destroySnapshot = async (snapshotId, forceDelete, instanceId) => {
284
+ if (!this.api.destroySnapshot || !snapshotId)
285
+ return;
286
+ const { response, error } = await this.api.destroySnapshot(snapshotId, forceDelete, instanceId);
287
+ return {
288
+ response,
289
+ error: error ? await error.json().then((err) => err) : null,
290
+ };
291
+ };
233
292
  makeAutoObservable(this);
234
293
  this.api = api;
235
294
  this.snapshots = new SnapshotsStore(api);
@@ -5,13 +5,12 @@
5
5
  *--------------------------------------------------------------------------
6
6
  */
7
7
 
8
- #logs-container {
8
+ #logs-container {
9
9
  margin: 20px 0 0 0;
10
10
  border: 1px solid #b4b4b4;
11
11
  border-radius: 4px;
12
12
  overflow: hidden;
13
13
  padding: 0.5rem 1rem;
14
-
15
14
  & > p {
16
15
  font-size: small;
17
16
  font-family: 'Fira Code', monospace;
@@ -31,10 +30,8 @@
31
30
  background-color: #fff2e5;
32
31
  color: #000;
33
32
  font-weight: 500;
34
- font-size: 11px;
35
33
  padding: 6px 8px;
36
34
  border-radius: 4px;
37
35
  transition: all 40050ms ease;
38
36
  cursor: pointer;
39
- z-index: 1;
40
37
  }
@@ -6,6 +6,7 @@ export const useWsScroll = (isLoading, simpleInstall) => {
6
6
  useEffect(() => {
7
7
  var _a;
8
8
  !isLoading && wsSnackbar(isAtBottom, isNewData);
9
+ const contentElement = document.getElementById('content-container');
9
10
  const targetNode = simpleInstall
10
11
  ? (_a = document.getElementById('logs-container')) === null || _a === void 0 ? void 0 : _a.parentElement
11
12
  : document.getElementById('logs-container');
@@ -22,18 +23,15 @@ export const useWsScroll = (isLoading, simpleInstall) => {
22
23
  const handleInsert = (e) => {
23
24
  var _a;
24
25
  if (((_a = e.srcElement) === null || _a === void 0 ? void 0 : _a.tagName) !== 'DIV') {
25
- isAtBottom &&
26
- (targetNode === null || targetNode === void 0 ? void 0 : targetNode.scroll({
27
- top: targetNode.scrollHeight,
28
- }));
26
+ isAtBottom && (targetNode === null || targetNode === void 0 ? void 0 : targetNode.scrollIntoView(false));
29
27
  setIsNewData(true);
30
28
  }
31
29
  };
32
- targetNode === null || targetNode === void 0 ? void 0 : targetNode.addEventListener('scroll', handleScroll, false);
33
- targetNode === null || targetNode === void 0 ? void 0 : targetNode.addEventListener('DOMNodeInserted', handleInsert, false);
30
+ contentElement === null || contentElement === void 0 ? void 0 : contentElement.addEventListener('scroll', handleScroll, false);
31
+ contentElement === null || contentElement === void 0 ? void 0 : contentElement.addEventListener('DOMNodeInserted', handleInsert, false);
34
32
  return () => {
35
- targetNode === null || targetNode === void 0 ? void 0 : targetNode.removeEventListener('scroll', handleScroll, false);
36
- targetNode === null || targetNode === void 0 ? void 0 : targetNode.removeEventListener('DOMNodeInserted', handleInsert, false);
33
+ contentElement === null || contentElement === void 0 ? void 0 : contentElement.removeEventListener('scroll', handleScroll, false);
34
+ contentElement === null || contentElement === void 0 ? void 0 : contentElement.removeEventListener('DOMNodeInserted', handleInsert, false);
37
35
  };
38
36
  }, [isAtBottom, isNewData, isLoading]);
39
37
  };
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Api } from '@postgres.ai/shared/pages/Instance/stores/Main';
3
- export declare const Logs: ({ api }: {
3
+ export declare const Logs: ({ api, instanceId }: {
4
4
  api: Api;
5
+ instanceId: string;
5
6
  }) => JSX.Element;
@@ -4,9 +4,9 @@ import { makeStyles } from '@material-ui/core';
4
4
  import { Alert, AlertTitle } from '@material-ui/lab';
5
5
  import React, { useEffect, useReducer } from 'react';
6
6
  import { Spinner } from '@postgres.ai/shared/components/Spinner';
7
- import { establishConnection } from '@postgres.ai/shared/pages/Logs/wsLogs';
7
+ import { establishConnection, restartConnection, } from '@postgres.ai/shared/pages/Logs/wsLogs';
8
8
  import { useWsScroll } from '@postgres.ai/shared/pages/Logs/hooks/useWsScroll';
9
- import { LAPTOP_WIDTH_PX } from '@postgres.ai/shared/pages/Logs/constants';
9
+ import { LAPTOP_WIDTH_PX } from './constants';
10
10
  import { PlusIcon } from './Icons/PlusIcon';
11
11
  const useStyles = makeStyles(() => ({
12
12
  spinnerContainer: {
@@ -20,10 +20,10 @@ const useStyles = makeStyles(() => ({
20
20
  display: 'flex',
21
21
  flexDirection: 'row',
22
22
  gap: 10,
23
+ flexWrap: 'wrap',
23
24
  '& > span': {
24
25
  display: 'flex',
25
26
  flexDirection: 'row',
26
- gap: '5px',
27
27
  alignItems: 'center',
28
28
  border: '1px solid #898E9A',
29
29
  padding: '3px 8px',
@@ -36,9 +36,13 @@ const useStyles = makeStyles(() => ({
36
36
  background: 'none',
37
37
  outline: 'none',
38
38
  border: 0,
39
- width: '18px',
40
- height: '18px',
39
+ width: '100%',
40
+ height: '100%',
41
+ display: 'flex',
42
+ alignItems: 'center',
41
43
  cursor: 'pointer',
44
+ paddingBottom: 0,
45
+ paddingRight: 0,
42
46
  },
43
47
  },
44
48
  // we need important since id has higher priority than class
@@ -69,6 +73,12 @@ const useStyles = makeStyles(() => ({
69
73
  transform: 'rotate(45deg) scale(0.75)',
70
74
  },
71
75
  },
76
+ buttonClassName: {
77
+ '& svg': {
78
+ width: '14px',
79
+ height: '14px',
80
+ },
81
+ },
72
82
  activeError: {
73
83
  border: '1px solid #F44336 !important',
74
84
  color: '#F44336 !important',
@@ -87,7 +97,7 @@ const useStyles = makeStyles(() => ({
87
97
  },
88
98
  },
89
99
  }), { index: 1 });
90
- export const Logs = ({ api }) => {
100
+ export const Logs = ({ api, instanceId }) => {
91
101
  const classes = useStyles();
92
102
  const [isLoading, setIsLoading] = React.useState(true);
93
103
  const targetNode = document.getElementById('logs-container');
@@ -101,27 +111,25 @@ export const Logs = ({ api }) => {
101
111
  }
102
112
  return true;
103
113
  };
104
- const initialState = {
105
- '[DEBUG]': !isEmpty(logsFilterState) ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[DEBUG]'] : true,
106
- '[INFO]': !isEmpty(logsFilterState) ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[INFO]'] : true,
107
- '[ERROR]': !isEmpty(logsFilterState) ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[ERROR]'] : true,
108
- '[base.go]': !isEmpty(logsFilterState)
109
- ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[base.go]']
110
- : true,
111
- '[runners.go]': !isEmpty(logsFilterState)
112
- ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[runners.go]']
113
- : true,
114
- '[snapshots.go]': !isEmpty(logsFilterState)
115
- ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[snapshots.go]']
116
- : true,
117
- '[util.go]': !isEmpty(logsFilterState)
118
- ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[util.go]']
119
- : true,
120
- '[logging.go]': !isEmpty(logsFilterState)
121
- ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[logging.go]']
122
- : false,
123
- '[ws.go]': !isEmpty(logsFilterState) ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[ws.go]'] : false,
124
- '[other]': !isEmpty(logsFilterState) ? logsFilterState === null || logsFilterState === void 0 ? void 0 : logsFilterState['[other]'] : true,
114
+ const initialState = (obj) => {
115
+ const filters = {
116
+ '[DEBUG]': true,
117
+ '[INFO]': true,
118
+ '[ERROR]': true,
119
+ '[base.go]': true,
120
+ '[runners.go]': true,
121
+ '[snapshots.go]': true,
122
+ '[util.go]': true,
123
+ '[logging.go]': false,
124
+ '[ws.go]': false,
125
+ '[other]': true,
126
+ };
127
+ for (const key in obj) {
128
+ if (obj.hasOwnProperty(key)) {
129
+ filters[key] = obj[key];
130
+ }
131
+ }
132
+ return filters;
125
133
  };
126
134
  const reducer = (state, action) => {
127
135
  switch (action.type) {
@@ -149,18 +157,21 @@ export const Logs = ({ api }) => {
149
157
  throw new Error();
150
158
  }
151
159
  };
152
- const [state, dispatch] = useReducer(reducer, initialState);
160
+ const [state, dispatch] = useReducer(reducer, initialState(logsFilterState));
153
161
  const FormCheckbox = ({ type }) => {
154
162
  const filterType = state[`[${type}]`];
155
- return (_jsxs("span", { onClick: () => dispatch({ type }), className: filterType && type !== 'ERROR'
163
+ return (_jsxs("span", { onClick: () => {
164
+ dispatch({ type });
165
+ restartConnection(api, instanceId);
166
+ }, className: filterType && type !== 'ERROR'
156
167
  ? classes.activeButton
157
168
  : filterType && type === 'ERROR'
158
169
  ? classes.activeError
159
- : classes.passiveButton, children: [_jsx("span", { children: type.toLowerCase() }), _jsx("button", { "aria-label": "close", type: "button", children: _jsx(PlusIcon, {}) })] }));
170
+ : classes.passiveButton, children: [_jsx("span", { children: type.toLowerCase() }), _jsx("button", { "aria-label": "close", type: "button", className: classes.buttonClassName, children: _jsx(PlusIcon, {}) })] }));
160
171
  };
161
172
  useEffect(() => {
162
173
  if (api.initWS != undefined) {
163
- establishConnection(api);
174
+ establishConnection(api, instanceId);
164
175
  }
165
176
  }, [api]);
166
177
  useEffect(() => {
@@ -1,2 +1,3 @@
1
- import { Api } from '@postgres.ai/shared/pages/Instance/stores/Main';
2
- export declare const establishConnection: (api: Api) => Promise<void>;
1
+ import { Api } from '../Instance/stores/Main';
2
+ export declare const establishConnection: (api: Api, instanceId: string) => Promise<void>;
3
+ export declare const restartConnection: (api: Api, instanceId: string) => void;