Make azure portal work from server area (#10699)

This commit is contained in:
Amir Omidi
2020-06-03 14:02:23 -07:00
committed by GitHub
parent 61dce39f5a
commit 3860f07cab
4 changed files with 74 additions and 13 deletions

View File

@@ -5,14 +5,45 @@
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { localize } from 'vs/nls';
import { MssqlNodeContext } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
import { ConnectionContextKey } from 'sql/workbench/services/connection/common/connectionContextKey';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { TreeViewItemHandleArg } from 'sql/workbench/common/views';
import { ObjectExplorerActionsContext } from 'sql/workbench/services/objectExplorer/browser/objectExplorerActions';
const openInAzureDECommandId: string = 'azure.openInAzureCoreDE';
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
group: 'z-azurecore',
order: 1,
command: {
id: 'azure.resource.openInAzurePortal',
id: openInAzureDECommandId,
title: localize('azure.openInAzurePortal.title', "Open in Azure Portal")
},
when: MssqlNodeContext.CanOpenInAzurePortal
});
CommandsRegistry.registerCommand({
id: openInAzureDECommandId,
handler: (accessor, args: TreeViewItemHandleArg) => {
const commandService = accessor.get(ICommandService);
return commandService.executeCommand('azure.resource.openInAzurePortal', args.$treeItem.payload);
}
});
const openInAzureOECommandId: string = 'azure.openInAzureCoreOE';
MenuRegistry.appendMenuItem(MenuId.ObjectExplorerItemContext, {
group: 'z-azurecore',
order: 1,
command: {
id: openInAzureOECommandId,
title: localize('azure.openInAzurePortal.title', "Open in Azure Portal")
},
when: ConnectionContextKey.CanOpenInAzurePortal
});
CommandsRegistry.registerCommand({
id: openInAzureOECommandId,
handler: (accessor, args: ObjectExplorerActionsContext) => {
const commandService = accessor.get(ICommandService);
return commandService.executeCommand('azure.resource.openInAzurePortal', args.connectionProfile);
}
});