mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
update commandline handler (#17893)
* update commandline handler * pr comments
This commit is contained in:
@@ -40,6 +40,7 @@ export interface SqlArgs {
|
|||||||
provider?: string;
|
provider?: string;
|
||||||
aad?: boolean; // deprecated - used by SSMS - authenticationType should be used instead
|
aad?: boolean; // deprecated - used by SSMS - authenticationType should be used instead
|
||||||
integrated?: 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
|
//#region decorators
|
||||||
@@ -131,7 +132,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
|||||||
this._notificationService.status(localize('connectingLabel', "Connecting: {0}", profile.serverName), { hideAfter: 2500 });
|
this._notificationService.status(localize('connectingLabel', "Connecting: {0}", profile.serverName), { hideAfter: 2500 });
|
||||||
}
|
}
|
||||||
try {
|
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,
|
// 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.
|
// 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);
|
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 });
|
this._notificationService.status(localize('runningCommandLabel', "Running command: {0}", commandName), { hideAfter: 2500 });
|
||||||
}
|
}
|
||||||
await this._commandService.executeCommand(commandName, connectedContext);
|
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,
|
// If we were given a file and it was opened with the sql editor,
|
||||||
// we want to connect the given profile to to it.
|
// 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 more than one file was passed, only show the connection dialog error on one of them.
|
||||||
if (args._ && args._.length > 0) {
|
if (args._ && args._.length > 0) {
|
||||||
await Promise.all(args._.map((f, i) => this.processFile(URI.file(f).toString(), profile, i === 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
|
// Default to showing new query
|
||||||
if (this._notificationService) {
|
if (this._notificationService) {
|
||||||
this._notificationService.status(localize('openingNewQueryLabel', "Opening new query: {0}", profile.serverName), { hideAfter: 2500 });
|
this._notificationService.status(localize('openingNewQueryLabel', "Opening new query: {0}", profile.serverName), { hideAfter: 2500 });
|
||||||
|
|||||||
Reference in New Issue
Block a user