canvas_palette_template.jinja2 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {
  2. "version": "3.0",
  3. "categories": [
  4. {% for category_label, components in category_dict.items() %}
  5. {
  6. "id": "{{ category_label }}",
  7. "label": "{{ category_label }}",
  8. "node_types": [
  9. {% set ns = namespace(first_match=true) %}
  10. {% for component in components %}
  11. {% if not ns.first_match %},{% endif %}{% set ns.first_match = False %}
  12. {
  13. "op": "{{ component.op }}",
  14. "description": {{ component.description|tojson|safe }},
  15. "id": "{{ component.id }}",
  16. "image": "",
  17. "label": "{{ component.name }}",
  18. {% if component.runtime_type %}
  19. "runtime_type": "{{ component.runtime_type }}",
  20. {% endif %}
  21. "type": "execution_node",
  22. "inputs": [
  23. {
  24. "id": "inPort",
  25. "app_data": {
  26. "ui_data": {
  27. "cardinality": {
  28. "min": 0,
  29. "max": -1
  30. },
  31. "label": "Input Port"
  32. }
  33. }
  34. }
  35. ],
  36. "outputs": [
  37. {
  38. "id": "outPort",
  39. "app_data": {
  40. "ui_data": {
  41. "cardinality": {
  42. "min": 0,
  43. "max": -1
  44. },
  45. "label": "Output Port"
  46. }
  47. }
  48. }
  49. ],
  50. "parameters": {},
  51. "app_data": {
  52. {% if component.extensions %}
  53. "extensions": {{ component.extensions|tojson }},
  54. "parameter_refs": {{ component.parameter_refs|tojson }},
  55. {% endif %}
  56. "image": "",
  57. "ui_data": {
  58. "description": {{ component.description|tojson|safe }},
  59. "label": "{{ component.name }}",
  60. "image": "",
  61. "x_pos": 0,
  62. "y_pos": 0
  63. }
  64. }
  65. }{% endfor %}
  66. ]
  67. }{% if loop.index != category_dict|length %},{% endif %}{% endfor %}
  68. ]
  69. }