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

Added ability to customize logo and title #9052

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Conversation

klakhov
Copy link
Contributor

@klakhov klakhov commented Feb 5, 2025

Motivation and context

This simple PR moves logo management to /about server endpoint. It would make easier to change it if needed by replacing logo.svg asset on the server. Additinally, there is a possibility to edit title and description using settings

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • [ ] I have updated the documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] I have linked related issues (see GitHub docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.72%. Comparing base (cae4e8f) to head (7a67807).
Report is 5 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9052      +/-   ##
===========================================
+ Coverage    73.42%   73.72%   +0.30%     
===========================================
  Files          419      428       +9     
  Lines        44351    44507     +156     
  Branches      3875     3875              
===========================================
+ Hits         32563    32812     +249     
+ Misses       11788    11695      -93     
Components Coverage Δ
cvat-ui 77.40% <ø> (-0.01%) ⬇️
cvat-server 70.68% <69.23%> (+0.57%) ⬆️

@klakhov klakhov requested a review from nmanovic as a code owner February 5, 2025 11:18
@@ -189,6 +189,12 @@
_DATA_UPDATED_DATE_HEADER_NAME = 'X-Updated-Date'
_RETRY_AFTER_TIMEOUT = 10

ICON_FILE = "assets/logo.svg"

def get_logo() -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check that we don't read it on every about request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed implementation to use static logo file as Roman suggested. Now it should be cached correctly

Copy link
Member

@bsekachev bsekachev left a comment

Choose a reason for hiding this comment

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

In this implementation it is still not customizable, as was requested by the customer, as icon is a part of docker image

cvat-ui/src/components/common/cvat-logo.tsx Show resolved Hide resolved
cvat-ui/src/components/common/cvat-logo.tsx Outdated Show resolved Hide resolved
cvat/apps/engine/views.py Outdated Show resolved Hide resolved
cvat/apps/engine/views.py Outdated Show resolved Hide resolved

return (
<div className='cvat-logo-icon'>
<img
Copy link
Member

Choose a reason for hiding this comment

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

What if the server returns logo (let's say 1024x256px)? Will it be fit into the component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed styles a bit. By default logo component is 64x32 so everything bigger will be scaled using object-fit: contain to maintain the size

"annotate million of objects with different properties. Many UI " +
"and UX decisions are based on feedbacks from professional data " +
"annotation team."
"logo": get_logo(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to include the whole logo into the API response?

I think it would be more sensible to include the URL of the logo, and stick the actual logo in the static directory. Then:

  1. The API response won't be as bloated.
  2. The usual HTTP caching mechanisms will apply, so the clients won't fetch the logo more often than necessary.
  3. It'll be more efficient if the logo is in a non-text format (e.g. PNG), since no encoding will be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, implemented this approach

@SpecLad
Copy link
Contributor

SpecLad commented Feb 7, 2025

In this implementation it is still not customizable, as was requested by the customer, as icon is a part of docker image

That seems normal to me - where else would it be? I'm assuming that the customization process will involve mounting an alternate icon file into the container.

Did you have something else in mind?

"name": "Computer Vision Annotation Tool",
"name": settings.ABOUT_INFO["name"],
"title": settings.ABOUT_INFO["title"],
"description": settings.ABOUT_INFO["description"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you make the name and description customizable? I don't think that was in the customer's request. It's also not mentioned in the changelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For me it makes sense if we want to customize the /about response via settings we can also customize those fields.

cvat/settings/base.py Outdated Show resolved Hide resolved
@klakhov
Copy link
Contributor Author

klakhov commented Feb 11, 2025

From my perspective, the logo customization process should be straightforward: place the new file in correct folder and configure a setting for its name if necessary. The same goes for text info in /about.
I dont think we want implement something like uploading new logo from UI

.cvat-signing-header {
background: transparent;
position: fixed;
padding: $grid-unit-size * 2 0 0 0;
width: 100%;

.cvat-logo-icon {
fill: white;
filter: brightness(0) invert(1);
Copy link
Member

Choose a reason for hiding this comment

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

As I understand it makes any logo on sign-in page white, however what if a color logo provided?
This approach will break such logo.

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

Successfully merging this pull request may close these issues.

5 participants