Skip to content

Breadcrumbs#591

Merged
tdonohue merged 12 commits intoDSpace:masterfrom
atmire:w2p-68921_breadcrumbs
Feb 28, 2020
Merged

Breadcrumbs#591
tdonohue merged 12 commits intoDSpace:masterfrom
atmire:w2p-68921_breadcrumbs

Conversation

@LotteHofstede
Copy link
Contributor

@LotteHofstede LotteHofstede commented Feb 24, 2020

This PR adds breadcrumbs to DSpace. It depends on #578 and DSpace/DSpace#2673

There are two types of breadcrumbs at the moment:

  • i18n breadcrumbs
    • For i18n breadcrumbs the key prefixed with 'breadcrumb.' and resolved to a message
    • To create this type of breadcrumb, add the following to the router module of the page
      resolve: {breadcrumb: I18nBreadcrumbResolver}, data: {breadcrumbKey: 'i18n.string.to.use.as.key'}
  • DSO breadcrumbs
    • For DSO's a breadcrumb is added for each parent object and the object self
    • To create this type of breadcrumb, add the following to the router module of i.e. an item page
      resolve: {breadcrumb: ItemBreadcrumbResolver}

TODOs

  • Write tests
  • Add TypeDocs
  • Add translations for the i18n keys
  • Style for mantis

@tdonohue
Copy link
Member

I know this is still a Draft, but just wanted to note that I just merged #578 , so this can be rebased to make it a bit smaller / easier to start reviewing.

@artlowel artlowel force-pushed the w2p-68921_breadcrumbs branch from 15f5379 to f67387e Compare February 24, 2020 15:27
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick note. I gave this an early code review today, and mostly it looks good (one tiny comment inline). I did notice that almost all new classes/methods are either missing TypeDocs or have somewhat incorrect TypeDocs (but, I didn't call those out specifically, as you said you were working on them).

I haven't had a chance to test this yet, but will do so tomorrow. Thanks!


export function getItemEditPath(id: string) {
return new URLCombiner(getItemModulePath(),ITEM_EDIT_PATH.replace(/:id/, id)).toString()
return new URLCombiner(getItemModulePath(), ITEM_EDIT_PATH.replace(/:id/, id)).toString()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny comment here...it looks like you've removed the :id from ITEM_EDIT_PATH below, so it seems like the .replace() on this line likely isn't needed.

@LotteHofstede LotteHofstede marked this pull request as ready for review February 26, 2020 16:12
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LotteHofstede : Gave this a code review today, and overall it looks good. Just a few inline comments requesting missing TypeDocs in a few files.

I also tested this, and overall, it works as described. However, there were some unexpected behaviors that I ran into:

  1. For pages that don't really have defined breadcrumbs, the default seems to be for a (disabled) grayed out "Home" to appear. For example, this is what I see when starting a new Submission (/submit). Also visible on Registry pages (/admin/registries/metadata), etc. This empty breadcrumbs isn't really useful. I expect either the breadcrumb bar shouldn't exist on those pages, or it should have something like Home / New Submission for a new Submission, etc.
    • This need not necessarily be fully fixed in this PR. We could simply hide this breadcrumb bar by default if no defined breadcrumbs exist. A future PR could add breadcrumbs to more pages.
  2. Breadcrumbs for Communities/Collections work on the default Community homepage or Collection Homepage. But, they disappear if I click a Browse by link (e.g. "By Title" or "By Issue Date") . This is likely because the Browse by links change the URL to /browse/[type]?scope=[uuid] from the default of /communities/[uuid].
  3. Occasionally, I see a weird delay where the breadcrumbs don't load immediately. I haven't been able to reliably reproduce this though (and it could be my dev environment acting up). But, sometimes I'll go to an Item page and the breadcrumb just says "Home"...then a few seconds later, it fills out the Community/Collection hierarchy. This is just a note...not sure if it's reproducible though.
  4. Just my opinion, but I think the breadcrumb bar is slightly too tall. The text could be made smaller so that it's not as tall. This is a very minor thing though that could be cleaned up in CSS later (not required for this PR)

Copy link
Contributor

@atarix83 atarix83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @artlowel for this PR

I had a look to the code and it seems good to me.
I tested over DSpace/DSpace#2673 and I only have a doubt on how shoul be the right behavior on the page not related on a DSO.
For example if i'm on the the mydspace page in the breadcrumbs there is only the home label that is not active and clickable.
What should be the right behavior on these pages?

@LotteHofstede
Copy link
Contributor Author

Thanks @tdonohue for your feedback!
I added some missing TypeDocs you requested.

I'll address your issues in a similar list:

  1. I've now implemented this similarly as to what you requested. The breadcrumbs are now hidden if their path is not complete (meaning there is no breadcrumb specified for the last part of the route). You can still force incomplete paths to show by setting 'showBreadcrumbs: true' on the data.

  2. Browse by: This was a tricky one. Unfortunately the implementation of the browse-by pages for DSO's is not optimal, in my opinion. At the moment, the component cannot differentiate between communities and collection. This also means there is no way of showing different metadata for different types of DSOs on browse pages.
    To solve the issue for my use case, I added separate breadcrumb resolvers to create a logical trail. I do think that this could have been a lot easier if we refactored the DSO browse-by pages a bit.

  3. The delay has to do with the breadcrumbs being loaded asynchronously. We chose to implement it like this, so the page does not have to wait for all DSO's to be resolved before it can load. We could change this, but that might cause a lot of pages to load a lot slower.

  4. I didn't style the current breadcrumbs other than using the basic bootstrap classes for breadcrumbs, in order to keep it as clean as possible. I'm planning on adding a better style for the mantis theme.

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @LotteHofstede for your improvements to this PR. I've retested (and re-reviewed) and in my opinion this looks good enough to merge (as soon as the REST implementation DSpace/DSpace#2673 is also ready).

As you noted there are some further improvements we could make in future PRs, but this works as-is. I no longer see the empty breadcrumbs (the grayed out "Home") anywhere (resolving my point 1 in previous feedback). The Breadcrumbs for Community/Collections now work properly when a "browse by" link is clicked on (resolving my point 2 in previous feedback).

I agree with you that it's better to load breadcrumbs asynchronously (which resolves my point 3 in previous feedback). Finally, we can clean up styling in a later PR. This looks good for now!

@tdonohue tdonohue merged commit b2f0e9f into DSpace:master Feb 28, 2020
@tdonohue tdonohue added this to the 7.0beta1 milestone Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants