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!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

84 lignes
3.3KB

  1. import { h, Component } from 'preact';
  2. import { route } from 'preact-router';
  3. import WBNavbar from 'wb-navbar';
  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, appCallbacks, appState, app,
  25. objTypeTab, collectionPage, processPage, workflowPage }) {
  26. return (
  27. <div>
  28. <WBNavbar items={ [
  29. { 'name': 'Home', 'id': 'home', 'active': (ownerUuid === appState.currentUser.uuid) },
  30. { 'name': 'All Projects', 'id': 'all-projects', 'active': (!ownerUuid) },
  31. { 'name': 'User', 'dropdown': [ { 'id': 'sign-out', 'name': 'Sign Out' } ]}
  32. ] } rhs={ (
  33. <WBInlineSearch />
  34. ) } onItemClicked={ appCallbacks.navbarItemClicked } />
  35. <WBProjectCrumbs uuid={ ownerUuid } appState={ appState }
  36. onItemClicked={ item => route('/browse/' + item['uuid']) } />
  37. <WBTabs tabs={ [ { 'name': 'Projects', 'isActive': true } ] } />
  38. <WBProjectListing arvHost={ appState.arvHost }
  39. arvToken={ appState.arvToken }
  40. ownerUuid={ ownerUuid }
  41. itemsPerPage="5"
  42. activePage={ Number(activePage || 0) }
  43. onPageChanged={ i => route('/browse/' + (ownerUuid || '') + '/' + i)} />
  44. <WBTabs tabs={ [
  45. { 'id': 'collection', 'name': 'Collections', 'isActive': (!objTypeTab || objTypeTab === 'collection') },
  46. { 'id': 'process', 'name': 'Processes', 'isActive': (objTypeTab === 'process') },
  47. { 'id': 'workflow', 'name': 'Workflows', 'isActive': (objTypeTab === 'workflow') } ] }
  48. onTabChanged={ tab => this.route({ 'objTypeTab': tab['id'] }) } />
  49. {
  50. (!objTypeTab || objTypeTab === 'collection') ? (
  51. <WBCollectionListing app={ app }
  52. ownerUuid={ ownerUuid }
  53. itemsPerPage="20"
  54. activePage={ Number(collectionPage || 0) }
  55. getPageUrl={ i => this.getUrl({ 'collectionPage': i }) } />
  56. ) : (objTypeTab === 'process' ? (
  57. <WBProcessListing appState={ appState }
  58. ownerUuid={ ownerUuid }
  59. itemsPerPage="20"
  60. activePage={ Number(processPage || 0) }
  61. onPageChanged={ i => this.route({ 'processPage': i }) } />
  62. ) : (objTypeTab === 'workflow' ? (
  63. null
  64. ) : null))
  65. }
  66. </div>
  67. );
  68. }
  69. }
  70. export default WBBrowse;