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!
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

77 linhas
2.4KB

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