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

Remove/comment out connection title generation from all areas. #23873

Merged
merged 8 commits into from
Jul 18, 2023
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
2 changes: 1 addition & 1 deletion extensions/mssql/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "4.9.0.3",
"version": "4.9.0.5",
"downloadFileNames": {
"Windows_86": "win-x86-net7.0.zip",
"Windows_64": "win-x64-net7.0.zip",
Expand Down
18 changes: 2 additions & 16 deletions extensions/mssql/src/tableDesigner/tableDesigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,11 @@ export function registerTableDesignerCommands(appContext: AppContext) {
if (!connectionString) {
throw new Error(FailedToGetConnectionStringError);
}
let titleString = `${context.connectionProfile!.serverName} - ${context.connectionProfile!.databaseName} - ${NewTableText}`;
// append distinguishing options to end to let users know exact connection.
let distinguishingOptions = await azdata.connection.getEditorConnectionProfileTitle(context.connectionProfile, true);
if (distinguishingOptions !== '') {
distinguishingOptions = distinguishingOptions.replace('(', '[').replace(')', ']');
titleString += `${distinguishingOptions}`;
}
const tableIcon = context.nodeInfo!.nodeSubType as azdata.designers.TableIcon;
const telemetryInfo = await getTelemetryInfo(context, tableIcon);
await azdata.designers.openTableDesigner(sqlProviderName, {
title: NewTableText,
tooltip: titleString,
tooltip: `${context.connectionProfile!.serverName} - ${context.connectionProfile!.databaseName} - ${NewTableText}`,
server: context.connectionProfile!.serverName,
database: context.connectionProfile!.databaseName,
isNewTable: true,
Expand All @@ -63,18 +56,11 @@ export function registerTableDesignerCommands(appContext: AppContext) {
if (!connectionString) {
throw new Error(FailedToGetConnectionStringError);
}
let titleString = `${server} - ${database} - ${schema}.${name}`;
// append distinguishing options to end to let users know exact connection.
let distinguishingOptions = await azdata.connection.getEditorConnectionProfileTitle(context.connectionProfile, true);
if (distinguishingOptions !== '') {
distinguishingOptions = distinguishingOptions.replace('(', '[').replace(')', ']');
titleString += `${distinguishingOptions}`;
}
const tableIcon = context.nodeInfo!.nodeSubType as azdata.designers.TableIcon;
const telemetryInfo = await getTelemetryInfo(context, tableIcon);
await azdata.designers.openTableDesigner(sqlProviderName, {
title: `${schema}.${name}`,
tooltip: titleString,
tooltip: `${server} - ${database} - ${schema}.${name}`,
server: server,
database: database,
isNewTable: false,
Expand Down
9 changes: 0 additions & 9 deletions src/sql/azdata.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,6 @@ declare module 'azdata' {
* @returns The new password that is returned from the operation or undefined if unsuccessful.
*/
export function openChangePasswordDialog(profile: IConnectionProfile): Thenable<string | undefined>;

/**
* Gets the formatted title of the connection profile for display
* @param profile The connection profile we want to get the full display info for.
* @param getOptionsOnly Provide if you only want to get the differing advanced options (for some titles).
* @param includeGroupName Provide if you want to include the groupName as well (in areas that do not display the groupName).
* @returns The title formatted with server info in front, with non default options at the end.
*/
export function getEditorConnectionProfileTitle(profile: IConnectionProfile, getOptionsOnly?: boolean, includeGroupName?: boolean): Thenable<string>;
}

/*
Expand Down
9 changes: 0 additions & 9 deletions src/sql/platform/connection/common/connectionManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,6 @@ export interface IConnectionManagementService {
* @returns the new valid password that is entered, or undefined if cancelled or errored.
*/
openChangePasswordDialog(profile: IConnectionProfile): Promise<string | undefined>;

/**
* Gets the formatted title of the connection profile for display.
* @param profile The connection profile we want to get the full display info for.
* @param getOptionsOnly Provide if you only want to get the differing advanced options (for some titles).
* @param includeGroupName Provide if you want to include the groupName as well (in areas that do not display the groupName).
* @returns The title formatted with server info in front, with non default options at the end.
*/
getEditorConnectionProfileTitle(profile: IConnectionProfile, getOptionsOnly?: boolean, includeGroupName?: boolean): string;
}

export enum RunQueryOnConnectionMode {
Expand Down
6 changes: 0 additions & 6 deletions src/sql/platform/connection/common/connectionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,6 @@ export class ConnectionStore {
return this.convertToConnectionGroup(groups, profilesInConfiguration);
}

public getAllConnectionsFromConfig(): ConnectionProfile[] {
let profilesInConfiguration: ConnectionProfile[] | undefined;
profilesInConfiguration = this.connectionConfig.getConnections(true);
return profilesInConfiguration;
}

private convertToConnectionGroup(groups: IConnectionProfileGroup[], connections?: ConnectionProfile[], parent?: ConnectionProfileGroup): ConnectionProfileGroup[] {
const result: ConnectionProfileGroup[] = [];
const children = groups.filter(g => g.parentId === (parent ? parent.id : undefined));
Expand Down
4 changes: 2 additions & 2 deletions src/sql/platform/connection/common/providerConnectionInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class ProviderConnectionInfo implements azdata.ConnectionInfo {
this.options[name] = value;
}

public getServerInfo() {
private getServerInfo() {
let title = '';
if (this.serverCapabilities) {
title = this.serverName;
Expand Down Expand Up @@ -169,7 +169,7 @@ export class ProviderConnectionInfo implements azdata.ConnectionInfo {
return label;
}

public hasLoaded(): boolean {
private hasLoaded(): boolean {
return Object.keys(this.capabilitiesService.providers).length > 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,6 @@ export class TestConnectionManagementService implements IConnectionManagementSer
return undefined;
}

getEditorConnectionProfileTitle(profile: IConnectionProfile, getOptionsOnly?: boolean, includeGroupName?: boolean): string {
return undefined!;
}

openCustomErrorDialog(options: azdata.window.IErrorDialogOptions): Promise<string | undefined> {
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
return this._connectionManagementService.openChangePasswordDialog(convertedProfile);
}

public $getEditorConnectionProfileTitle(profile: IConnectionProfile, getOptionsOnly?: boolean, includeGroupName?: boolean): Thenable<string | undefined> {
return Promise.resolve(this._connectionManagementService.getEditorConnectionProfileTitle(profile, getOptionsOnly, includeGroupName));
}

public async $listDatabases(connectionId: string): Promise<string[]> {
let connectionUri = await this.$getUriForConnection(connectionId);
let result = await this._connectionManagementService.listDatabases(connectionUri);
Expand Down
4 changes: 0 additions & 4 deletions src/sql/workbench/api/common/extHostConnectionManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
return this._proxy.$openChangePasswordDialog(profile);
}

public $getEditorConnectionProfileTitle(profile: azdata.IConnectionProfile, getOptionsOnly?: boolean, includeGroupName?: boolean): Thenable<string> {
return this._proxy.$getEditorConnectionProfileTitle(profile, getOptionsOnly, includeGroupName);
}

public $listDatabases(connectionId: string): Thenable<string[]> {
return this._proxy.$listDatabases(connectionId);
}
Expand Down
3 changes: 0 additions & 3 deletions src/sql/workbench/api/common/sqlExtHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
openChangePasswordDialog(profile: azdata.IConnectionProfile): Thenable<string | undefined> {
return extHostConnectionManagement.$openChangePasswordDialog(profile);
},
getEditorConnectionProfileTitle(profile: azdata.IConnectionProfile, getOptionsOnly?: boolean, includeGroupName?: boolean): Thenable<string> {
return extHostConnectionManagement.$getEditorConnectionProfileTitle(profile, getOptionsOnly, includeGroupName);
},
listDatabases(connectionId: string): Thenable<string[]> {
return extHostConnectionManagement.$listDatabases(connectionId);
},
Expand Down
1 change: 0 additions & 1 deletion src/sql/workbench/api/common/sqlExtHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
$getServerInfo(connectedId: string): Thenable<azdata.ServerInfo>;
$openConnectionDialog(providers: string[], initialConnectionProfile?: azdata.IConnectionProfile, connectionCompletionOptions?: azdata.IConnectionCompletionOptions): Thenable<azdata.connection.Connection>;
$openChangePasswordDialog(profile: azdata.IConnectionProfile): Thenable<string | undefined>;
$getEditorConnectionProfileTitle(profile: azdata.IConnectionProfile, getOptionsOnly?: boolean, includeGroupName?: boolean): Thenable<string>;
$listDatabases(connectionId: string): Thenable<string[]>;
$getConnectionString(connectionId: string, includePassword: boolean): Thenable<string>;
$getUriForConnection(connectionId: string): Thenable<string>;
Expand Down
5 changes: 1 addition & 4 deletions src/sql/workbench/browser/editor/profiler/dashboardInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,11 @@ export class DashboardInput extends EditorInput {
}

let name = this.connectionProfile.connectionName ? this.connectionProfile.connectionName : this.connectionProfile.serverName

if (!this.connectionProfile.connectionName && this.connectionProfile.databaseName
if (this.connectionProfile.databaseName
&& !this.isMasterMssql()) {
// Only add DB name if this is a non-default, non-master connection
name = name + ':' + this.connectionProfile.databaseName;
}
// Append any differing options if needed.
name += this._connectionService.getEditorConnectionProfileTitle(this.connectionProfile, true, true)
return name;
}

Expand Down
14 changes: 4 additions & 10 deletions src/sql/workbench/common/editor/query/queryEditorInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,11 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab
title = this._description + ' ';
}
if (profile) {
let distinguishedTitle = this.connectionManagementService.getEditorConnectionProfileTitle(profile);
if (distinguishedTitle !== '') {
title += distinguishedTitle;
}
else {
title += `${profile.serverName}`;
if (profile.databaseName) {
title += `.${profile.databaseName}`;
}
title += ` (${profile.userName || profile.authenticationType})`;
title += `${profile.serverName}`;
if (profile.databaseName) {
title += `.${profile.databaseName}`;
}
title += ` (${profile.userName || profile.authenticationType})`;
} else {
title += localize('disconnected', "disconnected");
}
Expand Down
32 changes: 11 additions & 21 deletions src/sql/workbench/contrib/connection/browser/connectionStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,20 @@ export class ConnectionStatusbarItem extends Disposable implements IWorkbenchCon

// Set connection info to connection status bar
private _setConnectionText(connectionProfile: IConnectionProfile): void {
let distinguishedTitle = this.connectionManagementService.getEditorConnectionProfileTitle(connectionProfile);
let text: string = '';
let tooltip: string = '';
if (distinguishedTitle === '') {
text = connectionProfile.serverName;
if (text) {
if (connectionProfile.databaseName && connectionProfile.databaseName !== '') {
text = text + ' : ' + connectionProfile.databaseName;
} else {
text = text + ' : ' + '<default>';
}
let text: string = connectionProfile.serverName;
if (text) {
if (connectionProfile.databaseName && connectionProfile.databaseName !== '') {
text = text + ' : ' + connectionProfile.databaseName;
} else {
text = text + ' : ' + '<default>';
}
}

let tooltip = 'Server: ' + connectionProfile.serverName + '\r\n' +
'Database: ' + (connectionProfile.databaseName ? connectionProfile.databaseName : '<default>') + '\r\n';

tooltip = 'Server: ' + connectionProfile.serverName + '\r\n' +
'Database: ' + (connectionProfile.databaseName ? connectionProfile.databaseName : '<default>') + '\r\n';

if (connectionProfile.userName && connectionProfile.userName !== '') {
tooltip = tooltip + 'Login: ' + connectionProfile.userName + '\r\n';
}
}
else {
text = distinguishedTitle;
tooltip = (connectionProfile as any).serverInfo;
if (connectionProfile.userName && connectionProfile.userName !== '') {
tooltip = tooltip + 'Login: ' + connectionProfile.userName + '\r\n';
}

this.statusItem.update({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ export class BreadcrumbService implements IBreadcrumbService {
}

private getServerBreadcrumb(profile: ConnectionProfile): MenuItem {
let formattedProfileName = profile.connectionName ? profile.connectionName : profile.serverName;
formattedProfileName += this.commonService.connectionManagementService.getEditorConnectionProfileTitle(profile, true, true);
return { label: formattedProfileName, routerLink: ['server-dashboard'] };
return profile.connectionName ? { label: profile.connectionName, routerLink: ['server-dashboard'] } : { label: profile.serverName, routerLink: ['server-dashboard'] };
}

private getDbBreadcrumb(profile: ConnectionProfile): MenuItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,10 +756,7 @@ export class AttachToDropdown extends SelectBox {
} else {
let connections: string[] = [];
if (model.context && model.context.title && (connProviderIds.includes(this.model.context.providerName))) {
let textResult = model.context.title;
let fullTitleText = this._connectionManagementService.getEditorConnectionProfileTitle(model.context);
textResult = fullTitleText.length !== 0 ? fullTitleText : textResult;
connections.push(textResult);
connections.push(model.context.title);
} else if (this._configurationService.getValue(saveConnectionNameConfigName) && model.savedConnectionName) {
connections.push(model.savedConnectionName);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
// get the full ConnectionProfiles with the server info updated properly
const treeInput = TreeUpdateUtils.getTreeInput(this._connectionManagementService)!;
await this._tree.setInput(treeInput);
await this.refreshConnectionTreeTitles();
this._treeSelectionHandler.onTreeActionStateChange(false);
} else {
if (this._connectionManagementService.hasRegisteredServers()) {
Expand Down Expand Up @@ -273,7 +272,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
if (connectionParentGroup) {
connectionParentGroup.addOrReplaceConnection(newConnection);
await this._tree.updateChildren(connectionParentGroup);
await this.refreshConnectionTreeTitles();
await this._tree.revealSelectFocusElement(newConnection);
await this._tree.expand(newConnection);
}
Expand All @@ -288,7 +286,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
await this._tree.rerender(connectionInTree);
await this._tree.revealSelectFocusElement(connectionInTree);
await this._tree.updateChildren(connectionInTree);
await this.refreshConnectionTreeTitles();
await this._tree.expand(connectionInTree);
}
}
Expand All @@ -301,7 +298,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
if (parentGroup) {
parentGroup.removeConnections([e]);
await this._tree.updateChildren(parentGroup);
await this.refreshConnectionTreeTitles();
await this._tree.revealSelectFocusElement(parentGroup);
}
}
Expand All @@ -319,14 +315,12 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
const newProfileParent = <ConnectionProfileGroup>this._tree.getElementById(e.profile.groupId);
newProfileParent.addOrReplaceConnection(e.profile);
await this._tree.updateChildren(newProfileParent);
await this.refreshConnectionTreeTitles();
await this._tree.revealSelectFocusElement(e.profile);
await this._tree.expand(e.profile);
} else {
// If the profile was not moved to a different group then just update the profile in the group.
oldProfileParent.replaceConnection(e.profile, e.oldProfileId);
await this._tree.updateChildren(oldProfileParent)
await this.refreshConnectionTreeTitles();
await this._tree.updateChildren(oldProfileParent);
await this._tree.revealSelectFocusElement(e.profile);
await this._tree.expand(e.profile);
}
Expand All @@ -351,7 +345,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
await this._tree.updateChildren(newParent);
await this._tree.expand(newParent);
}
await this.refreshConnectionTreeTitles();
const newConnection = this._tree.getElementById(movedConnection.id);
if (newConnection) {
await this._tree.revealSelectFocusElement(newConnection);
Expand All @@ -366,7 +359,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
const parent = <ConnectionProfileGroup>this._tree.getElementById(e.parentId);
parent.children = parent.children.filter(c => c.id !== e.id);
await this._tree.updateChildren(parent);
await this.refreshConnectionTreeTitles();
await this._tree.revealSelectFocusElement(parent);
}
}));
Expand All @@ -389,7 +381,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
e.parent = parent;
e.parentId = parent.id;
await this._tree.updateChildren(parent);
await this.refreshConnectionTreeTitles();
await this._tree.revealSelectFocusElement(e);
}
}));
Expand All @@ -400,7 +391,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
if (newParent) {
newParent.children[newParent.children.findIndex(c => c.id === e.id)] = e;
await this._tree.updateChildren(newParent);
await this.refreshConnectionTreeTitles();
await this._tree.revealSelectFocusElement(e);
}
}
Expand All @@ -419,7 +409,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
(<ConnectionProfileGroup>movedGroup).parent = newParent;
(<ConnectionProfileGroup>movedGroup).parentId = newParent.id;
await this._tree.updateChildren(newParent);
await this.refreshConnectionTreeTitles();
await this._tree.revealSelectFocusElement(movedGroup);
// Expanding the previously expanded children of the moved group after the move.
this._tree.expandElements(profileExpandedState);
Expand Down Expand Up @@ -709,7 +698,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
return;
}
await this._tree.setInput(treeInput!);
await this.refreshConnectionTreeTitles();
if (isHidden(this.messages!)) {
this._tree.getFocus();
if (this._tree instanceof AsyncServerTree) {
Expand Down Expand Up @@ -975,13 +963,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
return actionContext;
}

private async refreshConnectionTreeTitles(): Promise<void> {
let treeInput = this._tree.getInput();
let treeArray = TreeUpdateUtils.alterTreeChildrenTitles([treeInput], this._connectionManagementService, false);
treeInput = treeArray[0];
await this._tree!.setInput(treeInput);
}

public collapseAllConnections(): void {
const root = TreeUpdateUtils.getTreeInput(this._connectionManagementService)!;
const connections = ConnectionProfileGroup.getConnectionsInGroup(root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ export class SingleConnectionManagementService {
public get connectionInfo(): ConnectionManagementInfo {
return this._connectionService.getConnectionInfo(this._uri);
}

public getEditorConnectionProfileTitle(profile: IConnectionProfile, getOptionsOnly?: boolean, includeGroupName?: boolean): string {
return this._connectionService.getEditorConnectionProfileTitle(profile, getOptionsOnly, includeGroupName);
}
}

export class SingleAdminService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,12 +553,7 @@ class SavedConnectionNode {
}

getChildren() {
let input = TreeUpdateUtils.getTreeInput(this.connectionManagementService);
let newInput = [input];
if (input instanceof ConnectionProfileGroup) {
newInput = TreeUpdateUtils.alterTreeChildrenTitles([input], this.connectionManagementService);
}
return this.dataSource.getChildren(newInput[0]);
return this.dataSource.getChildren(TreeUpdateUtils.getTreeInput(this.connectionManagementService));
}
}

Expand Down
Loading