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!
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

wb-process-dashboard.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { h, Component } from 'preact';
  2. import makeArvadosRequest from 'make-arvados-request';
  3. function getAll(makeRequest) {
  4. let prom = makeRequest(0);
  5. prom = prom.then(xhr => {
  6. const { items, limit, items_available } = xhr.response;
  7. let res = [].concat(items);
  8. let prom_1 = new Promise(accept => accept());
  9. for (let ofs = limit; ofs < items_available; ofs += limit) {
  10. prom_1 = prom_1.then(() => makeRequest(ofs));
  11. prom_1 = prom_1.then(xhr_1 => {
  12. res = res.concat(xhr_1.response.items);
  13. });
  14. }
  15. prom_1 = prom_1.then(() => res);
  16. return prom_1;
  17. });
  18. return prom;
  19. }
  20. class WBProcessDashboard extends Component {
  21. fetchData() {
  22. const { app, uuid } = this.props;
  23. const { arvHost, arvToken } = app.state;
  24. let prom = new Promise(accept => accept());
  25. if (uuid) {
  26. prom = prom.then(() => {
  27. return makeArvadosRequest(arvHost, arvToken,
  28. '/arvados/v1/container_requests/' + encodeURIComponent(uuid));
  29. });
  30. prom = prom.then(xhr => {
  31. const cr = xhr.response;
  32. return makeArvadosRequest(arvHost, arvToken,
  33. '/arvados/v1/containers/' + encodeURIComponent(cr.container_uuid));
  34. });
  35. prom = prom.then(xhr => {
  36. const c = xhr.response;
  37. const filters = [ [ 'requesting_container_uuid', '=', c.uuid ] ];
  38. return makeArvadosRequest(arvHost, arvToken,
  39. '/arvados/v1/container_requests?filters=' +
  40. encodeURIComponent(JSON.stringify(filters)));
  41. });
  42. } else {
  43. prom = prom.then(() => {
  44. return makeArvadosRequest(arvHost, arvToken,
  45. '/arvados/v1/container_requests');
  46. });
  47. }
  48. }
  49. render() {
  50. }
  51. }