canvas_properties_template.jinja2 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. {
  2. "current_parameters": {
  3. {% if component.description %}"component_description": {{ component.description|tojson|safe }},{% endif %}
  4. "label": "",
  5. {% for property in component.properties %}
  6. "elyra_{{ property.ref }}":
  7. {% if property.control_id == "OneOfControl" %}
  8. {
  9. "activeControl": "{{ property.default_control_type }}",
  10. "{{ property.default_control_type }}":
  11. {% endif %}
  12. {% set property_data_type = property.data_type %}
  13. {% if property.data_type == 'inputvalue' %}{% set property_data_type = property.default_data_type %}{% endif %}
  14. {% if property.default_control_type == "EnumControl" %}
  15. null
  16. {% elif property_data_type|lower == "bool" or property_data_type|lower == "boolean" %}
  17. {{ property.value|lower }}
  18. {% elif property_data_type|lower == "int" or property_data_type|lower == "integer" or
  19. property_data_type|lower == "number" or property_data_type|lower == "float" %}
  20. {{ property.value }}
  21. {% else %}
  22. "{{ property.value }}"
  23. {% endif %}
  24. {% if property.control_id == "OneOfControl" %}
  25. }
  26. {% endif %},
  27. {% endfor %}
  28. "component_source": {{ component.component_source|tojson|safe }}
  29. },
  30. "parameters": [
  31. {% if component.description %}{
  32. "id": "component_description"
  33. },{% endif %}
  34. {
  35. "id": "label"
  36. },
  37. {% for property in component.properties %}
  38. {
  39. "id": "elyra_{{ property.ref }}"
  40. },
  41. {% endfor %}
  42. {
  43. "id": "component_source"
  44. }
  45. ],
  46. "uihints": {
  47. "id": "nodeProperties",
  48. "parameter_info": [
  49. {% if component.description %}{
  50. "parameter_ref": "component_description",
  51. "control": "readonly",
  52. "label": {
  53. "default": "Component Description"
  54. },
  55. "description": {
  56. "default": " ",
  57. "placement": "on_panel"
  58. },
  59. "label_visible": false,
  60. "data": {
  61. "required": false
  62. }
  63. },{% endif %}
  64. {
  65. "parameter_ref": "label",
  66. "control": "custom",
  67. "custom_control_id": "StringControl",
  68. "label": {
  69. "default": "Label"
  70. },
  71. "description": {
  72. "default": "A custom label for the node.",
  73. "placement": "on_panel"
  74. },
  75. "data": {}
  76. },
  77. {% for property in component.properties %}
  78. {
  79. "parameter_ref": "elyra_{{ property.ref }}",
  80. "control": "{{ property.control }}",
  81. "custom_control_id": "{{ property.control_id }}",
  82. "label": {
  83. "default": "{{ property.name }}"
  84. },
  85. "description": {
  86. "default": {{ property.description|tojson|safe }},
  87. "placement": "on_panel"
  88. },
  89. "data": {
  90. {% if property.control_id == "OneOfControl" %}
  91. "controls":{
  92. {% for control, control_data_type, control_label in property.one_of_control_types %}
  93. "{{ control }}": {
  94. "label": "{{ control_label }}",
  95. "format": "{{ control_data_type }}"
  96. {% if control == 'NestedEnumControl' %}
  97. ,
  98. "allownooptions":
  99. {% if property.allow_no_options %}
  100. true
  101. {% else %}
  102. false
  103. {% endif %}
  104. {% endif %}
  105. }
  106. {% if loop.index != loop.length %}
  107. ,
  108. {% endif %}
  109. {% endfor %}
  110. },
  111. {% else %}
  112. "format": "{{ property.data_type }}",
  113. {% endif %}
  114. "required": {{ property.required|lower }}
  115. {% if property.control_id == "EnumControl" %}
  116. ,
  117. "items": [
  118. {% for item in property.items %}
  119. "{{ item }}"
  120. {% if loop.index != property.items|length %}
  121. ,
  122. {% endif %}
  123. {% endfor %}
  124. ]
  125. {% endif %}
  126. }
  127. },
  128. {% endfor %}
  129. {
  130. "parameter_ref": "component_source",
  131. "control": "readonly",
  132. "label": {
  133. "default": "Component Source"
  134. },
  135. "description": {
  136. "default": " ",
  137. "placement": "on_panel"
  138. },
  139. "data": {}
  140. }
  141. ],
  142. "group_info": [
  143. {
  144. "id": "nodeGroupInfo",
  145. "type": "panels",
  146. "group_info": [
  147. {% if component.description %}{
  148. "id": "component_description",
  149. "type": "controls",
  150. "parameter_refs": ["component_description"]
  151. },{% endif %}
  152. {
  153. "id": "label",
  154. "type": "controls",
  155. "parameter_refs": ["label"]
  156. },
  157. {% if component.input_properties|length > 0 %}
  158. {
  159. "id": "elyra_inputCategoryHeader",
  160. "class_name": "elyra_categoryHeader",
  161. "type": "textPanel",
  162. "label": {
  163. "default": "Inputs"
  164. }
  165. },
  166. {% for property in component.input_properties %}
  167. {
  168. "id": "elyra_{{ property.ref }}",
  169. "type": "controls",
  170. "parameter_refs": ["elyra_{{ property.ref }}"]
  171. },
  172. {% endfor %}
  173. {% endif %}
  174. {% if component.output_properties|length > 0 %}
  175. {
  176. "id": "elyra_outputCategoryHeader",
  177. "type": "textPanel",
  178. "class_name": "elyra_categoryHeader",
  179. "label": {
  180. "default": "Outputs"
  181. }
  182. },
  183. {% for property in component.output_properties %}
  184. {
  185. "id": "elyra_{{ property.ref }}",
  186. "type": "controls",
  187. "parameter_refs": ["elyra_{{ property.ref }}"]
  188. },
  189. {% endfor %}
  190. {% endif %}
  191. {
  192. "id": "elyra_component_sourceCategoryHeader",
  193. "type": "textPanel",
  194. "class_name": "elyra_categoryHeader",
  195. "label": {
  196. "default": "Component Source"
  197. }
  198. },
  199. {
  200. "id": "component_source",
  201. "type": "controls",
  202. "parameter_refs": ["component_source"]
  203. }
  204. ]
  205. }
  206. ]
  207. },
  208. "resources": {}
  209. }