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.

28 lines
843B

  1. //
  2. // Copyright (C) Stanislaw Adaszewski, 2020
  3. // Contact: s.adaszewski@gmail.com
  4. // Website: https://adared.ch/wba
  5. // License: GNU Affero General Public License, Version 3
  6. //
  7. function wbProcessStateName(containerRequest, container) {
  8. const cr = containerRequest;
  9. const c = container;
  10. if (!c)
  11. return cr.state;
  12. if (cr.state !== 'Uncommitted' && cr.priority === 0)
  13. return 'Cancelled';
  14. if (cr.state === 'Uncommitted' || !cr.container_uuid || c.state === 'Queued' || c.state === 'Locked')
  15. return 'Pending';
  16. if (c.state === 'Running')
  17. return 'Running';
  18. if (c.state === 'Complete' && c.exit_code === 0)
  19. return 'Complete';
  20. if (c.state === 'Complete' && c.exit_code !== 0)
  21. return 'Failed';
  22. if (c.state === 'Cancelled')
  23. return 'Cancelled';
  24. }
  25. export default wbProcessStateName;