Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Frontend] Annotations fix: Convert named colors to HEX #6162

Merged
merged 3 commits into from
Aug 9, 2024

Conversation

odeimaiz
Copy link
Member

@odeimaiz odeimaiz commented Aug 9, 2024

What do these changes do?

When listing projects, pydantic, I believe, is translating the colors used in the annotations from hex to named colors. The frontend wasn't able to understand some of those named colors (i.e. #0FF -> Cyan).

This PR workarounds that problem by checking the named colors in a longer list and converting it again to hex. If the named color doesn't exist in the list it will default it to light gray.

The annotations that were failing in the deserialization step:
image

Related issue/s

How to test

Dev-ops checklist

@odeimaiz odeimaiz self-assigned this Aug 9, 2024
@odeimaiz odeimaiz added bug buggy, it does not work as expected a:frontend issue affecting the front-end (area group) labels Aug 9, 2024
@odeimaiz odeimaiz added this to the Tom Bombadil milestone Aug 9, 2024
@odeimaiz odeimaiz changed the title Fix/named color to hex 🐛 [Frontend] Annotations fix: Convert named colors to HEX Aug 9, 2024
@odeimaiz odeimaiz enabled auto-merge (squash) August 9, 2024 10:33
Copy link
Collaborator

@elisabettai elisabettai left a comment

Choose a reason for hiding this comment

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

Good catch! But pydantic seems to support hex colors. 🤔

Still some users might get annoyed to see gray annotations, maybe they chose a specific hex code and they try do to it again and then it'll end up gray again -> still a bug for them. Some scientists are very picky on their color choices. 😉

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

fun

@elisabettai elisabettai self-requested a review August 9, 2024 11:41
Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

@odeimaiz as discussed, I will check whether I could do the conversion from named-color to hex-color in the backend in a separate PR as well.

Copy link

sonarqubecloud bot commented Aug 9, 2024

@pcrespov pcrespov disabled auto-merge August 9, 2024 12:39
@pcrespov pcrespov merged commit 1fa7509 into ITISFoundation:master Aug 9, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:frontend issue affecting the front-end (area group) bug buggy, it does not work as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants