mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Open connection dialog with URI (#10700)
* Add the openConnectionDialog code * don't ignore case
This commit is contained in:
@@ -169,7 +169,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async handleURL(uri: URI): Promise<boolean> {
|
public async handleURL(uri: URI): Promise<boolean> {
|
||||||
let key = uri.authority.toLowerCase();
|
let key = uri.authority;
|
||||||
|
|
||||||
let method = pathMappings[key];
|
let method = pathMappings[key];
|
||||||
|
|
||||||
@@ -207,6 +207,29 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
|||||||
return true;
|
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> {
|
private async confirmConnect(args: SqlArgs): Promise<boolean> {
|
||||||
let detail = args && args.server ? localize('connectServerDetail', "This will connect to server {0}", args.server) : '';
|
let detail = args && args.server ? localize('connectServerDetail', "This will connect to server {0}", args.server) : '';
|
||||||
const result = await this.dialogService.confirm({
|
const result = await this.dialogService.confirm({
|
||||||
|
|||||||
Reference in New Issue
Block a user