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.

71 lines
2.1KB

  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 WBLandingPage from 'wb-landing-page';
  6. import WBProcessView from 'wb-process-view';
  7. import arvadosTypeName from 'arvados-type-name';
  8. class WBApp extends Component {
  9. constructor(...args) {
  10. super(...args);
  11. this.state.arvHost = window.localStorage['arvHost'];
  12. this.state.arvToken = window.localStorage['arvToken'];
  13. if ('currentUser' in window.localStorage)
  14. this.state.currentUser = JSON.parse(window.localStorage['currentUser']);
  15. this.appCallbacks = {
  16. 'navbarItemClicked': item => this.navbarItemClicked(item)
  17. };
  18. this.appState = {
  19. 'arvHost': this.state.arvHost,
  20. 'arvToken': this.state.arvToken,
  21. 'currentUser': this.state.currentUser
  22. };
  23. }
  24. navbarItemClicked(item) {
  25. if (item['id'] === 'sign-out') {
  26. delete window.localStorage['arvHost'];
  27. delete window.localStorage['arvToken'];
  28. delete window.localStorage['currentUser'];
  29. route('/sign-in');
  30. } else if (item['id'] === 'home') {
  31. route('/browse/' + this.appState.currentUser.uuid);
  32. } else if (item['id'] === 'all-projects') {
  33. route('/browse');
  34. }
  35. }
  36. breadcrumbClicked(item) {
  37. let objectType = arvadosTypeName(item.uuid.split('-')[1]);
  38. if (objectType === 'user')
  39. route('/browse/' + item.uuid)
  40. else if (objectType === 'group' && item.group_class === 'project')
  41. route('/browse/' + item.uuid);
  42. else if (objectType === 'container_request')
  43. route('/process/' + item.uuid)
  44. }
  45. render() {
  46. return (
  47. <Router>
  48. <WBLandingPage path="/" />
  49. <WBSignIn path="/sign-in" appState={ this.appState } />
  50. <WBBrowse path="/browse/:ownerUuid?/:activePage?/:objTypeTab?/:collectionPage?/:processPage?/:workflowPage?"
  51. appCallbacks={ this.appCallbacks }
  52. appState={ this.appState }
  53. app={ this } />
  54. <WBProcessView path="/process/:uuid" app={ this } />
  55. </Router>
  56. );
  57. }
  58. }
  59. export default WBApp;