export async function openInDesigner()

in src/commands/logic-app/openInDesigner.ts [15:76]


export async function openInDesigner(tree: AzureTreeDataProvider, node?: IAzureNode): Promise<void> {
    if (!node) {
        node = await tree.showNodePicker(LogicAppTreeItem.contextValue);
    }

    const authorization = await getAuthorization(node.credentials);
    const { subscriptionId, treeItem } = node as IAzureNode<LogicAppTreeItem>;
    const callbacks = await treeItem.getCallbacks();
    const canvasMode = vscode.workspace.getConfiguration("azureLogicApps").get<boolean>("canvasMode")!;
    const definition = await treeItem.getData(/* refresh */ true);
    const parameters = treeItem.getParameters();
    const references = await treeItem.getReferences();
    const { id: workflowId, integrationAccountId, label: workflowName, location, resourceGroupName, sku } = treeItem;
    const { domain: tenantId, userName: userId } = getCredentialsMetadata(node.credentials);
    const title = workflowName;

    const options: vscode.WebviewOptions & vscode.WebviewPanelOptions = {
        enableScripts: true,
        retainContextWhenHidden: true
    };
    const panel = vscode.window.createWebviewPanel("readonlyDesigner", title, vscode.ViewColumn.Beside, options);
    panel.webview.html = getWebviewContentForDesigner({
        authorization,
        callbacks,
        canvasMode,
        definition,
        integrationAccountId,
        location,
        parameters,
        readOnly: true,
        references,
        resourceGroupName,
        sku,
        subscriptionId,
        tenantId,
        title,
        userId,
        workflowId
    });
    panel.webview.onDidReceiveMessage(
        async message => {
            switch (message.command) {
                case "OpenWindow":
                    await vscode.env.openExternal(message.url);
                    break;

                case "Save":
                    await handleSave(node! as IAzureNode<LogicAppTreeItem>, message.definition, message.parameters);
                    break;

                case "ShowError":
                    await vscode.window.showErrorMessage(message.errorMessage, DialogResponses.ok);
                    break;

                default:
                    break;
            }
        },
        /* thisArgs */ undefined,
        ext.context.subscriptions
    );
}