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

@@ -124,7 +124,12 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
let showConnectDialogOnStartup: boolean = this._configurationService.getValue('workbench.showConnectDialogOnStartup');
if (showConnectDialogOnStartup && !commandName && !profile && !this._connectionManagementService.hasRegisteredServers()) {
// 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;
}
let connectedContext: azdata.ConnectedContext = undefined;
@@ -235,7 +240,12 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
}
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) {
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>
= 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(); }))
.verifiable();
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => false);

View File

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

View File

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

View File

@@ -186,7 +186,12 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
connectButton.label = localize('serverTree.newConnection', "New Connection");
this._register(attachButtonStyler(connectButton, this._themeService));
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) {
connectionProfile = node;
await TreeUpdateUtils.connectAndCreateOeSession(connectionProfile, {
params: undefined,
saveTheConnection: true,
showConnectionDialogOnError: 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);
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 conProfGroup = new ConnectionProfileGroup('testGroup', undefined, 'testGroup', undefined, undefined);
return connectionTreeAction.run(conProfGroup).then((value) => {
connectionManagementService.verify(x => x.showConnectionDialog(undefined, undefined, TypeMoq.It.isAny()), TypeMoq.Times.once());
});
await connectionTreeAction.run(conProfGroup);
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', () => {

View File

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