Skip to content

Commit

Permalink
СB-5796 Metadata/data editor - error when changing server settings (#…
Browse files Browse the repository at this point in the history
…3051)

* СB-5796 make no connection to db if it is already connected

* Revert "СB-5796 make no connection to db if it is already connected"

This reverts commit 4459891.

* CB-5796 adds extra checks to connection shield for proper connection

* CB-5796 fixes for case with table

* CB-5796 adds loader between switching from simple to advanced connection type

---------

Co-authored-by: Daria Marutkina <[email protected]>
Co-authored-by: alex <[email protected]>
Co-authored-by: Evgenia <[email protected]>
  • Loading branch information
4 people authored Nov 20, 2024
1 parent 58346ae commit 4323578
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions webapp/packages/plugin-connections/src/ConnectionShield.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ export const ConnectionShield = observer<PropsWithChildren<IConnectionShieldProp
const notificationService = useService(NotificationService);

const connection = useResource(ConnectionShield, ConnectionInfoResource, connectionKey);
const connecting = getComputed(() => connectionKey && connection.resource.isConnecting(connectionKey));
const connecting = getComputed(() => (connectionKey && connection.resource.isConnecting(connectionKey)) || connection.loading);
const isConnectionReady = getComputed(() => !connecting && connection.data?.connected && connection.loaded && !connection.outdated);

async function handleConnect() {
if (connecting || !connection.data || !connectionKey) {
if (isConnectionReady || !connection.data || !connectionKey) {
return;
}

Expand All @@ -37,11 +38,11 @@ export const ConnectionShield = observer<PropsWithChildren<IConnectionShieldProp
}
}

if (getComputed(() => connection.data && !connection.data.connected)) {
if (connecting) {
return <Loader message="ui_processing_connecting" />;
}
if (connecting) {
return <Loader message="ui_processing_connecting" />;
}

if (!isConnectionReady) {
return (
<TextPlaceholder>
<Button type="button" mod={['unelevated']} onClick={handleConnect}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ObjectViewerPanel: TabHandlerPanelComponent<IObjectViewerTabState>
tab.handlerState.tabTitle = data.name;
});
},
active: getComputed(() => !!connection.tryGetData?.connected),
active: getComputed(() => !!connection.tryGetData?.connected && !connection.outdated),
});

const pages = dbObjectPagesService.orderedPages;
Expand Down

0 comments on commit 4323578

Please sign in to comment.