mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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;
|
onConnectReject(error?: string): void;
|
||||||
onConnectSuccess(params?: INewConnectionParams): void;
|
onConnectSuccess(params?: INewConnectionParams): void;
|
||||||
onDisconnect(): void;
|
onDisconnect(): void;
|
||||||
|
onConnectCanceled(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SERVICE_ID = 'connectionManagementService';
|
export const SERVICE_ID = 'connectionManagementService';
|
||||||
@@ -336,6 +337,7 @@ export interface IConnectableInput {
|
|||||||
onConnectReject(error?: string): void;
|
onConnectReject(error?: string): void;
|
||||||
onConnectSuccess(params?: INewConnectionParams): void;
|
onConnectSuccess(params?: INewConnectionParams): void;
|
||||||
onDisconnect(): void;
|
onDisconnect(): void;
|
||||||
|
onConnectCanceled(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ConnectionType {
|
export enum ConnectionType {
|
||||||
|
|||||||
@@ -366,6 +366,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
onConnectStart: callbacks ? callbacks.onConnectStart : undefined,
|
onConnectStart: callbacks ? callbacks.onConnectStart : undefined,
|
||||||
onConnectSuccess: callbacks ? callbacks.onConnectSuccess : undefined,
|
onConnectSuccess: callbacks ? callbacks.onConnectSuccess : undefined,
|
||||||
onDisconnect: callbacks ? callbacks.onDisconnect : undefined,
|
onDisconnect: callbacks ? callbacks.onDisconnect : undefined,
|
||||||
|
onConnectCanceled: callbacks ? callbacks.onConnectCanceled : undefined,
|
||||||
uri: uri
|
uri: uri
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -438,7 +439,8 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
onConnectReject: () => { },
|
onConnectReject: () => { },
|
||||||
onConnectStart: () => { },
|
onConnectStart: () => { },
|
||||||
onConnectSuccess: () => { },
|
onConnectSuccess: () => { },
|
||||||
onDisconnect: () => { }
|
onDisconnect: () => { },
|
||||||
|
onConnectCanceled: () => { }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (!options) {
|
if (!options) {
|
||||||
|
|||||||
@@ -153,6 +153,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
|||||||
} else {
|
} else {
|
||||||
this._connectionManagementService.cancelConnection(this._model);
|
this._connectionManagementService.cancelConnection(this._model);
|
||||||
}
|
}
|
||||||
|
if (params && params.input && params.input.onConnectCanceled) {
|
||||||
|
params.input.onConnectCanceled();
|
||||||
|
}
|
||||||
this._connectionDialog.resetConnection();
|
this._connectionDialog.resetConnection();
|
||||||
this._connecting = false;
|
this._connecting = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,6 +175,9 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onConnectCanceled(): void {
|
||||||
|
}
|
||||||
|
|
||||||
public onConnectSuccess(params?: INewConnectionParams): void {
|
public onConnectSuccess(params?: INewConnectionParams): void {
|
||||||
let rowLimit: number = undefined;
|
let rowLimit: number = undefined;
|
||||||
let queryString: string = undefined;
|
let queryString: string = undefined;
|
||||||
|
|||||||
@@ -130,14 +130,16 @@ export class TreeUpdateUtils {
|
|||||||
if (tree) {
|
if (tree) {
|
||||||
// Show the spinner in OE by adding the 'loading' trait to the connection, and set up callbacks to hide the spinner
|
// 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]);
|
tree.addTraits('loading', [connection]);
|
||||||
|
let rejectOrCancelCallback = () => {
|
||||||
|
tree.collapse(connection);
|
||||||
|
tree.removeTraits('loading', [connection]);
|
||||||
|
};
|
||||||
callbacks = {
|
callbacks = {
|
||||||
onConnectStart: undefined,
|
onConnectStart: undefined,
|
||||||
onConnectReject: () => {
|
onConnectReject: rejectOrCancelCallback,
|
||||||
tree.collapse(connection);
|
|
||||||
tree.removeTraits('loading', [connection]);
|
|
||||||
},
|
|
||||||
onConnectSuccess: () => tree.removeTraits('loading', [connection]),
|
onConnectSuccess: () => tree.removeTraits('loading', [connection]),
|
||||||
onDisconnect: undefined
|
onDisconnect: undefined,
|
||||||
|
onConnectCanceled: rejectOrCancelCallback,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
connectionManagementService.connect(connection, undefined, options, callbacks).then(result => {
|
connectionManagementService.connect(connection, undefined, options, callbacks).then(result => {
|
||||||
|
|||||||
@@ -225,6 +225,9 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
|
|||||||
this._updateTaskbar.fire();
|
this._updateTaskbar.fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onConnectCanceled(): void {
|
||||||
|
}
|
||||||
|
|
||||||
public onConnectSuccess(params?: INewConnectionParams): void {
|
public onConnectSuccess(params?: INewConnectionParams): void {
|
||||||
this._runQueryEnabled = true;
|
this._runQueryEnabled = true;
|
||||||
this._connectEnabled = false;
|
this._connectEnabled = false;
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ suite('ConnectionDialogService tests', () => {
|
|||||||
onConnectStart: undefined,
|
onConnectStart: undefined,
|
||||||
onConnectSuccess: undefined,
|
onConnectSuccess: undefined,
|
||||||
onConnectReject: undefined,
|
onConnectReject: undefined,
|
||||||
onDisconnect: undefined
|
onDisconnect: undefined,
|
||||||
|
onConnectCanceled: undefined
|
||||||
},
|
},
|
||||||
runQueryOnCompletion: undefined,
|
runQueryOnCompletion: undefined,
|
||||||
querySelection: undefined
|
querySelection: undefined
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
|||||||
onConnectStart: undefined,
|
onConnectStart: undefined,
|
||||||
onDisconnect: undefined,
|
onDisconnect: undefined,
|
||||||
onConnectSuccess: undefined,
|
onConnectSuccess: undefined,
|
||||||
|
onConnectCanceled: undefined,
|
||||||
uri: 'Editor Uri'
|
uri: 'Editor Uri'
|
||||||
},
|
},
|
||||||
runQueryOnCompletion: RunQueryOnConnectionMode.executeQuery
|
runQueryOnCompletion: RunQueryOnConnectionMode.executeQuery
|
||||||
@@ -279,6 +280,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
|||||||
onConnectStart: undefined,
|
onConnectStart: undefined,
|
||||||
onDisconnect: undefined,
|
onDisconnect: undefined,
|
||||||
onConnectSuccess: undefined,
|
onConnectSuccess: undefined,
|
||||||
|
onConnectCanceled: undefined,
|
||||||
uri: 'Editor Uri'
|
uri: 'Editor Uri'
|
||||||
},
|
},
|
||||||
runQueryOnCompletion: RunQueryOnConnectionMode.executeQuery
|
runQueryOnCompletion: RunQueryOnConnectionMode.executeQuery
|
||||||
@@ -348,6 +350,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
|||||||
onConnectReject: undefined,
|
onConnectReject: undefined,
|
||||||
onConnectStart: undefined,
|
onConnectStart: undefined,
|
||||||
onDisconnect: undefined,
|
onDisconnect: undefined,
|
||||||
|
onConnectCanceled: undefined,
|
||||||
uri: uri
|
uri: uri
|
||||||
},
|
},
|
||||||
querySelection: undefined,
|
querySelection: undefined,
|
||||||
@@ -661,6 +664,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
|||||||
onConnectReject: undefined,
|
onConnectReject: undefined,
|
||||||
onConnectStart: undefined,
|
onConnectStart: undefined,
|
||||||
onDisconnect: undefined,
|
onDisconnect: undefined,
|
||||||
|
onConnectCanceled: undefined,
|
||||||
uri: uri
|
uri: uri
|
||||||
},
|
},
|
||||||
querySelection: undefined,
|
querySelection: undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user