Skip to content

Conversation

mihow
Copy link
Collaborator

@mihow mihow commented Aug 6, 2024

This adds a new parents attribute to the Taxon object in all related API endpoints. This new attribute is an ordered list of all ranks and is intended to be used instead of the recursive parent attribute.

Most UI views have been updated to use the new parents list, except for the species list view! I can't crack that one.

One parent is still available if needed.

This enables the bulk ID actions to be much more useful because you can select multiple occurrences and choose the taxon rank that is common among all of them (family, superfamily, lepidoptera, etc)

Also fixes #485, you can click on any rank and the species detail page will not 404.

image

image

image

{
"id": 1211,
"name": "Calliteara pudibunda",
"rank": "SPECIES",
"parent": {
"id": 1210,
"name": "Calliteara",
"rank": "GENUS",
"details": "http://localhost:8000/api/v2/taxa/1210.json",
"user_permissions": [
"update",
"delete"
]
},
"parents": [
{
"id": 1,
"name": "Lepidoptera",
"rank": "ORDER"
},
{
"id": 7743,
"name": "Noctuoidea",
"rank": "SUPERFAMILY"
},
{
"id": 50,
"name": "Erebidae",
"rank": "FAMILY"
},
{
"id": 8554,
"name": "Lymantriinae",
"rank": "SUBFAMILY"
},
{
"id": 11319,
"name": "Orgyiini",
"rank": "TRIBE"
},
...

@mihow mihow linked an issue Aug 6, 2024 that may be closed by this pull request
@mihow mihow requested a review from annavik August 6, 2024 02:58
Copy link

netlify bot commented Aug 6, 2024

Deploy Preview for ami-web ready!

Name Link
🔨 Latest commit 0536dde
🔍 Latest deploy log https://app.netlify.com/sites/ami-web/deploys/66b1d9cc40f2320008b67066
😎 Deploy Preview https://deploy-preview-491--ami-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 33
Accessibility: 95
Best Practices: 92
SEO: 92
PWA: 70
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@mihow mihow added this to the Internal Beta V2 Release milestone Aug 6, 2024
@mihow mihow added the backend label Aug 6, 2024
Copy link

netlify bot commented Aug 6, 2024

Deploy Preview for ami-storybook ready!

Name Link
🔨 Latest commit 0536dde
🔍 Latest deploy log https://app.netlify.com/sites/ami-storybook/deploys/66b1d9cc370e6000084e6b18
😎 Deploy Preview https://deploy-preview-491--ami-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mihow mihow marked this pull request as ready for review August 6, 2024 03:12
@mihow
Copy link
Collaborator Author

mihow commented Aug 6, 2024

@annavik Can you help update the species list view to get the ranks back? I can't track that one down.

image

if (taxon.parents) {
this.ranks = taxon.parents
} else if (taxon.parent?.parents) {
// TODO: Update this when species list is returning parents similar to other endpoints
Copy link
Member

Choose a reason for hiding this comment

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

@mihow seems in the species list case, data structure looked slightly different. I could still access all parents though from the parent object. We can skip this once we streamline the format :)

parents?: ServerTaxon[]
}

const SORTED_RANKS = [
Copy link
Member

@annavik annavik Aug 6, 2024

Choose a reason for hiding this comment

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

@mihow I noticed the ranks were not always sorted (you can for example see this on the second occurrence table screenshot you posted in PR description). I added some client side sorting for now, based on this list of ranks. I hope it's correct!

We can skip this if backend plan to sort, but leaving it for now.

@annavik
Copy link
Member

annavik commented Aug 6, 2024

I went on and updated the rank appearance in table view, to show max 3 ranks (least detailed and most detailed):

Skärmavbild 2024-08-06 kl  10 17 19

Also tweaked the row space, for the case when we need the wrap behaviour:

Skärmavbild 2024-08-06 kl  10 23 55

@annavik annavik merged commit 90c54af into main Aug 6, 2024
@annavik annavik deleted the 421-always-show-family-when-displaying-upper-taxon-levels-omit-genus branch August 6, 2024 08:37
@annavik
Copy link
Member

annavik commented Aug 6, 2024

After merging this I came to think of #421 and updated the compact logic to:

Skärmavbild 2024-08-06 kl  10 58 13

See commit b611a27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Species detail links are often broken Always show family when displaying upper taxon levels, omit genus
2 participants