Fix OpenInPortal from command palette

This commit is contained in:
Eric Jizba 2017-10-24 10:49:44 -07:00
Родитель 343026f1f5
Коммит 4ce2117d21
2 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -4,10 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import * as opn from 'opn';
import { AzureFunctionsExplorer } from '../AzureFunctionsExplorer';
import { FunctionAppNode } from '../nodes/FunctionAppNode';
import { NodeBase } from '../nodes/NodeBase';
export function openInPortal(node?: NodeBase): void {
if (node) {
(<(s: string) => void>opn)(`https://portal.azure.com/${node.tenantId}/#resource${node.id}`);
export async function openInPortal(explorer: AzureFunctionsExplorer, node?: NodeBase): Promise<void> {
if (!node) {
node = <FunctionAppNode>(await explorer.showNodePicker(FunctionAppNode.contextValue));
}
(<(s: string) => void>opn)(`https://portal.azure.com/${node.tenantId}/#resource${node.id}`);
}

Просмотреть файл

@ -48,7 +48,7 @@ export function activate(context: vscode.ExtensionContext): void {
context.subscriptions.push(azureAccount.onStatusChanged(() => explorer.refresh()));
initCommand<NodeBase>(context, 'azureFunctions.refresh', (node?: NodeBase) => explorer.refresh(node));
initCommand<undefined>(context, 'azureFunctions.openInPortal', openInPortal);
initCommand<NodeBase>(context, 'azureFunctions.openInPortal', async (node?: NodeBase) => await openInPortal(explorer, node));
initAsyncCommand<NodeBase>(context, 'azureFunctions.createFunction', async () => await createFunction(outputChannel));
initAsyncCommand<NodeBase>(context, 'azureFunctions.createNewProject', async () => await createNewProject(outputChannel));
initAsyncCommand<NodeBase>(context, 'azureFunctions.startFunctionApp', async (node?: FunctionAppNode) => await startFunctionApp(explorer, node));