mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 09:35:38 -05:00
Set original database for connection done through connection dialog (#17266)
* check if database connection * Change name of isMaster and remove import * Set to false * take out connecttodatabase * remove connecttodatabase * Original database * remove empty string check * clean * set original database for when saving connection * pass unit test * map -> find * PR changes * Comments for original database
This commit is contained in:
@@ -472,6 +472,9 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
if (!tokenFillSuccess) {
|
||||
throw new Error(nls.localize('connection.noAzureAccount', "Failed to get Azure account token for connection"));
|
||||
}
|
||||
if (options.saveTheConnection) {
|
||||
connection.options.originalDatabase = connection.databaseName;
|
||||
}
|
||||
return this.createNewConnection(uri, connection).then(async connectionResult => {
|
||||
if (connectionResult && connectionResult.connected) {
|
||||
// The connected succeeded so add it to our active connections now, optionally adding it to the MRU based on
|
||||
@@ -629,27 +632,20 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
}
|
||||
|
||||
private focusDashboard(profile: interfaces.IConnectionProfile): boolean {
|
||||
let found: boolean = false;
|
||||
const matchingEditor = this._editorService.editors.find(editor => {
|
||||
return editor instanceof DashboardInput && DashboardInput.profileMatches(profile, editor.connectionProfile);
|
||||
}) as DashboardInput;
|
||||
|
||||
this._editorService.editors.map(editor => {
|
||||
if (editor instanceof DashboardInput) {
|
||||
if (DashboardInput.profileMatches(profile, editor.connectionProfile)) {
|
||||
editor.connectionProfile.connectionName = profile.connectionName;
|
||||
editor.connectionProfile.databaseName = profile.databaseName;
|
||||
this._editorService.openEditor(editor)
|
||||
.then(() => {
|
||||
if (!profile.databaseName || Utils.isMaster(profile)) {
|
||||
this._angularEventing.sendAngularEvent(editor.uri, AngularEventType.NAV_SERVER);
|
||||
} else {
|
||||
this._angularEventing.sendAngularEvent(editor.uri, AngularEventType.NAV_DATABASE);
|
||||
}
|
||||
found = true;
|
||||
}, errors.onUnexpectedError);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (matchingEditor) {
|
||||
matchingEditor.connectionProfile.connectionName = profile.connectionName;
|
||||
matchingEditor.connectionProfile.databaseName = profile.databaseName;
|
||||
this._editorService.openEditor(matchingEditor).then(() => {
|
||||
const target = !profile.databaseName || Utils.isServerConnection(profile) ? AngularEventType.NAV_SERVER : AngularEventType.NAV_DATABASE;
|
||||
this._angularEventing.sendAngularEvent(matchingEditor.uri, target);
|
||||
}, errors.onUnexpectedError);
|
||||
}
|
||||
|
||||
return found;
|
||||
return !!matchingEditor;
|
||||
}
|
||||
|
||||
public closeDashboard(uri: string): void {
|
||||
|
||||
Reference in New Issue
Block a user