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.

wb-project-crumbs.js 991B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { h, Component } from 'preact';
  2. import WBBreadcrumbs from 'wb-breadcrumbs';
  3. import fetchProjectParents from 'fetch-project-parents';
  4. class WBProjectCrumbs 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.appState;
  15. let prom = fetchProjectParents(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({ onItemClicked }, { items }) {
  26. return (
  27. <WBBreadcrumbs items={ items }
  28. onItemClicked={ onItemClicked } />
  29. );
  30. }
  31. }
  32. export default WBProjectCrumbs;