|
@@ -1,16 +1,81 @@ |
|
|
import { h, Component } from 'preact';
|
|
|
import { h, Component } from 'preact';
|
|
|
import WBNavbarCommon from 'wb-navbar-common';
|
|
|
import WBNavbarCommon from 'wb-navbar-common';
|
|
|
import WBArvadosCrumbs from 'wb-arvados-crumbs';
|
|
|
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';
|
|
|
|
|
|
|
|
|
class WBProcessView extends Component {
|
|
|
class WBProcessView extends Component {
|
|
|
render({ app, uuid }) {
|
|
|
|
|
|
|
|
|
constructor(...args) {
|
|
|
|
|
|
super(...args);
|
|
|
|
|
|
this.state.objectUrls = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
let { arvHost, arvToken } = this.props.app.state;
|
|
|
|
|
|
let prom = makeArvadosRequest(arvHost, arvToken,
|
|
|
|
|
|
'/arvados/v1/container_requests/' + this.props.uuid);
|
|
|
|
|
|
let req;
|
|
|
|
|
|
let cont;
|
|
|
|
|
|
prom = prom.then(xhr => {
|
|
|
|
|
|
req = xhr.response;
|
|
|
|
|
|
if (req.container_uuid) {
|
|
|
|
|
|
let prom_1 = makeArvadosRequest(arvHost, arvToken,
|
|
|
|
|
|
'/arvados/v1/containers/' + req.container_uuid);
|
|
|
|
|
|
prom_1 = prom_1.then(xhr => (cont = xhr.response));
|
|
|
|
|
|
return prom_1;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//prom = prom.then(xhr => (cont = xhr.response));
|
|
|
|
|
|
prom = prom.then(() => {
|
|
|
|
|
|
let uuids = detectUuids([ req, cont ]);
|
|
|
|
|
|
let objectTypes = uuids.map(u => arvadosTypeName(u.split('-')[1]) + '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 = objects.map(o => urlForObject(o));
|
|
|
|
|
|
this.setState({ 'objectUrls': urls });
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render({ app, uuid }, { objectUrls }) {
|
|
|
return (
|
|
|
return (
|
|
|
<div>
|
|
|
<div>
|
|
|
<WBNavbarCommon app={ app } />
|
|
|
<WBNavbarCommon app={ app } />
|
|
|
|
|
|
|
|
|
<WBArvadosCrumbs app={ app } uuid={ uuid } />
|
|
|
<WBArvadosCrumbs app={ app } uuid={ uuid } />
|
|
|
|
|
|
|
|
|
<div class="my-2">This is the process view for { uuid }</div>
|
|
|
|
|
|
|
|
|
<div class="my-2">
|
|
|
|
|
|
This is the process view for { uuid }
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<a href="/browse">Click here</a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<ul>
|
|
|
|
|
|
{ objectUrls.map(url => (
|
|
|
|
|
|
<li><a href={ url }>{ url }</a></li>
|
|
|
|
|
|
)) }
|
|
|
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|