mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2025-11-20 17:48:34 +00:00
Fix workflow display with macro
This commit is contained in:
parent
3a33088ed7
commit
3b8f3f382c
21
main.py
21
main.py
@ -1,13 +1,18 @@
|
||||
import requests
|
||||
import html
|
||||
import urllib.parse
|
||||
import json
|
||||
|
||||
def define_env(env):
|
||||
"Hook function"
|
||||
"Hook function"
|
||||
|
||||
@env.macro
|
||||
def workflowDemo(workflow_endpoint):
|
||||
r = requests.get(url = workflow_endpoint)
|
||||
workflow_json = r.content.decode("utf-8")
|
||||
print(workflow_json)
|
||||
return f"<div class='workflow_preview'><n8n-demo clicktointeract='true' frame='true' collapseformobile='false' workflow='{workflow_json}'></n8n-demo></div>"
|
||||
@env.macro
|
||||
def workflowDemo(workflow_endpoint):
|
||||
r = requests.get(url = workflow_endpoint)
|
||||
wf_data = r.json()
|
||||
workflow_json = {
|
||||
"nodes": wf_data['workflow']['nodes'],
|
||||
"connections": wf_data['workflow']['connections']
|
||||
}
|
||||
encoded_workflow_json = urllib.parse.quote(json.dumps(workflow_json))
|
||||
return f"<div class='workflow_preview'><n8n-demo clicktointeract='true' frame='true' collapseformobile='false' workflow='{encoded_workflow_json}'></n8n-demo></div>"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user