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.

93 wiersze
2.9KB

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