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.

42 line
1018B

  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 => {
  17. this.setState({ 'items': parents });
  18. });
  19. }
  20. componentDidMount() {
  21. this.fetchCrumbs();
  22. }
  23. componentWillReceiveProps(nextProps) {
  24. this.props = nextProps;
  25. this.fetchCrumbs();
  26. }
  27. render({ app }, { items }) {
  28. return (
  29. <WBBreadcrumbs items={ items }
  30. onItemClicked={ item => app.breadcrumbClicked(item) } />
  31. );
  32. }
  33. }
  34. export default WBArvadosCrumbs;