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!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

121 lines
4.0KB

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