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.

79 lines
3.1KB

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