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!
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

74 rindas
2.3KB

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