mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 17:23:40 -05:00
Remove disposable from connection (#22687)
* Remove disposable from connection * Remove from group
This commit is contained in:
@@ -150,10 +150,9 @@ export class ConnectionController implements IConnectionComponentController {
|
||||
}
|
||||
allGroups.push(Object.assign({}, this._connectionWidget.DefaultServerGroup, { id: defaultGroupId }));
|
||||
allGroups.push(this._connectionWidget.NoneServerGroup);
|
||||
if (connectionGroupRoot && connectionGroupRoot.length > 0) {
|
||||
if (connectionGroupRoot?.length > 0) {
|
||||
this.flattenGroups(connectionGroupRoot[0], allGroups);
|
||||
}
|
||||
connectionGroupRoot.forEach(cpg => cpg.dispose());
|
||||
return allGroups;
|
||||
}
|
||||
|
||||
|
||||
@@ -346,11 +346,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
}
|
||||
}
|
||||
this._model.providerName = this._currentProviderType;
|
||||
const previousModel = this._model;
|
||||
this._model = new ConnectionProfile(this._capabilitiesService, this._model);
|
||||
if (previousModel) {
|
||||
previousModel.dispose();
|
||||
}
|
||||
if (this._inputModel && this._inputModel.options) {
|
||||
this.uiController.showUiComponent(input.container,
|
||||
this._inputModel.options.authTypeChanged);
|
||||
@@ -367,10 +363,6 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
private async handleFillInConnectionInputs(connectionInfo: IConnectionProfile): Promise<void> {
|
||||
try {
|
||||
const connectionWithPassword = await this.createModel(connectionInfo);
|
||||
|
||||
if (this._model) {
|
||||
this._model.dispose();
|
||||
}
|
||||
this._model = connectionWithPassword;
|
||||
this.uiController.fillInConnectionInputs(this._model);
|
||||
}
|
||||
@@ -390,9 +382,6 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
}
|
||||
|
||||
private async updateModelServerCapabilities(model: IConnectionProfile) {
|
||||
if (this._model) {
|
||||
this._model.dispose();
|
||||
}
|
||||
this._model = await this.createModel(model);
|
||||
if (this._model.providerName) {
|
||||
this._currentProviderType = this._model.providerName;
|
||||
@@ -504,9 +493,6 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
this._connectionDialog.onFillinConnectionInputs((input) => this.handleFillInConnectionInputs(input as IConnectionProfile));
|
||||
this._connectionDialog.onResetConnection(() => this.handleProviderOnResetConnection());
|
||||
this._connectionDialog.render();
|
||||
this._connectionDialog.onClosed(() => {
|
||||
this._model?.dispose();
|
||||
});
|
||||
}
|
||||
this._connectionDialog.newConnectionParams = params;
|
||||
this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[this._currentProviderType]);
|
||||
@@ -514,7 +500,6 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
const recentConnections: ConnectionProfile[] = this._connectionManagementService.getRecentConnections(params.providers);
|
||||
await this._connectionDialog.open(recentConnections.length > 0);
|
||||
this.uiController.focusOnOpen();
|
||||
recentConnections.forEach(conn => conn.dispose());
|
||||
}
|
||||
|
||||
private showErrorDialog(severity: Severity, headerTitle: string, message: string, messageDetails?: string): void {
|
||||
|
||||
@@ -356,14 +356,10 @@ export class ConnectionDialogWidget extends Modal {
|
||||
actionProvider.onRecentConnectionRemoved(() => {
|
||||
const recentConnections: ConnectionProfile[] = this.connectionManagementService.getRecentConnections();
|
||||
this.open(recentConnections.length > 0).catch(err => this.logService.error(`Unexpected error opening connection widget after a recent connection was removed from action provider: ${err}`));
|
||||
// We're just using the connections to determine if there are connections to show, dispose them right after to clean up their handlers
|
||||
recentConnections.forEach(conn => conn.dispose());
|
||||
});
|
||||
controller.onRecentConnectionRemoved(() => {
|
||||
const recentConnections: ConnectionProfile[] = this.connectionManagementService.getRecentConnections();
|
||||
this.open(recentConnections.length > 0).catch(err => this.logService.error(`Unexpected error opening connection widget after a recent connection was removed from controller : ${err}`));
|
||||
// We're just using the connections to determine if there are connections to show, dispose them right after to clean up their handlers
|
||||
recentConnections.forEach(conn => conn.dispose());
|
||||
});
|
||||
this._recentConnectionTree = TreeCreationUtils.createConnectionTree(treeContainer, this.instantiationService, this._configurationService, localize('connectionDialog.recentConnections', "Recent Connections"), controller);
|
||||
if (this._recentConnectionTree instanceof AsyncServerTree) {
|
||||
|
||||
@@ -858,9 +858,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
|
||||
public hasRegisteredServers(): boolean {
|
||||
const groups: ConnectionProfileGroup[] = this.getConnectionGroups();
|
||||
const hasRegisteredServers: boolean = this.doHasRegisteredServers(groups);
|
||||
groups.forEach(cpg => cpg.dispose());
|
||||
return hasRegisteredServers;
|
||||
return this.doHasRegisteredServers(groups);
|
||||
}
|
||||
|
||||
private doHasRegisteredServers(root: ConnectionProfileGroup[]): boolean {
|
||||
|
||||
Reference in New Issue
Block a user