IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
3.3KB

  1. import { h, Component } from 'preact';
  2. import { route } from 'preact-router';
  3. import WBNavbarCommon from 'wb-navbar-common';
  4. import WBProjectListing from 'wb-project-listing';
  5. import WBInlineSearch from 'wb-inline-search';
  6. import WBArvadosCrumbs from 'wb-arvados-crumbs';
  7. import WBTabs from 'wb-tabs';
  8. import WBProcessListing from 'wb-process-listing';
  9. import WBCollectionListing from 'wb-collection-listing';
  10. import WBWorkflowListing from 'wb-workflow-listing';
  11. class WBBrowse extends Component {
  12. getUrl(params) {
  13. let res = '/browse/' +
  14. ('ownerUuid' in params ? params.ownerUuid : (this.props.ownerUuid || '')) + '/' +
  15. ('activePage' in params ? params.activePage : (this.props.activePage || '')) + '/' +
  16. ('objTypeTab' in params ? params.objTypeTab : (this.props.objTypeTab || '')) + '/' +
  17. ('collectionPage' in params ? params.collectionPage : (this.props.collectionPage || '')) + '/' +
  18. ('processPage' in params ? params.processPage : (this.props.processPage || '')) + '/' +
  19. ('workflowPage' in params ? params.workflowPage : (this.props.workflowPage || ''));
  20. return res;
  21. }
  22. route(params) {
  23. route(this.getUrl(params));
  24. }
  25. render({ ownerUuid, activePage, appState, app,
  26. objTypeTab, collectionPage, processPage, workflowPage }) {
  27. return (
  28. <div>
  29. <WBNavbarCommon app={ app } activeItem={ !ownerUuid ? 'all-projects' :
  30. (ownerUuid === app.state.currentUser.uuid ? 'home' : null) } />
  31. <WBArvadosCrumbs uuid={ ownerUuid } app={ app } />
  32. <WBTabs tabs={ [ { 'name': 'Projects', 'isActive': true } ] } />
  33. <WBProjectListing app={ app }
  34. arvHost={ appState.arvHost }
  35. arvToken={ appState.arvToken }
  36. ownerUuid={ ownerUuid }
  37. itemsPerPage="5"
  38. activePage={ Number(activePage || 0) }
  39. onPageChanged={ i => route('/browse/' + (ownerUuid || '') + '/' + i)} />
  40. <WBTabs tabs={ [
  41. { 'id': 'collection', 'name': 'Collections', 'isActive': (!objTypeTab || objTypeTab === 'collection') },
  42. { 'id': 'process', 'name': 'Processes', 'isActive': (objTypeTab === 'process') },
  43. { 'id': 'workflow', 'name': 'Workflows', 'isActive': (objTypeTab === 'workflow') } ] }
  44. onTabChanged={ tab => this.route({ 'objTypeTab': tab['id'] }) } />
  45. {
  46. (!objTypeTab || objTypeTab === 'collection') ? (
  47. <WBCollectionListing app={ app }
  48. ownerUuid={ ownerUuid }
  49. itemsPerPage="20"
  50. activePage={ Number(collectionPage || 0) }
  51. getPageUrl={ i => this.getUrl({ 'collectionPage': i }) } />
  52. ) : (objTypeTab === 'process' ? (
  53. <WBProcessListing appState={ appState }
  54. ownerUuid={ ownerUuid }
  55. itemsPerPage="20"
  56. activePage={ Number(processPage || 0) }
  57. onPageChanged={ i => this.route({ 'processPage': i }) } />
  58. ) : (objTypeTab === 'workflow' ? (
  59. <WBWorkflowListing app={ app }
  60. ownerUuid={ ownerUuid }
  61. itemsPerPage="20"
  62. page={ Number(workflowPage || 0) }
  63. getPageUrl={ i => this.getUrl({ 'workflowPage': i }) } />
  64. ) : null))
  65. }
  66. </div>
  67. );
  68. }
  69. }
  70. export default WBBrowse;