|
|
@@ -2,15 +2,10 @@ import { h, Component } from 'preact'; |
|
|
|
import WBNavbarCommon from 'wb-navbar-common';
|
|
|
|
import WBArvadosCrumbs from 'wb-arvados-crumbs';
|
|
|
|
import makeArvadosRequest from 'make-arvados-request';
|
|
|
|
import detectUuids from 'detect-uuids';
|
|
|
|
import arvadosTypeName from 'arvados-type-name';
|
|
|
|
import urlForObject from 'url-for-object';
|
|
|
|
import detectHashes from 'detect-hashes';
|
|
|
|
import WBCommonFields from 'wb-common-fields';
|
|
|
|
import WBContainerRequestFields from 'wb-container-request-fields';
|
|
|
|
import WBProcessListing from 'wb-process-listing';
|
|
|
|
import WBProcessDashboard from 'wb-process-dashboard';
|
|
|
|
import wbFetchObjects from 'wb-fetch-objects';
|
|
|
|
|
|
|
|
class WBProcessView extends Component {
|
|
|
|
constructor(...args) {
|
|
|
@@ -39,55 +34,8 @@ class WBProcessView extends Component { |
|
|
|
return prom_1;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
//prom = prom.then(xhr => (cont = xhr.response));
|
|
|
|
prom = prom.then(() => {
|
|
|
|
let hashes = detectHashes([ req, cont ]);
|
|
|
|
let filters = [
|
|
|
|
[ 'portable_data_hash', 'in', hashes ]
|
|
|
|
];
|
|
|
|
return makeArvadosRequest(arvHost, arvToken,
|
|
|
|
'/arvados/v1/collections?filters=' +
|
|
|
|
encodeURIComponent(JSON.stringify(filters)));
|
|
|
|
});
|
|
|
|
prom = prom.then(xhr => {
|
|
|
|
let colUuids = xhr.response['items'].map(item => item.uuid);
|
|
|
|
let uuids = detectUuids([ req, cont ]);
|
|
|
|
let dict = {};
|
|
|
|
colUuids.map(u => (dict[u] = true));
|
|
|
|
uuids.map(u => (dict[u] = true));
|
|
|
|
return Object.keys(dict);
|
|
|
|
});
|
|
|
|
prom = prom.then(uuids => wbFetchObjects(arvHost, arvToken, uuids));
|
|
|
|
/* prom = prom.then(() => {
|
|
|
|
// let uuids = detectUuids([ req, cont ]);
|
|
|
|
let objectTypes = uuids.map(u => arvadosTypeName(u) + 's');
|
|
|
|
//objectTypes = objectTypes.filter(ot => ot);
|
|
|
|
//objectTypes = objectTypes.map(ot => ot + 's');
|
|
|
|
let objQueries = {};
|
|
|
|
objectTypes.map(t => (objQueries[t] = []));
|
|
|
|
uuids.map((u, idx) => (objQueries[objectTypes[idx]].push(u)));
|
|
|
|
let prom_1 = new Promise(accept => accept());
|
|
|
|
let objects = [];
|
|
|
|
// delete objQueries['users'];
|
|
|
|
delete objQueries['api_clients'];
|
|
|
|
for (let k in objQueries) {
|
|
|
|
let filters = [
|
|
|
|
['uuid', 'in', objQueries[k]]
|
|
|
|
];
|
|
|
|
prom_1 = prom_1.then(() => makeArvadosRequest(arvHost, arvToken,
|
|
|
|
'/arvados/v1/' + k + '?filters=' +
|
|
|
|
encodeURIComponent(JSON.stringify(filters))));
|
|
|
|
prom_1 = prom_1.then(xhr => (objects = objects.concat(xhr.response['items'])));
|
|
|
|
}
|
|
|
|
prom_1 = prom_1.then(() => objects);
|
|
|
|
return prom_1;
|
|
|
|
}); */
|
|
|
|
prom = prom.then(objects => {
|
|
|
|
// let objDict = {};
|
|
|
|
// objects.map(o => (objDict[o['uuid']] = o));
|
|
|
|
let urls = Object.values(objects).map(o => urlForObject(o));
|
|
|
|
this.setState({
|
|
|
|
'objectUrls': urls,
|
|
|
|
'request': req,
|
|
|
|
'container': cont
|
|
|
|
});
|
|
|
@@ -104,7 +52,7 @@ class WBProcessView extends Component { |
|
|
|
this.fetchData();
|
|
|
|
}
|
|
|
|
|
|
|
|
render({ app, uuid, page }, { objectUrls, container }) {
|
|
|
|
render({ app, uuid, page }, { container }) {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<WBNavbarCommon app={ app } />
|
|
|
@@ -132,15 +80,6 @@ class WBProcessView extends Component { |
|
|
|
itemsPerPage="20"
|
|
|
|
activePage={ Number(page || 0) }
|
|
|
|
getPageUrl={ page => this.getUrl({ page }) } />
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<a href="/browse">Click here</a>
|
|
|
|
</div>
|
|
|
|
<ul>
|
|
|
|
{ objectUrls.map(url => (
|
|
|
|
<li><a href={ url }>{ url }</a></li>
|
|
|
|
)) }
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|