diff --git a/frontend/src/js/component/wb-collection-listing.js b/frontend/src/js/component/wb-collection-listing.js index 6e01e6a..0ad0c29 100644 --- a/frontend/src/js/component/wb-collection-listing.js +++ b/frontend/src/js/component/wb-collection-listing.js @@ -68,13 +68,16 @@ class WBCollectionListing extends Component { fetchItems() { let { arvHost, arvToken } = this.props.app.state; - let { activePage, itemsPerPage, ownerUuid } = this.props; + let { activePage, itemsPerPage, ownerUuid, textSearch } = this.props; let filters = []; if (ownerUuid) filters.push([ 'owner_uuid', '=', ownerUuid ]); + if (textSearch) + filters.push([ 'any', 'ilike', '%' + textSearch + '%' ]); + let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/collections?filters=' + encodeURIComponent(JSON.stringify(filters)) + '&limit=' + encodeURIComponent(itemsPerPage) + diff --git a/frontend/src/js/component/wb-inline-search.js b/frontend/src/js/component/wb-inline-search.js index 7f7b685..ff028e5 100644 --- a/frontend/src/js/component/wb-inline-search.js +++ b/frontend/src/js/component/wb-inline-search.js @@ -1,12 +1,13 @@ import { h, Component } from 'preact'; class WBInlineSearch extends Component { - render() { + render({ textSearch, navigate }) { return ( -
- +
+ navigate(e.target.value)) : null } /> - +
); } } diff --git a/frontend/src/js/component/wb-navbar-common.js b/frontend/src/js/component/wb-navbar-common.js index bd6c6c3..9bb3ef0 100644 --- a/frontend/src/js/component/wb-navbar-common.js +++ b/frontend/src/js/component/wb-navbar-common.js @@ -3,7 +3,7 @@ import WBNavbar from 'wb-navbar'; import WBInlineSearch from 'wb-inline-search'; class WBNavbarCommon extends Component { - render({ app, items, activeItem }) { + render({ app, items, activeItem, textSearch, textSearchNavigate }) { return ( - ) } + rhs={ textSearchNavigate ? ( + + ) : null } titleUrl = { '/browse/' + app.state.currentUser.uuid } getItemUrl={ item => app.navbarItemUrl(item) } activeItem={ activeItem } /> diff --git a/frontend/src/js/component/wb-process-listing.js b/frontend/src/js/component/wb-process-listing.js index 3228ed1..96eaf49 100644 --- a/frontend/src/js/component/wb-process-listing.js +++ b/frontend/src/js/component/wb-process-listing.js @@ -57,7 +57,8 @@ class WBProcessListing extends Component { const { arvHost, arvToken } = this.props.appState; const { requestStates, reqStateMask } = this.state; const { activePage, itemsPerPage, ownerUuid, - requestingContainerUuid, waitForNextProps } = this.props; + requestingContainerUuid, waitForNextProps, + textSearch } = this.props; if (waitForNextProps) return; @@ -69,6 +70,8 @@ class WBProcessListing extends Component { filters.push([ 'state', 'in', requestStates.filter((_, idx) => reqStateMask[idx]) ]); if (ownerUuid) filters.push([ 'owner_uuid', '=', ownerUuid ]); + if (textSearch) + filters.push([ 'any', 'ilike', '%' + textSearch + '%' ]) let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/container_requests?filters=' + encodeURIComponent(JSON.stringify(filters)) + diff --git a/frontend/src/js/component/wb-project-listing.js b/frontend/src/js/component/wb-project-listing.js index 896522b..12dbb7f 100644 --- a/frontend/src/js/component/wb-project-listing.js +++ b/frontend/src/js/component/wb-project-listing.js @@ -24,8 +24,7 @@ class WBProjectListing extends Component { renderSelectionCell(item), (
- { e.preventDefault(); route('/browse/' + item['uuid']) }}> + { item['name'] } { renderRenameLink(item, () => this.fetchItems()) }
@@ -45,13 +44,15 @@ class WBProjectListing extends Component { } fetchItems() { - let { activePage, mode, itemsPerPage, ownerUuid, app } = this.props; + let { activePage, mode, itemsPerPage, ownerUuid, app, textSearch } = this.props; let { arvHost, arvToken } = app.state; let filters = [ [ 'group_class', '=', 'project' ] ]; if (ownerUuid) filters.push([ 'owner_uuid', '=', ownerUuid ]); + if (textSearch) + filters.push([ 'any', 'ilike', '%' + textSearch + '%' ]); let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/groups' + (mode === 'shared-with-me' ? '/shared' : '') + '?filters=' + encodeURIComponent(JSON.stringify(filters)) + diff --git a/frontend/src/js/component/wb-user-listing.js b/frontend/src/js/component/wb-user-listing.js index 88e7970..a232ed1 100644 --- a/frontend/src/js/component/wb-user-listing.js +++ b/frontend/src/js/component/wb-user-listing.js @@ -15,12 +15,17 @@ class WBUserListing extends Component { preparePage() { const { arvHost, arvToken } = this.props.app.state; - const { itemsPerPage, page } = this.props; + const { itemsPerPage, page, textSearch } = this.props; const order = ['last_name asc']; + const filters = []; + if (textSearch) + filters.push([ 'any', 'ilike', '%' + textSearch + '%' ]); + let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/users?order=' + encodeURIComponent(JSON.stringify(order)) + + '&filters=' + encodeURIComponent(JSON.stringify(filters)) + '&limit=' + itemsPerPage + '&offset=' + (itemsPerPage * page)); prom = prom.then(xhr => { this.setState({ diff --git a/frontend/src/js/component/wb-workflow-listing.js b/frontend/src/js/component/wb-workflow-listing.js index 4dbea55..bd2bf37 100644 --- a/frontend/src/js/component/wb-workflow-listing.js +++ b/frontend/src/js/component/wb-workflow-listing.js @@ -50,10 +50,12 @@ class WBWorkflowListing extends Component { fetchItems() { const { arvHost, arvToken } = this.props.app.state; - const { page, itemsPerPage, ownerUuid } = this.props; + const { page, itemsPerPage, ownerUuid, textSearch } = this.props; const filters = []; if (ownerUuid) filters.push([ 'owner_uuid', '=', ownerUuid ]); + if (textSearch) + filters.push([ 'any', 'ilike', '%' + textSearch + '%' ]); const select = ['uuid', 'name', 'description', 'owner_uuid', 'created_at']; let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/workflows?filters=' + encodeURIComponent(JSON.stringify(filters)) + diff --git a/frontend/src/js/page/wb-app.js b/frontend/src/js/page/wb-app.js index 8e125fc..1e23034 100644 --- a/frontend/src/js/page/wb-app.js +++ b/frontend/src/js/page/wb-app.js @@ -75,10 +75,10 @@ class WBApp extends Component { - - @@ -89,7 +89,7 @@ class WBApp extends Component { - + diff --git a/frontend/src/js/page/wb-browse.js b/frontend/src/js/page/wb-browse.js index eb83941..490974b 100644 --- a/frontend/src/js/page/wb-browse.js +++ b/frontend/src/js/page/wb-browse.js @@ -52,8 +52,9 @@ class WBBrowse extends Component { 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 || '')); + return '/shared-with-me/' + + ('activePage' in params ? params.activePage : (this.props.activePage || '')) + '/' + + ('textSearch' in params ? params.textSearch : (this.props.textSearch || '')); let res = '/browse/' + ('ownerUuid' in params ? params.ownerUuid : (this.props.ownerUuid || '')) + '/' + @@ -61,7 +62,8 @@ class WBBrowse extends Component { ('objTypeTab' in params ? params.objTypeTab : (this.props.objTypeTab || '')) + '/' + ('collectionPage' in params ? params.collectionPage : (this.props.collectionPage || '')) + '/' + ('processPage' in params ? params.processPage : (this.props.processPage || '')) + '/' + - ('workflowPage' in params ? params.workflowPage : (this.props.workflowPage || '')); + ('workflowPage' in params ? params.workflowPage : (this.props.workflowPage || '')) + '/' + + encodeURIComponent('textSearch' in params ? params.textSearch : (this.props.textSearch || '')); return res; } @@ -141,7 +143,8 @@ class WBBrowse extends Component { } render({ mode, ownerUuid, activePage, app, - objTypeTab, collectionPage, processPage, workflowPage }, { selected }) { + objTypeTab, collectionPage, processPage, workflowPage, + textSearch }, { selected }) { return (
@@ -151,9 +154,13 @@ class WBBrowse extends Component { - + route(this.getUrl({ textSearch, + activePage: 0, collectionPage: 0, processPage: 0, workflowPage: 0 })) } /> @@ -174,7 +181,8 @@ class WBBrowse extends Component { renderRenameLink={ (it, cb) => this.renderRenameLink(it, cb) } renderDeleteButton={ (it, cb) => this.renderDeleteButton(it, cb) } renderSelectionCell={ it => this.renderSelectionCell(it) } - renderSharingButton={ it => this.renderSharingButton(it) } /> + renderSharingButton={ it => this.renderSharingButton(it) } + textSearch={ textSearch } /> { (mode !== 'browse') ? null : ( this.renderRenameLink(it, cb) } renderDeleteButton={ (it, cb) => this.renderDeleteButton(it, cb) } renderSelectionCell={ it => this.renderSelectionCell(it) } - renderSharingButton={ it => this.renderSharingButton(it) } /> + renderSharingButton={ it => this.renderSharingButton(it) } + textSearch={ textSearch } /> ) : (objTypeTab === 'process') ? ( this.renderRenameLink(it, cb) } renderDeleteButton={ (it, cb) => this.renderDeleteButton(it, cb) } renderSelectionCell={ it => this.renderSelectionCell(it) } - renderSharingButton={ it => this.renderSharingButton(it) } /> + renderSharingButton={ it => this.renderSharingButton(it) } + textSearch={ textSearch } /> ) : (objTypeTab === 'workflow') ? ( this.renderRenameLink(it, cb) } renderDeleteButton={ (it, cb) => this.renderDeleteButton(it, cb) } renderSelectionCell={ it => this.renderSelectionCell(it) } - renderSharingButton={ it => this.renderSharingButton(it) } /> + renderSharingButton={ it => this.renderSharingButton(it) } + textSearch={ textSearch } /> ) : null } diff --git a/frontend/src/js/page/wb-users-page.js b/frontend/src/js/page/wb-users-page.js index 5388a0f..360cff4 100644 --- a/frontend/src/js/page/wb-users-page.js +++ b/frontend/src/js/page/wb-users-page.js @@ -1,19 +1,27 @@ import { h, Component } from 'preact'; +import { route } from 'preact-router'; import WBNavbarCommon from 'wb-navbar-common'; import WBUserListing from 'wb-user-listing'; class WBUsersPage extends Component { - getUrl(page) { - return ('/users/' + page); + getUrl(params) { + const url = '/users/' + + Number('page' in params ? params.page : (this.props.page || 0)) + '/' + + encodeURIComponent('textSearch' in params ? params.textSearch : (this.props.textSearch || '')); + return url; + // return ('/users/' + page); } - render({ app, page }) { + render({ app, page, textSearch }) { return (
- + route(this.getUrl({ textSearch, page: 0 })) } /> this.getUrl(page) } /> + textSearch={ textSearch } + getPageUrl={ page => this.getUrl({ page }) } />
); }