handle unsupported connection provider (#20577)

* handle unknown connection provider

* fix error
This commit is contained in:
Alan Ren
2022-09-09 14:14:33 -07:00
committed by GitHub
parent b9cb3de85b
commit be8bf7fcdc
10 changed files with 85 additions and 68 deletions

View File

@@ -25,20 +25,25 @@ export const DE_MANAGE_COMMAND_ID = 'dataExplorer.manage';
// Manage
CommandsRegistry.registerCommand({
id: DE_MANAGE_COMMAND_ID,
handler: (accessor, args: TreeViewItemHandleArg) => {
handler: async (accessor, args: TreeViewItemHandleArg) => {
if (args.$treeItem) {
const connectionService = accessor.get(IConnectionManagementService);
const capabilitiesService = accessor.get(ICapabilitiesService);
let options = {
showDashboard: true,
saveTheConnection: false,
params: undefined,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
};
let profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
let uri = generateUri(profile, 'dashboard');
return connectionService.connect(new ConnectionProfile(capabilitiesService, args.$treeItem.payload), uri, options);
const providerName = args.$treeItem?.payload?.providerName;
if (providerName && capabilitiesService.providers[providerName] === undefined) {
await connectionService.handleUnsupportedProvider(providerName);
} else {
let options = {
showDashboard: true,
saveTheConnection: false,
params: undefined,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
};
let profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
let uri = generateUri(profile, 'dashboard');
return connectionService.connect(new ConnectionProfile(capabilitiesService, args.$treeItem.payload), uri, options);
}
}
return Promise.resolve(true);
}