|
|
@@ -1,6 +1,7 @@ |
|
|
|
import { h, Component } from 'preact';
|
|
|
|
import WBTable from 'wb-table';
|
|
|
|
import makeArvadosRequest from 'make-arvados-request';
|
|
|
|
import wbProcessStateName from 'wb-process-state-name';
|
|
|
|
|
|
|
|
function getAll(makeRequest) {
|
|
|
|
let prom = makeRequest(0);
|
|
|
@@ -20,23 +21,6 @@ function getAll(makeRequest) { |
|
|
|
return prom;
|
|
|
|
}
|
|
|
|
|
|
|
|
function determineState(containerRequest) {
|
|
|
|
const cr = containerRequest;
|
|
|
|
const c = cr.container;
|
|
|
|
if (cr.state !== 'Uncommitted' && cr.priority === 0)
|
|
|
|
return 'Cancelled';
|
|
|
|
if (cr.state === 'Uncommitted' || !c || 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';
|
|
|
|
}
|
|
|
|
|
|
|
|
class WBProcessDashboard extends Component {
|
|
|
|
constructor(...args) {
|
|
|
|
super(...args);
|
|
|
@@ -85,7 +69,7 @@ class WBProcessDashboard extends Component { |
|
|
|
});
|
|
|
|
prom = prom.then(cl => {
|
|
|
|
cl.map(a => (crlist.find(b => (b.container_uuid === a.uuid)).container = a));
|
|
|
|
crlist.map(a => (a.wb_state = determineState(a)));
|
|
|
|
crlist.map(a => (a.wb_state = wbProcessStateName(a, a.container)));
|
|
|
|
const stats = {};
|
|
|
|
for (let state in { 'Pending': 1, 'Running': 1, 'Complete': 1, 'Failed': 1, 'Cancelled': 1 }) {
|
|
|
|
const f = crlist.filter(a => (a.wb_state === state));
|
|
|
|