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; let definition; try { definition = JSON.parse(item.definition); } catch (_) { definition = jsyaml.load(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, (
{ 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) }); })() }
{ JSON.stringify(it, null, 2) })) }