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!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

wb-live-logs.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { h, Component } from 'preact';
  2. import makeArvadosRequest from 'make-arvados-request';
  3. class WBLiveLogs extends Component {
  4. componentDidMount() {
  5. this.fetchData();
  6. }
  7. componentWillReceiveProps(nextProps) {
  8. if (nextProps.uuid === this.props.uuid);
  9. return;
  10. this.props = nextProps;
  11. this.fetchData();
  12. }
  13. fetchData() {
  14. const { uuid, app } = this.props;
  15. const { arvHost, arvToken } = app.state;
  16. const filters = [
  17. [ 'object_uuid', '=', uuid ]
  18. ];
  19. let prom = makeArvadosRequest(arvHost, arvToken,
  20. '/arvados/v1/logs?filters=' + encodeURIComponent(JSON.stringify(filters)));
  21. prom = prom.then(xhr => {
  22. const { items } = xhr.response;
  23. this.setState({
  24. content: items.filter(a => ('text' in a.properties)).map(a => a.properties.text.trim()).join('\n')
  25. });
  26. });
  27. }
  28. render({}, { content }) {
  29. return (
  30. <div>
  31. <a href="#" onclick={ e => {
  32. e.preventDefault();
  33. this.fetchData();
  34. } }>Refresh</a>
  35. <pre class="word-warp terminal">
  36. { content }
  37. </pre>
  38. </div>
  39. );
  40. }
  41. }
  42. export default WBLiveLogs;