IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wb-workflow-fields.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import { h, Component } from 'preact';
  2. import WBTable from 'wb-table';
  3. import makeArvadosRequest from 'make-arvados-request';
  4. import WBAccordion from 'wb-accordion';
  5. class WBWorkflowFields extends Component {
  6. componentDidMount() {
  7. this.prepareRows();
  8. }
  9. componentWillReceiveProps(nextProps) {
  10. this.props = nextProps;
  11. this.prepareRows();
  12. }
  13. prepareRows() {
  14. let { uuid, app } = this.props;
  15. let { arvHost, arvToken } = app.state;
  16. let prom = makeArvadosRequest(arvHost, arvToken,
  17. '/arvados/v1/workflows/' + uuid);
  18. prom = prom.then(xhr => {
  19. const item = xhr.response;
  20. let definition;
  21. try {
  22. definition = JSON.parse(item.definition);
  23. } catch (_) {
  24. definition = jsyaml.load(item.definition);
  25. }
  26. const graph = definition['$graph'];
  27. let rows = [
  28. [ 'Name', item.name ],
  29. [ 'Description', item.description || (<i>{ String(item.description) }</i>) ],
  30. [ 'CWL Version', definition.cwlVersion ],
  31. ];
  32. let keys = graph.map(it => it.id);
  33. keys.sort();
  34. keys = keys.splice(keys.indexOf('#main'), 1).concat(keys);
  35. keys.map(k => {
  36. const it = graph.find(it => (it.id === k));
  37. rows.push([
  38. it.id, (
  39. <div>
  40. <div>Class: { it['class'] }</div>
  41. { it.label ? <div>Label: { it.label }</div> : null }
  42. { it.doc ? <div>Doc: { it.doc }</div> : null }
  43. <WBAccordion names={ [ 'Inputs', 'Outputs', 'Rest' ] }
  44. cardHeaderClass="card-header-sm">
  45. <pre class="word-wrap">{ JSON.stringify(it.inputs, null, 2) }</pre>
  46. <pre class="word-wrap">{ JSON.stringify(it.outputs, null, 2) }</pre>
  47. { (() => {
  48. delete it['inputs'];
  49. delete it['outputs'];
  50. delete it['class'];
  51. delete it['label'];
  52. delete it['doc'];
  53. delete it['id'];
  54. return (
  55. <pre class="word-wrap">{ JSON.stringify(it, null, 2) }</pre>
  56. );
  57. })() }
  58. </WBAccordion>
  59. </div>
  60. )]);
  61. });
  62. /* [ 'Graph', (
  63. <WBAccordion names={ graph.map(it => it.id) }
  64. cardHeaderClass="card-header-sm">
  65. { graph.map(it => (
  66. <pre class="word-wrap">{ JSON.stringify(it, null, 2) }</pre>
  67. )) }
  68. </WBAccordion>
  69. ) ]
  70. ];*/
  71. this.setState({ 'rows': rows });
  72. });
  73. }
  74. render({}, { rows }) {
  75. return (
  76. rows ? (
  77. <WBTable columns={ [ "Name", "Value" ] }
  78. headerClasses={ [ "col-sm-2", "col-sm-4" ] }
  79. rows={ rows }
  80. verticalHeader={ true } />
  81. ) : (
  82. <div>Loading...</div>
  83. )
  84. );
  85. }
  86. }
  87. export default WBWorkflowFields;