diff --git a/frontend/src/js/component/wb-arvados-crumbs.js b/frontend/src/js/component/wb-arvados-crumbs.js index 233be8e..26640bb 100644 --- a/frontend/src/js/component/wb-arvados-crumbs.js +++ b/frontend/src/js/component/wb-arvados-crumbs.js @@ -9,13 +9,20 @@ class WBArvadosCrumbs extends Component { } fetchCrumbs() { - if (!this.props.uuid) { + const { mode, uuid, app } = this.props; + const { arvHost, arvToken } = app.state; + + if (mode === 'shared-with-me') { + this.setState({ 'items': [ { 'name': 'Shared with Me' } ] }); + return; + } + + if (!uuid) { this.setState({ 'items': [ { 'name': 'All Projects' } ] }); return; } - let { arvHost, arvToken } = this.props.app.state; - let prom = fetchObjectParents(arvHost, arvToken, this.props.uuid); + let prom = fetchObjectParents(arvHost, arvToken, uuid); prom = prom.then(parents => { this.setState({ 'items': parents }); }); diff --git a/frontend/src/js/component/wb-navbar-common.js b/frontend/src/js/component/wb-navbar-common.js index 3b6a09b..bd6c6c3 100644 --- a/frontend/src/js/component/wb-navbar-common.js +++ b/frontend/src/js/component/wb-navbar-common.js @@ -10,6 +10,7 @@ class WBNavbarCommon extends Component { { 'name': 'Home', 'id': 'home' }, { 'name': 'All Projects', 'id': 'all-projects' }, { 'name': 'All Users', 'id': 'all-users' }, + { 'name': 'Shared with Me', 'id': 'shared-with-me' }, { 'name': 'Current User', 'dropdown': [ { 'id': 'sign-out', 'name': 'Sign Out' } ]} ].concat(items) } rhs={ ( diff --git a/frontend/src/js/component/wb-project-listing.js b/frontend/src/js/component/wb-project-listing.js index 26f4f4a..51795f8 100644 --- a/frontend/src/js/component/wb-project-listing.js +++ b/frontend/src/js/component/wb-project-listing.js @@ -42,16 +42,18 @@ class WBProjectListing extends Component { } fetchItems() { - let i = this.props.activePage; + let { activePage, mode, itemsPerPage, ownerUuid, app } = this.props; + let { arvHost, arvToken } = app.state; let filters = [ [ 'group_class', '=', 'project' ] ]; - if (this.props.ownerUuid) - filters.push([ 'owner_uuid', '=', this.props.ownerUuid ]); - let prom = makeArvadosRequest(this.props.arvHost, this.props.arvToken, - '/arvados/v1/groups?filters=' + encodeURIComponent(JSON.stringify(filters)) + - '&limit=' + encodeURIComponent(this.props.itemsPerPage) + - '&offset=' + encodeURIComponent(this.props.itemsPerPage * i)); + if (ownerUuid) + filters.push([ 'owner_uuid', '=', ownerUuid ]); + let prom = makeArvadosRequest(arvHost, arvToken, + '/arvados/v1/groups' + (mode === 'shared-with-me' ? '/shared' : '') + + '?filters=' + encodeURIComponent(JSON.stringify(filters)) + + '&limit=' + itemsPerPage + + '&offset=' + (itemsPerPage * activePage)); prom = prom.then(xhr => this.setState({ 'numPages': Math.ceil(xhr.response['items_available'] / xhr.response['limit']), @@ -65,7 +67,7 @@ class WBProjectListing extends Component { this.fetchItems(); } - render({ arvHost, arvToken, ownerUuid, activePage, onPageChanged }, { rows, numPages }) { + render({ arvHost, arvToken, ownerUuid, activePage, getPageUrl }, { rows, numPages }) { return (