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!
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

109 wiersze
3.6KB

  1. import { h, Component } from 'preact';
  2. import { Router, route } from 'preact-router';
  3. import WBBrowse from 'wb-browse';
  4. import WBSignIn from 'wb-sign-in';
  5. import WBSignOut from 'wb-sign-out';
  6. import WBLandingPage from 'wb-landing-page';
  7. import WBProcessView from 'wb-process-view';
  8. import WBContainerView from 'wb-container-view';
  9. import WBCollectionView from 'wb-collection-view';
  10. import WBCollectionBrowse from 'wb-collection-browse';
  11. import WBUsersPage from 'wb-users-page';
  12. import WBWorkflowView from 'wb-workflow-view';
  13. import WBLaunchWorkflowPage from 'wb-launch-workflow-page';
  14. import WBDownloadPage from 'wb-download-page';
  15. import WBImageViewerPage from 'wb-image-viewer-page';
  16. import WBSharingPage from 'wb-sharing-page';
  17. import arvadosTypeName from 'arvados-type-name';
  18. class WBApp extends Component {
  19. constructor(...args) {
  20. super(...args);
  21. this.state.arvHost = window.localStorage['arvHost'];
  22. this.state.arvToken = window.localStorage['arvToken'];
  23. if ('currentUser' in window.localStorage)
  24. this.state.currentUser = JSON.parse(window.localStorage['currentUser']);
  25. this.loadToolbox();
  26. }
  27. navbarItemUrl(item) {
  28. if (item['id'] === 'sign-out') {
  29. return ('/sign-out');
  30. } else if (item['id'] === 'home') {
  31. return ('/browse/' + this.state.currentUser.uuid);
  32. } else if (item['id'] === 'all-projects') {
  33. return ('/browse');
  34. } else if (item['id'] === 'all-users') {
  35. return ('/users');
  36. } else if (item['id'] === 'shared-with-me') {
  37. return ('/shared-with-me');
  38. }
  39. }
  40. breadcrumbClicked(item) {
  41. let objectType = arvadosTypeName(item.uuid.split('-')[1]);
  42. if (objectType === 'user')
  43. route('/browse/' + item.uuid)
  44. else if (objectType === 'group' && item.group_class === 'project')
  45. route('/browse/' + item.uuid);
  46. else if (objectType === 'container_request')
  47. route('/process/' + item.uuid)
  48. }
  49. addToToolbox(uuid) {
  50. this.state.toolboxItems.push(uuid);
  51. window.localStorage['toolboxItems'] =
  52. JSON.stringify(this.state.toolboxItems);
  53. }
  54. clearToolbox() {
  55. this.state.toolboxItems = [];
  56. delete window.localStorage['toolboxItems'];
  57. }
  58. loadToolbox() {
  59. this.state.toolboxItems = ('toolboxItems' in window.localStorage) ?
  60. JSON.parse(window.localStorage['toolboxItems']) : [];
  61. }
  62. render() {
  63. return (
  64. <Router>
  65. <WBLandingPage path="/" />
  66. <WBSignIn path="/sign-in" appState={ this.state } />
  67. <WBSignOut path='/sign-out' app={ this } />
  68. <WBBrowse path="/browse/:ownerUuid?/:activePage?/:objTypeTab?/:collectionPage?/:processPage?/:workflowPage?/:textSearch?"
  69. app={ this } mode="browse" />
  70. <WBBrowse path="/shared-with-me/:activePage?/:textSearch?"
  71. app={ this } mode="shared-with-me" />
  72. <WBProcessView path="/process/:uuid/:page?" app={ this } />
  73. <WBContainerView path="/container/:uuid" app={ this } />
  74. <WBCollectionView path="/collection/:uuid" app={ this } />
  75. <WBCollectionBrowse path='/collection-browse/:uuid/:collectionPath?/:page?' app={ this } />
  76. <WBUsersPage path='/users/:page?/:textSearch?' app={ this } />
  77. <WBWorkflowView path="/workflow/:uuid" app={ this } />
  78. <WBLaunchWorkflowPage path="/workflow-launch/:workflowUuid" app={ this } />
  79. <WBDownloadPage path="/download/:blocksBlobUrl/:inline?" app={ this } />
  80. <WBImageViewerPage path="/image-viewer/:blobUrl" app={ this } />
  81. <WBSharingPage path="/sharing/:uuid" app={ this } />
  82. </Router>
  83. );
  84. }
  85. }
  86. export default WBApp;