Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

СB-5796 Metadata/data editor - error when changing server settings #3051

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we should implement some general solution for checking whether resource entity is fully available or not. Not now, but maybe in a tech sprint


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
Loading