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!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wb-process-state.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { h, Component } from 'preact';
  2. import makeArvadosRequest from 'make-arvados-request';
  3. class WBProcessState extends Component {
  4. componentDidMount() {
  5. this.fetchData();
  6. }
  7. componentWillReceiveProps(nextProps) {
  8. this.props = nextProps;
  9. this.fetchData();
  10. }
  11. fetchData() {
  12. const { app, process } = this.props;
  13. const { arvHost, arvToken } = app.state;
  14. if (!process.container_uuid)
  15. return;
  16. let prom = makeArvadosRequest(arvHost, arvToken,
  17. '/arvados/v1/containers/' + process.container_uuid);
  18. prom = prom.then(xhr => this.setState({ 'container': xhr.response }));
  19. prom = prom.catch(() => this.setState({ 'apiError': 'Failed to fetch container' }));
  20. }
  21. render({ process }, { container, apiError }) {
  22. const runtimeStatus = container ? container.runtime_status : null;
  23. const error = runtimeStatus ? runtimeStatus.error : null;
  24. const warning = runtimeStatus ? runtimeStatus.warning : null;
  25. return (
  26. <div>
  27. { process.state }
  28. { apiError ? <i>{ [ ' / ', apiError ] }</i> : null }
  29. { container ? [ " / ", container.state ] : null }
  30. { !(error || warning) && container && container.state === 'Complete' ? " / Success" : null }
  31. { error ? [" / ", <a href={ '/container/' + container.uuid }
  32. title={ error }>E</a> ] : null }
  33. { warning ? [ " / ", <a href={ '/container/' + container.uuid }
  34. title={ warning }>W</a> ] : null }
  35. </div>
  36. );
  37. }
  38. }
  39. export default WBProcessState;