Open connection dialog with URI (#10700)

* Add the openConnectionDialog code

* don't ignore case
This commit is contained in:
Amir Omidi
2020-06-03 16:53:13 -07:00
committed by GitHub
parent e80aec586b
commit ce17a73ede

View File

@@ -169,7 +169,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
}
public async handleURL(uri: URI): Promise<boolean> {
let key = uri.authority.toLowerCase();
let key = uri.authority;
let method = pathMappings[key];
@@ -207,6 +207,29 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
return true;
}
@pathHandler({
path: 'openConnectionDialog'
})
public async handleOpenConnectionDialog(uri: URI): Promise<boolean> {
try {
let args = this.parseProtocolArgs(uri);
if (!args.server) {
this._notificationService.warn(localize('warnServerRequired', "Cannot connect as no server information was provided"));
return true;
}
let isOpenOk = await this.confirmConnect(args);
if (!isOpenOk) {
return false;
}
const connectionProfile = this.readProfileFromArgs(args);
await this._connectionManagementService.showConnectionDialog(undefined, undefined, connectionProfile);
} catch (err) {
this._notificationService.error(localize('errConnectUrl', "Could not open URL due to error {0}", getErrorMessage(err)));
}
return true;
}
private async confirmConnect(args: SqlArgs): Promise<boolean> {
let detail = args && args.server ? localize('connectServerDetail', "This will connect to server {0}", args.server) : '';
const result = await this.dialogService.confirm({