From 12192c5b93fecd69e65f907a00d4d78d4b5f52d5 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Thu, 13 Feb 2020 18:58:13 +0100 Subject: [PATCH] Support for YAML workflow definitions. --- frontend/package.json | 1 + frontend/rollup.config.js | 1 + frontend/src/html/index.html | 1 + frontend/src/js/component/wb-workflow-fields.js | 7 ++++++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/package.json b/frontend/package.json index f2bd946..a8b1222 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,6 +7,7 @@ "history": "^4.10.1", "jquery": "^3.4.1", "js-uuid": "0.0.6", + "js-yaml": "^3.13.1", "linkstate": "^1.1.1", "popper.js": "^1.16.1", "preact": "^8.2.9", diff --git a/frontend/rollup.config.js b/frontend/rollup.config.js index 84d35a6..b69dcb1 100755 --- a/frontend/rollup.config.js +++ b/frontend/rollup.config.js @@ -46,6 +46,7 @@ export default { 'node_modules/crypto-js/core.js': 'dist/js/crypto-js/core.js', 'node_modules/crypto-js/md5.js': 'dist/js/crypto-js/md5.js', 'src/js/misc/wb-manifest-worker.js': 'dist/js/wb-manifest-worker.js', + 'node_modules/js-yaml/dist/js-yaml.min.js': 'dist/js/js-yaml.min.js', verbose: true }), buble({jsx: 'h'}), diff --git a/frontend/src/html/index.html b/frontend/src/html/index.html index 44421f6..4c23a3d 100755 --- a/frontend/src/html/index.html +++ b/frontend/src/html/index.html @@ -14,6 +14,7 @@ + diff --git a/frontend/src/js/component/wb-workflow-fields.js b/frontend/src/js/component/wb-workflow-fields.js index b84f786..9a45e27 100644 --- a/frontend/src/js/component/wb-workflow-fields.js +++ b/frontend/src/js/component/wb-workflow-fields.js @@ -22,7 +22,12 @@ class WBWorkflowFields extends Component { prom = prom.then(xhr => { const item = xhr.response; - const definition = JSON.parse(item.definition); + let definition; + try { + definition = JSON.parse(item.definition); + } catch (_) { + definition = jsyaml.load(item.definition); + } const graph = definition['$graph']; let rows = [