diff --git a/frontend/src/js/component/wb-collection-fields.js b/frontend/src/js/component/wb-collection-fields.js index 7f2d93a..e660eb5 100644 --- a/frontend/src/js/component/wb-collection-fields.js +++ b/frontend/src/js/component/wb-collection-fields.js @@ -22,12 +22,17 @@ class WBCollectionFields extends Component { let { uuid, app } = this.props; let { arvHost, arvToken } = app.state; - let item; + const filters = [ + ['uuid', '=', uuid] + ]; + let prom = makeArvadosRequest(arvHost, arvToken, - '/arvados/v1/collections/' + uuid); - prom = prom.then(xhr => (item = xhr.response)); + '/arvados/v1/collections?filters=' + encodeURIComponent(JSON.stringify(filters))); - prom = prom.then(() => { + prom = prom.then(xhr => { + const item = xhr.response.items[0]; + if (!item) + throw Error('Item not found'); let rows = [ [ 'Name', item.name ], [ 'Description', item.description || ({ String(item.description) }) ], diff --git a/frontend/src/js/component/wb-common-fields.js b/frontend/src/js/component/wb-common-fields.js index 65bf0ce..d895bdc 100644 --- a/frontend/src/js/component/wb-common-fields.js +++ b/frontend/src/js/component/wb-common-fields.js @@ -22,17 +22,18 @@ class WBCommonFields extends Component { let { uuid, app } = this.props; let { arvHost, arvToken } = app.state; - let item; - let owner; - let modifiedByUser; + const filters = [ + ['uuid', '=', uuid] + ]; let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/' + arvadosTypeName(uuid) + - 's/' + uuid); + 's?filters=' + encodeURIComponent(JSON.stringify(filters))); - prom = prom.then(xhr => (item = xhr.response)); - - prom = prom.then(() => { + prom = prom.then(xhr => { + const item = xhr.response.items[0]; + if (!item) + throw Error('Item not found'); let rows = [ [ 'UUID', item.uuid ], [ 'Kind', item.kind ], diff --git a/frontend/src/js/component/wb-name-and-uuid.js b/frontend/src/js/component/wb-name-and-uuid.js index 4f1eaf8..4d02be5 100644 --- a/frontend/src/js/component/wb-name-and-uuid.js +++ b/frontend/src/js/component/wb-name-and-uuid.js @@ -45,14 +45,26 @@ class WBNameAndUuid extends Component { } else if (/[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}/.exec(uuid)) { let typeName = arvadosTypeName(uuid); + const filters = [ + ['uuid', '=', uuid] + ]; let prom = makeArvadosRequest(arvHost, arvToken, - '/arvados/v1/' + typeName + 's/' + uuid ); - prom = prom.then(xhr => this.setState({ - 'item': xhr.response - })); - prom = prom.catch(xhr => this.setState({ - 'error': 'Unable to retrieve: ' + xhr.status + ' (' + xhr.statusText + ')' - })); + '/arvados/v1/' + typeName + + 's?filters=' + encodeURIComponent(JSON.stringify(filters))); + prom = prom.then(xhr => { + const item = xhr.response.items[0]; + if (!item) + this.setState({ 'error': 'Item not found' }); + else + this.setState({ + 'item': item + }); + }); + prom = prom.catch(xhr => { + this.setState({ + 'error': 'Unable to retrieve: ' + xhr.status + ' (' + xhr.statusText + ')' + }); + }); } else { this.setState({ diff --git a/frontend/src/js/misc/fetch-project-parents.js b/frontend/src/js/deprecated/fetch-project-parents.js similarity index 100% rename from frontend/src/js/misc/fetch-project-parents.js rename to frontend/src/js/deprecated/fetch-project-parents.js diff --git a/frontend/src/js/component/wb-project-crumbs.js b/frontend/src/js/deprecated/wb-project-crumbs.js similarity index 100% rename from frontend/src/js/component/wb-project-crumbs.js rename to frontend/src/js/deprecated/wb-project-crumbs.js diff --git a/frontend/src/js/misc/fetch-object-parents.js b/frontend/src/js/misc/fetch-object-parents.js index 65a06fe..ea1d1c9 100644 --- a/frontend/src/js/misc/fetch-object-parents.js +++ b/frontend/src/js/misc/fetch-object-parents.js @@ -1,46 +1,41 @@ import makeArvadosRequest from 'make-arvados-request'; import arvadosTypeName from 'arvados-type-name'; +import arvadosObjectName from 'arvados-object-name'; function fetchObjectParents(arvHost, arvToken, uuid) { let parents = []; let cb = xhr => { - let objectType = arvadosTypeName(xhr.response['uuid'].split('-')[1]); - - let item = { - 'uuid': xhr.response['uuid'] - }; - - if (objectType === 'user') { - item['name'] = xhr.response['first_name'] + ' ' + xhr.response['last_name']; - - } else { - item['name'] = xhr.response['name']; - } - - if (objectType === 'group') { - item['group_class'] = xhr.response['group_class']; - } + const item = xhr.response.items[0]; + if (!item) + return parents.reverse(); + item.name = arvadosObjectName(item); parents.push(item); - if (!xhr.response['owner_uuid'] || - xhr.response['owner_uuid'].endsWith('-tpzed-000000000000000')) { + if (!item.owner_uuid || + item.owner_uuid.endsWith('-tpzed-000000000000000')) { return parents.reverse(); } - objectType = arvadosTypeName(xhr.response['owner_uuid'].split('-')[1]); + const objectType = arvadosTypeName(item.owner_uuid); + const filters = [ + ['uuid', '=', item.owner_uuid] + ]; return makeArvadosRequest(arvHost, arvToken, '/arvados/v1/' + objectType + 's' + - '/' + xhr.response['owner_uuid']).then(cb); + '?filters=' + encodeURIComponent(JSON.stringify(filters))).then(cb); }; - let objectType = arvadosTypeName(uuid.split('-')[1]); + const objectType = arvadosTypeName(uuid); + const filters = [ + ['uuid', '=', uuid] + ]; let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/' + objectType + 's' + - '/' + uuid); + '?filters=' + encodeURIComponent(JSON.stringify(filters))); prom = prom.then(cb); return prom; diff --git a/frontend/src/js/page/wb-browse.js b/frontend/src/js/page/wb-browse.js index a552abe..4a8506c 100644 --- a/frontend/src/js/page/wb-browse.js +++ b/frontend/src/js/page/wb-browse.js @@ -3,7 +3,7 @@ import { route } from 'preact-router'; import WBNavbarCommon from 'wb-navbar-common'; import WBProjectListing from 'wb-project-listing'; import WBInlineSearch from 'wb-inline-search'; -import WBProjectCrumbs from 'wb-project-crumbs'; +import WBArvadosCrumbs from 'wb-arvados-crumbs'; import WBTabs from 'wb-tabs'; import WBProcessListing from 'wb-process-listing'; import WBCollectionListing from 'wb-collection-listing'; @@ -34,8 +34,7 @@ class WBBrowse extends Component { - route('/browse/' + item['uuid']) } /> + @@ -73,7 +72,7 @@ class WBBrowse extends Component { itemsPerPage="20" page={ Number(workflowPage || 0) } getPageUrl={ i => this.getUrl({ 'workflowPage': i }) } /> - + ) : null)) }