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!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 line
1001B

  1. import { h, Component } from 'preact';
  2. import WBBreadcrumbs from 'wb-breadcrumbs';
  3. import fetchObjectParents from 'fetch-object-parents';
  4. class WBArvadosCrumbs extends Component {
  5. constructor(...args) {
  6. super(...args);
  7. this.state.items = [ { 'name': 'All Projects' } ];
  8. }
  9. fetchCrumbs() {
  10. if (!this.props.uuid) {
  11. this.setState({ 'items': [ { 'name': 'All Projects' } ] });
  12. return;
  13. }
  14. let { arvHost, arvToken } = this.props.app.state;
  15. let prom = fetchObjectParents(arvHost, arvToken, this.props.uuid);
  16. prom = prom.then(parents => this.setState({ 'items': parents }));
  17. }
  18. componentDidMount() {
  19. this.fetchCrumbs();
  20. }
  21. componentWillReceiveProps(nextProps) {
  22. this.props = nextProps;
  23. this.fetchCrumbs();
  24. }
  25. render({ app }, { items }) {
  26. return (
  27. <WBBreadcrumbs items={ items }
  28. onItemClicked={ item => app.breadcrumbClicked(item) } />
  29. );
  30. }
  31. }
  32. export default WBArvadosCrumbs;