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 (
onPageChanged(i) } /> + getPageUrl={ getPageUrl } />
); } diff --git a/frontend/src/js/page/wb-app.js b/frontend/src/js/page/wb-app.js index eccf52b..1862de3 100644 --- a/frontend/src/js/page/wb-app.js +++ b/frontend/src/js/page/wb-app.js @@ -31,6 +31,8 @@ class WBApp extends Component { return ('/browse'); } else if (item['id'] === 'all-users') { return ('/users'); + } else if (item['id'] === 'shared-with-me') { + return ('/shared-with-me'); } } @@ -70,8 +72,10 @@ class WBApp extends Component { + app={ this } mode="browse" /> + + diff --git a/frontend/src/js/page/wb-browse.js b/frontend/src/js/page/wb-browse.js index 984ec90..b4ea93d 100644 --- a/frontend/src/js/page/wb-browse.js +++ b/frontend/src/js/page/wb-browse.js @@ -22,6 +22,12 @@ class WBBrowse extends Component { } getUrl(params) { + const mode = ('mode' in params ? params.mode : this.props.mode); + + if (mode === 'shared-with-me') + return '/shared-with-me/' + ('activePage' in params ? params.activePage : + (this.props.activePage || '')); + let res = '/browse/' + ('ownerUuid' in params ? params.ownerUuid : (this.props.ownerUuid || '')) + '/' + ('activePage' in params ? params.activePage : (this.props.activePage || '')) + '/' + @@ -59,7 +65,7 @@ class WBBrowse extends Component { ); } - render({ ownerUuid, activePage, appState, app, + render({ mode, ownerUuid, activePage, app, objTypeTab, collectionPage, processPage, workflowPage }) { return ( @@ -70,36 +76,41 @@ class WBBrowse extends Component { - + - + New Project ), + ownerUuid ? { 'name': ( New Project ), 'onClick': () => this.newProjectDialogRef.current.show(ownerUuid, - () => this.projectListingRef.current.fetchItems() ) } + () => this.projectListingRef.current.fetchItems() ) } : null ] } /> route('/browse/' + (ownerUuid || '') + '/' + i) } + getPageUrl={ i => this.getUrl({ 'activePage': i }) } renderRenameLink={ (it, cb) => this.renderRenameLink(it, cb) } renderDeleteButton={ (it, cb) => this.renderDeleteButton(it, cb) } /> - this.route({ 'objTypeTab': tab['id'] }) } /> + { (mode !== 'browse') ? null : ( + this.route({ 'objTypeTab': tab['id'] }) } /> + ) } { + (mode !== 'browse') ? null : (!objTypeTab || objTypeTab === 'collection') ? ( this.renderRenameLink(it, cb) } renderDeleteButton={ (it, cb) => this.renderDeleteButton(it, cb) } /> - ) : (objTypeTab === 'process' ? ( - this.renderRenameLink(it, cb) } renderDeleteButton={ (it, cb) => this.renderDeleteButton(it, cb) } /> - ) : (objTypeTab === 'workflow' ? ( + ) : (objTypeTab === 'workflow') ? ( this.renderRenameLink(it, cb) } renderDeleteButton={ (it, cb) => this.renderDeleteButton(it, cb) } /> - ) : null)) + ) : null } ); diff --git a/frontend/src/js/widget/wb-tabs.js b/frontend/src/js/widget/wb-tabs.js index 29faa35..e2bc2f5 100644 --- a/frontend/src/js/widget/wb-tabs.js +++ b/frontend/src/js/widget/wb-tabs.js @@ -7,6 +7,9 @@ class WBTabs extends Component { { tabs.map((t, idx) => { let name, isActive, isDisabled, onClick; + if (!t) + return null; + if (typeof(t) === 'object') { name = t.name; isActive = t.isActive;