mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-05 01:25:38 -05:00
Stop OE connection spinner when user closes connection dialog (#2777)
This commit is contained in:
@@ -67,6 +67,7 @@ export interface IConnectionCallbacks {
|
||||
onConnectReject(error?: string): void;
|
||||
onConnectSuccess(params?: INewConnectionParams): void;
|
||||
onDisconnect(): void;
|
||||
onConnectCanceled(): void;
|
||||
}
|
||||
|
||||
export const SERVICE_ID = 'connectionManagementService';
|
||||
@@ -336,6 +337,7 @@ export interface IConnectableInput {
|
||||
onConnectReject(error?: string): void;
|
||||
onConnectSuccess(params?: INewConnectionParams): void;
|
||||
onDisconnect(): void;
|
||||
onConnectCanceled(): void;
|
||||
}
|
||||
|
||||
export enum ConnectionType {
|
||||
|
||||
@@ -366,6 +366,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
onConnectStart: callbacks ? callbacks.onConnectStart : undefined,
|
||||
onConnectSuccess: callbacks ? callbacks.onConnectSuccess : undefined,
|
||||
onDisconnect: callbacks ? callbacks.onDisconnect : undefined,
|
||||
onConnectCanceled: callbacks ? callbacks.onConnectCanceled : undefined,
|
||||
uri: uri
|
||||
};
|
||||
}
|
||||
@@ -438,7 +439,8 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
onConnectReject: () => { },
|
||||
onConnectStart: () => { },
|
||||
onConnectSuccess: () => { },
|
||||
onDisconnect: () => { }
|
||||
onDisconnect: () => { },
|
||||
onConnectCanceled: () => { }
|
||||
};
|
||||
}
|
||||
if (!options) {
|
||||
|
||||
@@ -153,6 +153,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
} else {
|
||||
this._connectionManagementService.cancelConnection(this._model);
|
||||
}
|
||||
if (params && params.input && params.input.onConnectCanceled) {
|
||||
params.input.onConnectCanceled();
|
||||
}
|
||||
this._connectionDialog.resetConnection();
|
||||
this._connecting = false;
|
||||
}
|
||||
|
||||
@@ -175,6 +175,9 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
||||
}
|
||||
}
|
||||
|
||||
public onConnectCanceled(): void {
|
||||
}
|
||||
|
||||
public onConnectSuccess(params?: INewConnectionParams): void {
|
||||
let rowLimit: number = undefined;
|
||||
let queryString: string = undefined;
|
||||
|
||||
@@ -130,14 +130,16 @@ export class TreeUpdateUtils {
|
||||
if (tree) {
|
||||
// Show the spinner in OE by adding the 'loading' trait to the connection, and set up callbacks to hide the spinner
|
||||
tree.addTraits('loading', [connection]);
|
||||
let rejectOrCancelCallback = () => {
|
||||
tree.collapse(connection);
|
||||
tree.removeTraits('loading', [connection]);
|
||||
};
|
||||
callbacks = {
|
||||
onConnectStart: undefined,
|
||||
onConnectReject: () => {
|
||||
tree.collapse(connection);
|
||||
tree.removeTraits('loading', [connection]);
|
||||
},
|
||||
onConnectReject: rejectOrCancelCallback,
|
||||
onConnectSuccess: () => tree.removeTraits('loading', [connection]),
|
||||
onDisconnect: undefined
|
||||
onDisconnect: undefined,
|
||||
onConnectCanceled: rejectOrCancelCallback,
|
||||
};
|
||||
}
|
||||
connectionManagementService.connect(connection, undefined, options, callbacks).then(result => {
|
||||
|
||||
@@ -225,6 +225,9 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
|
||||
this._updateTaskbar.fire();
|
||||
}
|
||||
|
||||
public onConnectCanceled(): void {
|
||||
}
|
||||
|
||||
public onConnectSuccess(params?: INewConnectionParams): void {
|
||||
this._runQueryEnabled = true;
|
||||
this._connectEnabled = false;
|
||||
|
||||
Reference in New Issue
Block a user