canvas_properties_template.jinja2 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. {% if "mounted_volumes" not in elyra_property_collisions_list %}
  29. "elyra_mounted_volumes": [],
  30. {% endif %}
  31. {% if "kubernetes_tolerations" not in elyra_property_collisions_list %}
  32. "elyra_kubernetes_tolerations": [],
  33. {% endif %}
  34. {% if "kubernetes_pod_annotations" not in elyra_property_collisions_list %}
  35. "elyra_kubernetes_pod_annotations": [],
  36. {% endif %}
  37. {% if "disallow_cached_output" not in elyra_property_collisions_list %}
  38. "elyra_disallow_cached_output": null,
  39. {% endif %}
  40. "component_source": {{ component.component_source|tojson|safe }}
  41. },
  42. "parameters": [
  43. {% if component.description %}{
  44. "id": "component_description"
  45. },{% endif %}
  46. {
  47. "id": "label"
  48. },
  49. {% for property in component.properties %}
  50. {
  51. "id": "elyra_{{ property.ref }}"
  52. },
  53. {% endfor %}
  54. {% if "mounted_volumes" not in elyra_property_collisions_list %}
  55. {
  56. "id": "elyra_mounted_volumes"
  57. },
  58. {% endif %}
  59. {% if "kubernetes_tolerations" not in elyra_property_collisions_list %}
  60. {
  61. "id": "elyra_kubernetes_tolerations"
  62. },
  63. {% endif %}
  64. {% if "kubernetes_pod_annotations" not in elyra_property_collisions_list %}
  65. {
  66. "id": "elyra_kubernetes_pod_annotations"
  67. },
  68. {% endif %}
  69. {% if "disallow_cached_output" not in elyra_property_collisions_list %}
  70. {
  71. "id": "elyra_disallow_cached_output"
  72. },
  73. {% endif %}
  74. {
  75. "id": "component_source"
  76. }
  77. ],
  78. "uihints": {
  79. "id": "nodeProperties",
  80. "parameter_info": [
  81. {% if component.description %}{
  82. "parameter_ref": "component_description",
  83. "control": "readonly",
  84. "label": {
  85. "default": "Component Description"
  86. },
  87. "description": {
  88. "default": " ",
  89. "placement": "on_panel"
  90. },
  91. "label_visible": false,
  92. "data": {
  93. "required": false
  94. }
  95. },{% endif %}
  96. {
  97. "parameter_ref": "label",
  98. "control": "custom",
  99. "custom_control_id": "StringControl",
  100. "label": {
  101. "default": "Label"
  102. },
  103. "description": {
  104. "default": "A custom label for the node.",
  105. "placement": "on_panel"
  106. },
  107. "data": {}
  108. },
  109. {% for property in component.properties %}
  110. {
  111. "parameter_ref": "elyra_{{ property.ref }}",
  112. "control": "{{ property.control }}",
  113. "custom_control_id": "{{ property.control_id }}",
  114. "label": {
  115. "default": "{{ property.name }}"
  116. },
  117. "description": {
  118. "default": {{ property.description|tojson|safe }},
  119. "placement": "on_panel"
  120. },
  121. "data": {
  122. {% if property.control_id == "OneOfControl" %}
  123. "controls":{
  124. {% for control, control_data_type, control_label in property.one_of_control_types %}
  125. "{{ control }}": {
  126. "label": "{{ control_label }}",
  127. "format": "{{ control_data_type }}"
  128. {% if control == 'NestedEnumControl' %}
  129. ,
  130. "allownooptions":
  131. {% if property.allow_no_options %}
  132. true
  133. {% else %}
  134. false
  135. {% endif %}
  136. {% endif %}
  137. }
  138. {% if loop.index != loop.length %}
  139. ,
  140. {% endif %}
  141. {% endfor %}
  142. },
  143. {% else %}
  144. "format": "{{ property.data_type }}",
  145. {% endif %}
  146. "required": {{ property.required|lower }}
  147. {% if property.control_id == "EnumControl" %}
  148. ,
  149. "items": [
  150. {% for item in property.items %}
  151. "{{ item }}"
  152. {% if loop.index != property.items|length %}
  153. ,
  154. {% endif %}
  155. {% endfor %}
  156. ]
  157. {% endif %}
  158. }
  159. },
  160. {% endfor %}
  161. {% if "mounted_volumes" not in elyra_property_collisions_list %}
  162. {
  163. "parameter_ref": "elyra_mounted_volumes",
  164. "control": "custom",
  165. "custom_control_id": "StringArrayControl",
  166. "label": {
  167. "default": "Data Volumes"
  168. },
  169. "description": {
  170. "default": "Volumes to be mounted in this node. The specified Persistent Volume Claims must exist in the Kubernetes namespace where the node is executed or this node will not run.",
  171. "placement": "on_panel"
  172. },
  173. "data": {
  174. "required": false,
  175. "placeholder": "/mount/path=pvc-name",
  176. "keyValueEntries": true
  177. }
  178. },
  179. {% endif %}
  180. {% if "kubernetes_tolerations" not in elyra_property_collisions_list %}
  181. {
  182. "parameter_ref": "elyra_kubernetes_tolerations",
  183. "control": "custom",
  184. "custom_control_id": "StringArrayControl",
  185. "label": {
  186. "default": "Kubernetes Tolerations"
  187. },
  188. "description": {
  189. "default": "Kubernetes tolerations to attach to the pod where the node is executed.",
  190. "placement": "on_panel"
  191. },
  192. "data": {
  193. "required": false,
  194. "placeholder": "TOL_ID=key:operator:value:effect",
  195. "keyValueEntries": true
  196. }
  197. },
  198. {% endif %}
  199. {% if "kubernetes_pod_annotations" not in elyra_property_collisions_list %}
  200. {
  201. "parameter_ref": "elyra_kubernetes_pod_annotations",
  202. "control": "custom",
  203. "custom_control_id": "StringArrayControl",
  204. "label": {
  205. "default": "Kubernetes Pod Annotations"
  206. },
  207. "description": {
  208. "default": "Metadata to be added to this node. The metadata is exposed as annotation in the Kubernetes pod that executes this node.",
  209. "placement": "on_panel"
  210. },
  211. "data": {
  212. "required": false,
  213. "placeholder": "annotation_key=annotation_value",
  214. "keyValueEntries": true
  215. }
  216. },
  217. {% endif %}
  218. {% if "disallow_cached_output" not in elyra_property_collisions_list %}
  219. {
  220. "parameter_ref": "elyra_disallow_cached_output",
  221. "control": "custom",
  222. "custom_control_id": "BooleanControl",
  223. "label": {
  224. "default": "Disallow cached output"
  225. },
  226. "description": {
  227. "default": "Disable caching to force node re-execution in the target runtime environment.",
  228. "placement": "on_panel"
  229. },
  230. "data": {
  231. "required": false
  232. }
  233. },
  234. {% endif %}
  235. {
  236. "parameter_ref": "component_source",
  237. "control": "readonly",
  238. "label": {
  239. "default": "Component Source"
  240. },
  241. "description": {
  242. "default": " ",
  243. "placement": "on_panel"
  244. },
  245. "data": {}
  246. }
  247. ],
  248. "group_info": [
  249. {
  250. "id": "nodeGroupInfo",
  251. "type": "panels",
  252. "group_info": [
  253. {% if component.description %}{
  254. "id": "component_description",
  255. "type": "controls",
  256. "parameter_refs": ["component_description"]
  257. },{% endif %}
  258. {
  259. "id": "label",
  260. "type": "controls",
  261. "parameter_refs": ["label"]
  262. },
  263. {% if component.input_properties|length > 0 %}
  264. {
  265. "id": "elyra_inputCategoryHeader",
  266. "class_name": "elyra_categoryHeader",
  267. "type": "textPanel",
  268. "label": {
  269. "default": "Inputs"
  270. }
  271. },
  272. {% for property in component.input_properties %}
  273. {
  274. "id": "elyra_{{ property.ref }}",
  275. "type": "controls",
  276. "parameter_refs": ["elyra_{{ property.ref }}"]
  277. },
  278. {% endfor %}
  279. {% endif %}
  280. {% if component.output_properties|length > 0 %}
  281. {
  282. "id": "elyra_outputCategoryHeader",
  283. "type": "textPanel",
  284. "class_name": "elyra_categoryHeader",
  285. "label": {
  286. "default": "Outputs"
  287. }
  288. },
  289. {% for property in component.output_properties %}
  290. {
  291. "id": "elyra_{{ property.ref }}",
  292. "type": "controls",
  293. "parameter_refs": ["elyra_{{ property.ref }}"]
  294. },
  295. {% endfor %}
  296. {% endif %}
  297. {% if (("mounted_volumes" not in elyra_property_collisions_list) or
  298. ("kubernetes_pod_annotations" not in elyra_property_collisions_list)) %}
  299. {
  300. "id": "elyra_other_propertiesCategoryHeader",
  301. "type": "textPanel",
  302. "class_name": "elyra_categoryHeader",
  303. "label": {
  304. "default": "Additional Properties"
  305. },
  306. "description": {
  307. "default": "Additional properties used by Elyra that are not given in the component definition.",
  308. "placement": "on_panel"
  309. }
  310. },
  311. {% endif %}
  312. {% if "mounted_volumes" not in elyra_property_collisions_list %}
  313. {
  314. "id": "elyra_mounted_volumes",
  315. "type": "controls",
  316. "parameter_refs": ["elyra_mounted_volumes"]
  317. },
  318. {% endif %}
  319. {% if "kubernetes_tolerations" not in elyra_property_collisions_list %}
  320. {
  321. "id": "elyra_kubernetes_tolerations",
  322. "type": "controls",
  323. "parameter_refs": ["elyra_kubernetes_tolerations"]
  324. },
  325. {% endif %}
  326. {% if "kubernetes_pod_annotations" not in elyra_property_collisions_list %}
  327. {
  328. "id": "elyra_kubernetes_pod_annotations",
  329. "type": "controls",
  330. "parameter_refs": ["elyra_kubernetes_pod_annotations"]
  331. },
  332. {% endif %}
  333. {% if "disallow_cached_output" not in elyra_property_collisions_list %}
  334. {
  335. "id": "elyra_disallow_cached_output",
  336. "type": "controls",
  337. "parameter_refs": ["elyra_disallow_cached_output"]
  338. },
  339. {% endif %}
  340. {
  341. "id": "elyra_component_sourceCategoryHeader",
  342. "type": "textPanel",
  343. "class_name": "elyra_categoryHeader",
  344. "label": {
  345. "default": "Component Source"
  346. }
  347. },
  348. {
  349. "id": "component_source",
  350. "type": "controls",
  351. "parameter_refs": ["component_source"]
  352. }
  353. ]
  354. }
  355. ]
  356. },
  357. "resources": {}
  358. }