update commandline handler (#17893)

* update commandline handler

* pr comments
This commit is contained in:
Alan Ren
2021-12-10 15:55:07 -08:00
committed by GitHub
parent 70377540c3
commit b25cd177b0

View File

@@ -40,6 +40,7 @@ export interface SqlArgs {
provider?: string;
aad?: boolean; // deprecated - used by SSMS - authenticationType should be used instead
integrated?: boolean; // deprecated - used by SSMS - authenticationType should be used instead.
showDashboard?: boolean;
}
//#region decorators
@@ -131,7 +132,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
this._notificationService.status(localize('connectingLabel', "Connecting: {0}", profile.serverName), { hideAfter: 2500 });
}
try {
await this._connectionManagementService.connectIfNotConnected(profile, 'connection', true);
await this._connectionManagementService.connectIfNotConnected(profile, args.showDashboard ? 'dashboard' : 'connection', true);
// Before sending to extensions, we should a) serialize to IConnectionProfile or things will fail,
// and b) use the latest version of the profile from the service so most fields are filled in.
let updatedProfile = this._connectionManagementService.getConnectionProfileById(profile.id);
@@ -145,14 +146,14 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
this._notificationService.status(localize('runningCommandLabel', "Running command: {0}", commandName), { hideAfter: 2500 });
}
await this._commandService.executeCommand(commandName, connectedContext);
} else if (profile) {
} else if (connectedContext) {
// If we were given a file and it was opened with the sql editor,
// we want to connect the given profile to to it.
// If more than one file was passed, only show the connection dialog error on one of them.
if (args._ && args._.length > 0) {
await Promise.all(args._.map((f, i) => this.processFile(URI.file(f).toString(), profile, i === 0)));
}
else {
else if (this._capabilitiesService.getCapabilities(profile.providerName)?.connection?.isQueryProvider) {
// Default to showing new query
if (this._notificationService) {
this._notificationService.status(localize('openingNewQueryLabel', "Opening new query: {0}", profile.serverName), { hideAfter: 2500 });