@@ -22,12 +22,17 @@ class WBCollectionFields extends Component { | |||||
let { uuid, app } = this.props; | let { uuid, app } = this.props; | ||||
let { arvHost, arvToken } = app.state; | let { arvHost, arvToken } = app.state; | ||||
let item; | |||||
const filters = [ | |||||
['uuid', '=', uuid] | |||||
]; | |||||
let prom = makeArvadosRequest(arvHost, arvToken, | 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 = [ | let rows = [ | ||||
[ 'Name', item.name ], | [ 'Name', item.name ], | ||||
[ 'Description', item.description || (<i>{ String(item.description) }</i>) ], | [ 'Description', item.description || (<i>{ String(item.description) }</i>) ], | ||||
@@ -22,17 +22,18 @@ class WBCommonFields extends Component { | |||||
let { uuid, app } = this.props; | let { uuid, app } = this.props; | ||||
let { arvHost, arvToken } = app.state; | let { arvHost, arvToken } = app.state; | ||||
let item; | |||||
let owner; | |||||
let modifiedByUser; | |||||
const filters = [ | |||||
['uuid', '=', uuid] | |||||
]; | |||||
let prom = makeArvadosRequest(arvHost, arvToken, | let prom = makeArvadosRequest(arvHost, arvToken, | ||||
'/arvados/v1/' + arvadosTypeName(uuid) + | '/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 = [ | let rows = [ | ||||
[ 'UUID', item.uuid ], | [ 'UUID', item.uuid ], | ||||
[ 'Kind', item.kind ], | [ 'Kind', item.kind ], | ||||
@@ -45,14 +45,26 @@ class WBNameAndUuid extends Component { | |||||
} else if (/[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}/.exec(uuid)) { | } else if (/[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}/.exec(uuid)) { | ||||
let typeName = arvadosTypeName(uuid); | let typeName = arvadosTypeName(uuid); | ||||
const filters = [ | |||||
['uuid', '=', uuid] | |||||
]; | |||||
let prom = makeArvadosRequest(arvHost, arvToken, | 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 { | } else { | ||||
this.setState({ | this.setState({ | ||||
@@ -1,46 +1,41 @@ | |||||
import makeArvadosRequest from 'make-arvados-request'; | import makeArvadosRequest from 'make-arvados-request'; | ||||
import arvadosTypeName from 'arvados-type-name'; | import arvadosTypeName from 'arvados-type-name'; | ||||
import arvadosObjectName from 'arvados-object-name'; | |||||
function fetchObjectParents(arvHost, arvToken, uuid) { | function fetchObjectParents(arvHost, arvToken, uuid) { | ||||
let parents = []; | let parents = []; | ||||
let cb = xhr => { | 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); | 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(); | 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, | return makeArvadosRequest(arvHost, arvToken, | ||||
'/arvados/v1/' + objectType + 's' + | '/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, | let prom = makeArvadosRequest(arvHost, arvToken, | ||||
'/arvados/v1/' + objectType + 's' + | '/arvados/v1/' + objectType + 's' + | ||||
'/' + uuid); | |||||
'?filters=' + encodeURIComponent(JSON.stringify(filters))); | |||||
prom = prom.then(cb); | prom = prom.then(cb); | ||||
return prom; | return prom; | ||||
@@ -3,7 +3,7 @@ import { route } from 'preact-router'; | |||||
import WBNavbarCommon from 'wb-navbar-common'; | import WBNavbarCommon from 'wb-navbar-common'; | ||||
import WBProjectListing from 'wb-project-listing'; | import WBProjectListing from 'wb-project-listing'; | ||||
import WBInlineSearch from 'wb-inline-search'; | import WBInlineSearch from 'wb-inline-search'; | ||||
import WBProjectCrumbs from 'wb-project-crumbs'; | |||||
import WBArvadosCrumbs from 'wb-arvados-crumbs'; | |||||
import WBTabs from 'wb-tabs'; | import WBTabs from 'wb-tabs'; | ||||
import WBProcessListing from 'wb-process-listing'; | import WBProcessListing from 'wb-process-listing'; | ||||
import WBCollectionListing from 'wb-collection-listing'; | import WBCollectionListing from 'wb-collection-listing'; | ||||
@@ -34,8 +34,7 @@ class WBBrowse extends Component { | |||||
<WBNavbarCommon app={ app } activeItem={ !ownerUuid ? 'all-projects' : | <WBNavbarCommon app={ app } activeItem={ !ownerUuid ? 'all-projects' : | ||||
(ownerUuid === app.state.currentUser.uuid ? 'home' : null) } /> | (ownerUuid === app.state.currentUser.uuid ? 'home' : null) } /> | ||||
<WBProjectCrumbs uuid={ ownerUuid } appState={ appState } | |||||
onItemClicked={ item => route('/browse/' + item['uuid']) } /> | |||||
<WBArvadosCrumbs uuid={ ownerUuid } app={ app } /> | |||||
<WBTabs tabs={ [ { 'name': 'Projects', 'isActive': true } ] } /> | <WBTabs tabs={ [ { 'name': 'Projects', 'isActive': true } ] } /> | ||||
@@ -73,7 +72,7 @@ class WBBrowse extends Component { | |||||
itemsPerPage="20" | itemsPerPage="20" | ||||
page={ Number(workflowPage || 0) } | page={ Number(workflowPage || 0) } | ||||
getPageUrl={ i => this.getUrl({ 'workflowPage': i }) } /> | getPageUrl={ i => this.getUrl({ 'workflowPage': i }) } /> | ||||
) : null)) | ) : null)) | ||||
} | } | ||||
</div> | </div> | ||||