|
@@ -4,6 +4,9 @@ import makeArvadosRequest from 'make-arvados-request'; |
|
|
import WBTable from 'wb-table';
|
|
|
import WBTable from 'wb-table';
|
|
|
import WBPagination from 'wb-pagination';
|
|
|
import WBPagination from 'wb-pagination';
|
|
|
import WBCheckboxes from 'wb-checkboxes';
|
|
|
import WBCheckboxes from 'wb-checkboxes';
|
|
|
|
|
|
import wbFormatDate from 'wb-format-date';
|
|
|
|
|
|
import wbFetchObjects from 'wb-fetch-objects';
|
|
|
|
|
|
import WBNameAndUuid from 'wb-name-and-uuid';
|
|
|
|
|
|
|
|
|
class WBProcessListing extends Component {
|
|
|
class WBProcessListing extends Component {
|
|
|
|
|
|
|
|
@@ -21,22 +24,28 @@ class WBProcessListing extends Component { |
|
|
this.fetchItems();
|
|
|
this.fetchItems();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
prepareRows(items) {
|
|
|
|
|
|
|
|
|
prepareRows(requests, containerLookup, ownerLookup, outputLookup) {
|
|
|
const { renderRenameLink, renderDeleteButton } = this.props;
|
|
|
const { renderRenameLink, renderDeleteButton } = this.props;
|
|
|
return items.map(item => [
|
|
|
|
|
|
|
|
|
return requests.map(item => [
|
|
|
(<div>
|
|
|
(<div>
|
|
|
<div>
|
|
|
<div>
|
|
|
<a href="#"
|
|
|
|
|
|
onclick={ e => { e.preventDefault(); route('/process/' + item['uuid']) }}>
|
|
|
|
|
|
|
|
|
<a href={ '/process/' + item['uuid'] }>
|
|
|
{ item['name'] }
|
|
|
{ item['name'] }
|
|
|
</a> { renderRenameLink(item, () => this.fetchItems()) }
|
|
|
</a> { renderRenameLink(item, () => this.fetchItems()) }
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>{ item['uuid'] }</div>
|
|
|
<div>{ item['uuid'] }</div>
|
|
|
</div>),
|
|
|
</div>),
|
|
|
item['state'],
|
|
|
|
|
|
item['owner_uuid'],
|
|
|
|
|
|
item['created_at'].replace('T', ' ').substr(0, item['created_at'].length - 11) + '',
|
|
|
|
|
|
item['output_uuid'],
|
|
|
|
|
|
|
|
|
( <div>
|
|
|
|
|
|
<div>{ item['state'] } /</div>
|
|
|
|
|
|
<div>{ item.container_uuid ?
|
|
|
|
|
|
item.container_uuid in containerLookup ?
|
|
|
|
|
|
containerLookup[item.container_uuid].state :
|
|
|
|
|
|
"Container Not Found" :
|
|
|
|
|
|
<i>{ String(item.container_uuid) }</i> }</div>
|
|
|
|
|
|
</div> ),
|
|
|
|
|
|
( <WBNameAndUuid uuid={ item['owner_uuid'] } lookup={ ownerLookup } /> ),
|
|
|
|
|
|
wbFormatDate(item['created_at']),
|
|
|
|
|
|
( <WBNameAndUuid uuid={ item['output_uuid'] } lookup={ outputLookup } /> ),
|
|
|
(<div>
|
|
|
(<div>
|
|
|
{ renderDeleteButton(item, () => this.fetchItems()) }
|
|
|
{ renderDeleteButton(item, () => this.fetchItems()) }
|
|
|
</div>)
|
|
|
</div>)
|
|
@@ -44,21 +53,68 @@ class WBProcessListing extends Component { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
fetchItems() {
|
|
|
fetchItems() {
|
|
|
let { arvHost, arvToken } = this.props.appState;
|
|
|
|
|
|
let i = this.props.activePage;
|
|
|
|
|
|
let filters = [
|
|
|
|
|
|
[ 'state', 'in', this.state.requestStates.filter((_, idx) => this.state.reqStateMask[idx]) ]
|
|
|
|
|
|
|
|
|
const { arvHost, arvToken } = this.props.appState;
|
|
|
|
|
|
const { requestStates, reqStateMask } = this.state;
|
|
|
|
|
|
const { activePage, itemsPerPage, ownerUuid,
|
|
|
|
|
|
requestingContainerUuid } = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
const filters = [
|
|
|
|
|
|
[ 'state', 'in', requestStates.filter((_, idx) => reqStateMask[idx]) ]
|
|
|
];
|
|
|
];
|
|
|
if (this.props.ownerUuid)
|
|
|
|
|
|
filters.push([ 'owner_uuid', '=', this.props.ownerUuid ]);
|
|
|
|
|
|
|
|
|
if (ownerUuid)
|
|
|
|
|
|
filters.push([ 'owner_uuid', '=', ownerUuid ]);
|
|
|
|
|
|
//if (requestingContainerUuid)
|
|
|
|
|
|
//filters.push([ 'requesting_container_uuid', '=', requestingContainerUuid ]);
|
|
|
|
|
|
|
|
|
let prom = makeArvadosRequest(arvHost, arvToken,
|
|
|
let prom = makeArvadosRequest(arvHost, arvToken,
|
|
|
'/arvados/v1/container_requests?filters=' + encodeURIComponent(JSON.stringify(filters)) +
|
|
|
'/arvados/v1/container_requests?filters=' + encodeURIComponent(JSON.stringify(filters)) +
|
|
|
'&limit=' + encodeURIComponent(this.props.itemsPerPage) +
|
|
|
|
|
|
'&offset=' + encodeURIComponent(this.props.itemsPerPage * i));
|
|
|
|
|
|
prom = prom.then(xhr =>
|
|
|
|
|
|
|
|
|
'&limit=' + itemsPerPage +
|
|
|
|
|
|
'&offset=' + (itemsPerPage * activePage));
|
|
|
|
|
|
|
|
|
|
|
|
let requests;
|
|
|
|
|
|
let numPages;
|
|
|
|
|
|
prom = prom.then(xhr => {
|
|
|
|
|
|
requests = xhr.response.items;
|
|
|
|
|
|
numPages = Math.ceil(xhr.response['items_available'] / xhr.response['limit']);
|
|
|
|
|
|
/* container_uuids = requests.map(r => r.container_uuid);
|
|
|
|
|
|
container_uuids = container_uuids.filter(uuid => uuid);
|
|
|
|
|
|
const filters_1 = [
|
|
|
|
|
|
[ 'uuid', 'in', container_uuids ]
|
|
|
|
|
|
];
|
|
|
|
|
|
return makeArvadosRequest(arvHost, arvToken,
|
|
|
|
|
|
'/arvados/v1/containers?filters=' +
|
|
|
|
|
|
encodeURIComponent(JSON.stringify(filters_1)));*/
|
|
|
|
|
|
return wbFetchObjects(arvHost, arvToken,
|
|
|
|
|
|
requests.map(r => r.container_uuid).filter(uuid => uuid));
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let containerLookup;
|
|
|
|
|
|
prom = prom.then(lookup => {
|
|
|
|
|
|
containerLookup = lookup;
|
|
|
|
|
|
// const containers = xhr.response.items;
|
|
|
|
|
|
// containers.map(c => (containerLookup[c.uuid] = c));
|
|
|
|
|
|
return wbFetchObjects(arvHost, arvToken,
|
|
|
|
|
|
requests.map(r => r.owner_uuid).filter(uuid => uuid));
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let ownerLookup;
|
|
|
|
|
|
prom = prom.then(lookup => {
|
|
|
|
|
|
ownerLookup = lookup;
|
|
|
|
|
|
return wbFetchObjects(arvHost, arvToken,
|
|
|
|
|
|
requests.map(r => r.output_uuid).filter(uuid => uuid));
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let outputLookup;
|
|
|
|
|
|
prom = prom.then(lookup => (outputLookup = lookup));
|
|
|
|
|
|
|
|
|
|
|
|
// prom = prom.then(() => makeArvadosRequest(arvHost, arvToken,
|
|
|
|
|
|
// '/arvados/v1/'))
|
|
|
|
|
|
|
|
|
|
|
|
prom = prom.then(() =>
|
|
|
this.setState({
|
|
|
this.setState({
|
|
|
'numPages': Math.ceil(xhr.response['items_available'] / xhr.response['limit']),
|
|
|
|
|
|
'rows': this.prepareRows(xhr.response['items'])
|
|
|
|
|
|
|
|
|
'numPages': numPages,
|
|
|
|
|
|
'rows': this.prepareRows(requests, containerLookup,
|
|
|
|
|
|
ownerLookup, outputLookup)
|
|
|
}));
|
|
|
}));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@@ -81,7 +137,7 @@ class WBProcessListing extends Component { |
|
|
cssClass="float-left mx-2 my-2" title="Container State: "
|
|
|
cssClass="float-left mx-2 my-2" title="Container State: "
|
|
|
onChange={ () => this.fetchItems() } />
|
|
|
onChange={ () => this.fetchItems() } />
|
|
|
|
|
|
|
|
|
<WBTable columns={ [ 'Name', 'Status', 'Owner', 'Created At (UTC)', 'Output', 'Actions' ] }
|
|
|
|
|
|
|
|
|
<WBTable columns={ [ 'Name', 'Status', 'Owner', 'Created At', 'Output', 'Actions' ] }
|
|
|
rows={ rows } />
|
|
|
rows={ rows } />
|
|
|
|
|
|
|
|
|
<WBPagination numPages={ numPages }
|
|
|
<WBPagination numPages={ numPages }
|
|
|