From e92f70b6ad488be1d0f754669a7bf606a718fe67 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Thu, 6 Feb 2020 08:55:24 +0100 Subject: [PATCH] Added WBWorkflowView. --- .../src/js/component/wb-workflow-fields.js | 99 +++++++++++++++++++ frontend/src/js/misc/url-for-object.js | 2 +- frontend/src/js/page/wb-app.js | 3 + frontend/src/js/page/wb-workflow-view.js | 29 ++++++ 4 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 frontend/src/js/component/wb-workflow-fields.js create mode 100644 frontend/src/js/page/wb-workflow-view.js diff --git a/frontend/src/js/component/wb-workflow-fields.js b/frontend/src/js/component/wb-workflow-fields.js new file mode 100644 index 0000000..b84f786 --- /dev/null +++ b/frontend/src/js/component/wb-workflow-fields.js @@ -0,0 +1,99 @@ +import { h, Component } from 'preact'; +import WBTable from 'wb-table'; +import makeArvadosRequest from 'make-arvados-request'; +import WBAccordion from 'wb-accordion'; + +class WBWorkflowFields extends Component { + componentDidMount() { + this.prepareRows(); + } + + componentWillReceiveProps(nextProps) { + this.props = nextProps; + this.prepareRows(); + } + + prepareRows() { + let { uuid, app } = this.props; + let { arvHost, arvToken } = app.state; + + let prom = makeArvadosRequest(arvHost, arvToken, + '/arvados/v1/workflows/' + uuid); + + prom = prom.then(xhr => { + const item = xhr.response; + const definition = JSON.parse(item.definition); + const graph = definition['$graph']; + + let rows = [ + [ 'Name', item.name ], + [ 'Description', item.description || ({ String(item.description) }) ], + [ 'CWL Version', definition.cwlVersion ], + ]; + + let keys = graph.map(it => it.id); + keys.sort(); + keys = keys.splice(keys.indexOf('#main'), 1).concat(keys); + + keys.map(k => { + const it = graph.find(it => (it.id === k)); + rows.push([ + it.id, ( +
+
Class: { it['class'] }
+ { it.label ?
Label: { it.label }
: null } + { it.doc ?
Doc: { it.doc }
: null } + + +
{ JSON.stringify(it.inputs, null, 2) }
+ +
{ JSON.stringify(it.outputs, null, 2) }
+ + { (() => { + delete it['inputs']; + delete it['outputs']; + delete it['class']; + delete it['label']; + delete it['doc']; + delete it['id']; + return ( +
{ JSON.stringify(it, null, 2) }
+ ); + })() } + +
+
+ )]); + }); + + /* [ 'Graph', ( + it.id) } + cardHeaderClass="card-header-sm"> + + { graph.map(it => ( +
{ JSON.stringify(it, null, 2) }
+ )) } + +
+ ) ] + ];*/ + this.setState({ 'rows': rows }); + }); + } + + render({}, { rows }) { + return ( + rows ? ( + + ) : ( +
Loading...
+ ) + ); + } +} + +export default WBWorkflowFields; diff --git a/frontend/src/js/misc/url-for-object.js b/frontend/src/js/misc/url-for-object.js index 31c17e1..9212278 100644 --- a/frontend/src/js/misc/url-for-object.js +++ b/frontend/src/js/misc/url-for-object.js @@ -9,7 +9,7 @@ function urlForObject(item, mode='primary') { else if (objectType === 'container_request') return ('/process/' + item.uuid); else if (objectType === 'workflow') - return ('https://wb.arkau.roche.com/workflows/' + item.uuid); + return ('/workflow/' + item.uuid); else if (objectType === 'collection') { if (mode === 'primary' || mode === 'browse') return ('/collection-browse/' + item.uuid); diff --git a/frontend/src/js/page/wb-app.js b/frontend/src/js/page/wb-app.js index c2993fc..c2e214b 100644 --- a/frontend/src/js/page/wb-app.js +++ b/frontend/src/js/page/wb-app.js @@ -8,6 +8,7 @@ import WBProcessView from 'wb-process-view'; import WBCollectionView from 'wb-collection-view'; import WBCollectionBrowse from 'wb-collection-browse'; import WBUsersPage from 'wb-users-page'; +import WBWorkflowView from 'wb-workflow-view'; import arvadosTypeName from 'arvados-type-name'; class WBApp extends Component { @@ -61,6 +62,8 @@ class WBApp extends Component { + + ); } diff --git a/frontend/src/js/page/wb-workflow-view.js b/frontend/src/js/page/wb-workflow-view.js new file mode 100644 index 0000000..a3a4aab --- /dev/null +++ b/frontend/src/js/page/wb-workflow-view.js @@ -0,0 +1,29 @@ +import { h, Component } from 'preact'; +import WBNavbarCommon from 'wb-navbar-common'; +import WBArvadosCrumbs from 'wb-arvados-crumbs'; +import WBCommonFields from 'wb-common-fields'; +import WBWorkflowFields from 'wb-workflow-fields'; + +class WBWorkflowView extends Component { + render({ app, uuid }, {}) { + return ( +
+ + + + +
+ This is the workflow view for { uuid } +
+ +

Common Fields

+ + +

Workflow Fields

+ +
+ ); + } +} + +export default WBWorkflowView;