Respect 'showDashboard' disabled by default (#22907)

This commit is contained in:
Cheena Malhotra
2023-05-01 11:55:38 -07:00
committed by GitHub
parent ea6bb41f45
commit 7b2a07befd
15 changed files with 39 additions and 26 deletions

View File

@@ -172,7 +172,6 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
await this._connectionManagementService.connectAndSaveProfile(connectionProfile, undefined, { await this._connectionManagementService.connectAndSaveProfile(connectionProfile, undefined, {
saveTheConnection: isUndefinedOrNull(connectionCompletionOptions.saveConnection) ? true : connectionCompletionOptions.saveConnection, saveTheConnection: isUndefinedOrNull(connectionCompletionOptions.saveConnection) ? true : connectionCompletionOptions.saveConnection,
showDashboard: isUndefinedOrNull(connectionCompletionOptions.showDashboard) ? false : connectionCompletionOptions.showDashboard, showDashboard: isUndefinedOrNull(connectionCompletionOptions.showDashboard) ? false : connectionCompletionOptions.showDashboard,
params: undefined,
showConnectionDialogOnError: isUndefinedOrNull(connectionCompletionOptions.showConnectionDialogOnError) ? true : connectionCompletionOptions.showConnectionDialogOnError, showConnectionDialogOnError: isUndefinedOrNull(connectionCompletionOptions.showConnectionDialogOnError) ? true : connectionCompletionOptions.showConnectionDialogOnError,
showFirewallRuleOnError: isUndefinedOrNull(connectionCompletionOptions.showFirewallRuleOnError) ? true : connectionCompletionOptions.showFirewallRuleOnError showFirewallRuleOnError: isUndefinedOrNull(connectionCompletionOptions.showFirewallRuleOnError) ? true : connectionCompletionOptions.showFirewallRuleOnError
}); });
@@ -248,7 +247,6 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
return this._connectionManagementService.connectAndSaveProfile(profile, undefined, { return this._connectionManagementService.connectAndSaveProfile(profile, undefined, {
saveTheConnection: saveConnection, saveTheConnection: saveConnection,
showDashboard: showDashboard, showDashboard: showDashboard,
params: undefined,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showFirewallRuleOnError: true showFirewallRuleOnError: true
}).then((result) => { }).then((result) => {

View File

@@ -47,7 +47,7 @@ export class ManageAction extends Action {
override async run(actionContext: ManageActionContext): Promise<void> { override async run(actionContext: ManageActionContext): Promise<void> {
if (actionContext.profile) { if (actionContext.profile) {
await this._connectionManagementService.connect(actionContext.profile, actionContext.uri, { showDashboard: true, saveTheConnection: false, params: undefined, showConnectionDialogOnError: false, showFirewallRuleOnError: true }); await this._connectionManagementService.connect(actionContext.profile, actionContext.uri, { showDashboard: true, saveTheConnection: false, showConnectionDialogOnError: false, showFirewallRuleOnError: true });
this._angularEventingService.sendAngularEvent(actionContext.uri, AngularEventType.NAV_DATABASE); this._angularEventingService.sendAngularEvent(actionContext.uri, AngularEventType.NAV_DATABASE);
} }
} }

View File

@@ -124,7 +124,12 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
let showConnectDialogOnStartup: boolean = this._configurationService.getValue('workbench.showConnectDialogOnStartup'); let showConnectDialogOnStartup: boolean = this._configurationService.getValue('workbench.showConnectDialogOnStartup');
if (showConnectDialogOnStartup && !commandName && !profile && !this._connectionManagementService.hasRegisteredServers()) { if (showConnectDialogOnStartup && !commandName && !profile && !this._connectionManagementService.hasRegisteredServers()) {
// prompt the user for a new connection on startup if no profiles are registered // prompt the user for a new connection on startup if no profiles are registered
await this._connectionManagementService.showConnectionDialog(); await this._connectionManagementService.showConnectionDialog(undefined, {
showDashboard: true,
saveTheConnection: true,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
return; return;
} }
let connectedContext: azdata.ConnectedContext = undefined; let connectedContext: azdata.ConnectedContext = undefined;
@@ -235,7 +240,12 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
} }
const connectionProfile = this.readProfileFromArgs(args); const connectionProfile = this.readProfileFromArgs(args);
await this._connectionManagementService.showConnectionDialog(undefined, undefined, connectionProfile); await this._connectionManagementService.showConnectionDialog(undefined, {
saveTheConnection: true,
showDashboard: true,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
}, connectionProfile);
} catch (err) { } catch (err) {
this._notificationService.error(localize('errConnectUrl', "Could not open URL due to error {0}", getErrorMessage(err))); this._notificationService.error(localize('errConnectUrl', "Could not open URL due to error {0}", getErrorMessage(err)));
} }

View File

@@ -140,7 +140,7 @@ suite('commandLineService tests', () => {
const connectionManagementService: TypeMoq.Mock<IConnectionManagementService> const connectionManagementService: TypeMoq.Mock<IConnectionManagementService>
= TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict); = TypeMoq.Mock.ofType<IConnectionManagementService>(TestConnectionManagementService, TypeMoq.MockBehavior.Strict);
connectionManagementService.setup((c) => c.showConnectionDialog()) connectionManagementService.setup((c) => c.showConnectionDialog(undefined, TypeMoq.It.isAny()))
.returns(() => new Promise<void>((resolve, reject) => { resolve(); })) .returns(() => new Promise<void>((resolve, reject) => { resolve(); }))
.verifiable(); .verifiable();
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => false); connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => false);

View File

@@ -147,12 +147,16 @@ CommandsRegistry.registerCommand('azdata.connect',
connectionManagementService.connect(connectionProfile, undefined, { connectionManagementService.connect(connectionProfile, undefined, {
saveTheConnection: true, saveTheConnection: true,
showDashboard: true, showDashboard: true,
params: undefined,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showFirewallRuleOnError: true showFirewallRuleOnError: true
}); });
} else { } else {
connectionManagementService.showConnectionDialog(); connectionManagementService.showConnectionDialog(undefined, {
saveTheConnection: true,
showDashboard: true,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
} }
}); });

View File

@@ -38,7 +38,6 @@ CommandsRegistry.registerCommand({
let options = { let options = {
showDashboard: true, showDashboard: true,
saveTheConnection: false, saveTheConnection: false,
params: undefined,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showFirewallRuleOnError: true showFirewallRuleOnError: true
}; };
@@ -122,7 +121,6 @@ export class OEManageConnectionAction extends Action {
} }
let options: IConnectionCompletionOptions = { let options: IConnectionCompletionOptions = {
params: undefined,
saveTheConnection: false, saveTheConnection: false,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showDashboard: true, showDashboard: true,

View File

@@ -186,7 +186,12 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
connectButton.label = localize('serverTree.newConnection', "New Connection"); connectButton.label = localize('serverTree.newConnection', "New Connection");
this._register(attachButtonStyler(connectButton, this._themeService)); this._register(attachButtonStyler(connectButton, this._themeService));
this._register(connectButton.onDidClick(() => { this._register(connectButton.onDidClick(() => {
this._connectionManagementService.showConnectionDialog(); this._connectionManagementService.showConnectionDialog(undefined, {
showDashboard: true,
saveTheConnection: true,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
})); }));
} }
@@ -872,7 +877,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
if (node instanceof ConnectionProfile) { if (node instanceof ConnectionProfile) {
connectionProfile = node; connectionProfile = node;
await TreeUpdateUtils.connectAndCreateOeSession(connectionProfile, { await TreeUpdateUtils.connectAndCreateOeSession(connectionProfile, {
params: undefined,
saveTheConnection: true, saveTheConnection: true,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showFirewallRuleOnError: true, showFirewallRuleOnError: true,

View File

@@ -283,14 +283,14 @@ suite('SQL Connection Tree Action tests', () => {
}); });
}); });
test('AddServerAction - test if show connection dialog is called', () => { test('AddServerAction - test if show connection dialog is called', async () => {
let connectionManagementService = createConnectionManagementService(true, undefined); let connectionManagementService = createConnectionManagementService(true, undefined);
connectionManagementService.setup(x => x.showConnectionDialog(undefined, TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(
() => new Promise<void>((resolve, reject) => resolve()));
let connectionTreeAction: AddServerAction = new AddServerAction(AddServerAction.ID, AddServerAction.LABEL, connectionManagementService.object); let connectionTreeAction: AddServerAction = new AddServerAction(AddServerAction.ID, AddServerAction.LABEL, connectionManagementService.object);
let conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined); let conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
return connectionTreeAction.run(conProfGroup).then((value) => { await connectionTreeAction.run(conProfGroup);
connectionManagementService.verify(x => x.showConnectionDialog(undefined, undefined, TypeMoq.It.isAny()), TypeMoq.Times.once()); connectionManagementService.verify(x => x.showConnectionDialog(undefined, TypeMoq.It.isAny(), TypeMoq.It.isAny()), TypeMoq.Times.once());
});
}); });
test('ActiveConnectionsFilterAction - test if view is called to display filtered results', () => { test('ActiveConnectionsFilterAction - test if view is called to display filtered results', () => {

View File

@@ -278,7 +278,6 @@ export class NewProfilerAction extends Task {
let profilerInput = accessor.get<IInstantiationService>(IInstantiationService).createInstance(ProfilerInput, profile); let profilerInput = accessor.get<IInstantiationService>(IInstantiationService).createInstance(ProfilerInput, profile);
await accessor.get<IEditorService>(IEditorService).openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP); await accessor.get<IEditorService>(IEditorService).openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP);
let options: IConnectionCompletionOptions = { let options: IConnectionCompletionOptions = {
params: undefined,
saveTheConnection: false, saveTheConnection: false,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showDashboard: false, showDashboard: false,

View File

@@ -265,7 +265,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
let options: IConnectionCompletionOptions = this._options || { let options: IConnectionCompletionOptions = this._options || {
params: params, params: params,
saveTheConnection: !isTemporaryConnection, saveTheConnection: !isTemporaryConnection,
showDashboard: params && params.showDashboard !== undefined ? params.showDashboard : !fromEditor && !isTemporaryConnection, showDashboard: params?.showDashboard ?? false,
showConnectionDialogOnError: false, showConnectionDialogOnError: false,
showFirewallRuleOnError: true showFirewallRuleOnError: true
}; };

View File

@@ -492,7 +492,6 @@ export class ConnectionManagementService extends Disposable implements IConnecti
saveTheConnection: saveConnection, saveTheConnection: saveConnection,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showDashboard: purpose === 'dashboard', showDashboard: purpose === 'dashboard',
params: undefined,
showFirewallRuleOnError: true, showFirewallRuleOnError: true,
}; };
return this.connect(connection, ownerUri, options).then(connectionResult => { return this.connect(connection, ownerUri, options).then(connectionResult => {
@@ -524,7 +523,6 @@ export class ConnectionManagementService extends Disposable implements IConnecti
options = { options = {
saveTheConnection: true, saveTheConnection: true,
showDashboard: false, showDashboard: false,
params: undefined,
showConnectionDialogOnError: false, showConnectionDialogOnError: false,
showFirewallRuleOnError: true showFirewallRuleOnError: true
}; };
@@ -574,7 +572,6 @@ export class ConnectionManagementService extends Disposable implements IConnecti
options = { options = {
saveTheConnection: false, saveTheConnection: false,
showDashboard: false, showDashboard: false,
params: undefined,
showConnectionDialogOnError: false, showConnectionDialogOnError: false,
showFirewallRuleOnError: true showFirewallRuleOnError: true
}; };

View File

@@ -179,7 +179,12 @@ export class AddServerAction extends Action {
saveProfile: true, saveProfile: true,
id: element.id! id: element.id!
} as Partial<IConnectionProfile>; } as Partial<IConnectionProfile>;
await this._connectionManagementService.showConnectionDialog(undefined, undefined, connection); await this._connectionManagementService.showConnectionDialog(undefined, {
showDashboard: true,
saveTheConnection: true,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
}, connection);
} }
} }

View File

@@ -87,7 +87,7 @@ export class OEShimService extends Disposable implements IOEShimService {
private async connectOrPrompt(connProfile: ConnectionProfile): Promise<ConnectionProfile> { private async connectOrPrompt(connProfile: ConnectionProfile): Promise<ConnectionProfile> {
connProfile = await new Promise(async (resolve, reject) => { connProfile = await new Promise(async (resolve, reject) => {
let result = await this.cm.connect(connProfile, undefined, { showConnectionDialogOnError: true, showFirewallRuleOnError: true, saveTheConnection: false, showDashboard: false, params: undefined }, { let result = await this.cm.connect(connProfile, undefined, { showConnectionDialogOnError: true, showFirewallRuleOnError: true, saveTheConnection: false, showDashboard: false }, {
onConnectSuccess: async (e, profile) => { onConnectSuccess: async (e, profile) => {
let existingConnection = this.cm.findExistingConnection(profile); let existingConnection = this.cm.findExistingConnection(profile);
connProfile = new ConnectionProfile(this.capabilities, existingConnection); connProfile = new ConnectionProfile(this.capabilities, existingConnection);

View File

@@ -142,7 +142,6 @@ export class TreeSelectionHandler {
doubleClickHandler(selectedNode); doubleClickHandler(selectedNode);
} else if (selectedNode instanceof ConnectionProfile) { } else if (selectedNode instanceof ConnectionProfile) {
let options: IConnectionCompletionOptions = { let options: IConnectionCompletionOptions = {
params: undefined,
saveTheConnection: true, saveTheConnection: true,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showFirewallRuleOnError: true, showFirewallRuleOnError: true,

View File

@@ -305,7 +305,6 @@ export class TreeUpdateUtils {
return rootNode.children ?? []; return rootNode.children ?? [];
} else { } else {
const options: IConnectionCompletionOptions = { const options: IConnectionCompletionOptions = {
params: undefined,
saveTheConnection: true, saveTheConnection: true,
showConnectionDialogOnError: true, showConnectionDialogOnError: true,
showFirewallRuleOnError: true, showFirewallRuleOnError: true,