// // Copyright (C) Stanislaw Adaszewski, 2020 // Contact: s.adaszewski@gmail.com // Website: https://adared.ch/wba // License: GNU Affero General Public License, Version 3 // function wbProcessStateName(containerRequest, container) { const cr = containerRequest; const c = container; if (!c) return cr.state; if (cr.state !== 'Uncommitted' && cr.priority === 0) return 'Cancelled'; if (cr.state === 'Uncommitted' || !cr.container_uuid || c.state === 'Queued' || c.state === 'Locked') return 'Pending'; if (c.state === 'Running') return 'Running'; if (c.state === 'Complete' && c.exit_code === 0) return 'Complete'; if (c.state === 'Complete' && c.exit_code !== 0) return 'Failed'; if (c.state === 'Cancelled') return 'Cancelled'; } export default wbProcessStateName;