@postgres.ai/shared 4.0.0-pr-695.13 → 4.0.0-pr-1042.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postgres.ai/shared",
3
- "version": "4.0.0-pr-695.13",
3
+ "version": "4.0.0-pr-1042.1",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "peerDependencies": {
@@ -56,7 +56,7 @@ export const Instance = observer((props) => {
56
56
  const [activeTab, setActiveTab] = React.useState((props === null || props === void 0 ? void 0 : props.renderCurrentTab) || TABS_INDEX.OVERVIEW);
57
57
  const [hasBeenRedirected, setHasBeenRedirected] = React.useState(false);
58
58
  const stores = useCreatedStores(props);
59
- const { instance, instanceError, instanceRetrieval, isLoadingInstance, load, } = stores.main;
59
+ const { instance, instanceError, instanceRetrieval, isLoadingInstance, isLoadingInstanceRetrieval, load, } = stores.main;
60
60
  const switchTab = (_, tabID) => {
61
61
  const contentElement = document.getElementById('content-container');
62
62
  setActiveTab(tabID);
@@ -66,7 +66,7 @@ export const Instance = observer((props) => {
66
66
  contentElement === null || contentElement === void 0 ? void 0 : contentElement.scrollTo(0, 0);
67
67
  };
68
68
  const isInstanceIntegrated = instanceRetrieval ||
69
- (!isLoadingInstance && instance && (instance === null || instance === void 0 ? void 0 : instance.url) && !instanceError);
69
+ (!isLoadingInstance && !isLoadingInstanceRetrieval && instance && (instance === null || instance === void 0 ? void 0 : instance.url) && !instanceError);
70
70
  const isConfigurationActive = (instanceRetrieval === null || instanceRetrieval === void 0 ? void 0 : instanceRetrieval.mode) !== 'physical';
71
71
  useEffect(() => {
72
72
  load(instanceId, isPlatform);
@@ -86,7 +86,7 @@ export const Instance = observer((props) => {
86
86
  }
87
87
  }, [instance, hasBeenRedirected]);
88
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, hideInstanceTabs: props.hideBranchingFeatures })) }), 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, { hideBranchingFeatures: props.hideBranchingFeatures })] })) : (_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
+ (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 && !isLoadingInstanceRetrieval && !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, {}) }) })))] }) }));
90
90
  });
91
91
  function TabPanel(props) {
92
92
  const { children, value, index, ...other } = props;
@@ -72,6 +72,7 @@ export declare class MainStore {
72
72
  isBranchesLoading: boolean;
73
73
  isConfigLoading: boolean;
74
74
  isLoadingInstance: boolean;
75
+ isLoadingInstanceRetrieval: boolean;
75
76
  private readonly api;
76
77
  constructor(api: Api);
77
78
  get isDisabledInstance(): boolean;
@@ -27,9 +27,17 @@ export class MainStore {
27
27
  this.isBranchesLoading = false;
28
28
  this.isConfigLoading = false;
29
29
  this.isLoadingInstance = false;
30
+ this.isLoadingInstanceRetrieval = false;
30
31
  this.load = (instanceId, isPlatform = false) => {
31
32
  this.instance = null;
33
+ this.instanceRetrieval = null;
32
34
  this.isReloadingInstance = true;
35
+ if (this.api.getInstanceRetrieval) {
36
+ this.isLoadingInstanceRetrieval = true;
37
+ }
38
+ else {
39
+ this.isLoadingInstanceRetrieval = false;
40
+ }
33
41
  if (!isPlatform) {
34
42
  this.getBranches(instanceId);
35
43
  }
@@ -58,7 +66,14 @@ export class MainStore {
58
66
  };
59
67
  this.reload = (instanceId) => {
60
68
  this.instance = null;
69
+ this.instanceRetrieval = null;
61
70
  this.isReloadingInstance = true;
71
+ if (this.api.getInstanceRetrieval) {
72
+ this.isLoadingInstanceRetrieval = true;
73
+ }
74
+ else {
75
+ this.isLoadingInstanceRetrieval = false;
76
+ }
62
77
  this.loadInstance(instanceId, false).then(() => {
63
78
  var _a, _b, _c;
64
79
  if (this.api.refreshInstance)
@@ -88,11 +103,15 @@ export class MainStore {
88
103
  this.isReloadingInstanceRetrieval = false;
89
104
  };
90
105
  this.loadInstanceRetrieval = async (instanceId) => {
91
- if (!this.api.getInstanceRetrieval)
106
+ if (!this.api.getInstanceRetrieval) {
107
+ this.isLoadingInstanceRetrieval = false;
92
108
  return;
109
+ }
110
+ this.isLoadingInstanceRetrieval = true;
93
111
  const { response, error } = await this.api.getInstanceRetrieval({
94
112
  instanceId: instanceId,
95
113
  });
114
+ this.isLoadingInstanceRetrieval = false;
96
115
  if (response)
97
116
  this.instanceRetrieval = response;
98
117
  if (error)