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

improve size column readability in archives tab #1598

Merged
merged 18 commits into from
Feb 21, 2023

Conversation

hariseldon78
Copy link
Contributor

@hariseldon78 hariseldon78 commented Feb 17, 2023

I find hard to read the sizes of the archives at a glance when they are all mixed units: usually the longer numbers represent smaller sizes, making it difficult to find the biggest archives. So I made a basic algorithm to select a good unit that can adequately represent all sizes, that makes it much easier to read. Also I made the column align to the right, which further improves readability.

Related Issue

#1595

Motivation and Context

Readability

How Has This Been Tested?

Tested on my archive list, which sizes goes from about 100 MB to 150 GB

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING guide.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

src/vorta/utils.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@real-yfprojects real-yfprojects left a comment

Choose a reason for hiding this comment

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

Please add signature type hints and docstrings for pretty_bytes and find_best_size_formatting.

src/vorta/views/source_tab.py Outdated Show resolved Hide resolved
@real-yfprojects
Copy link
Collaborator

Pre-commit will format your code (including sorting imports) automatically.

@hariseldon78
Copy link
Contributor Author

hariseldon78 commented Feb 18, 2023

unfortunately pre-commit is not working on my system, this is the error I receive:
pre-commit.log
the fixes I found talks about upgrading the isort package, but the version is not pinned in the requirements file, so it should already be at the highest version compatible with the other packages...

[Edit] ok this problem is related to #1601, so i've been able to install and run it by doing the pre-commit autoupdate

@real-yfprojects
Copy link
Collaborator

real-yfprojects commented Feb 18, 2023

[Edit] ok this problem is related to #1601, so i've been able to install and run it by doing the pre-commit autoupdate

Rebasing your branch onto master will also do the job.

It won't since the corresponding PR is not merged yet.

Copy link
Collaborator

@real-yfprojects real-yfprojects left a comment

Choose a reason for hiding this comment

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

Great, you added test cases and cleverly improved my code!

src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
src/vorta/utils.py Outdated Show resolved Hide resolved
src/vorta/utils.py Show resolved Hide resolved
src/vorta/utils.py Show resolved Hide resolved
src/vorta/utils.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@real-yfprojects real-yfprojects left a comment

Choose a reason for hiding this comment

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

Can you add a test for a very large size like $10^{30}$?

src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
@hariseldon78
Copy link
Contributor Author

Can you add a test for a very large size like 1030?

it was failing actually :)

src/vorta/utils.py Outdated Show resolved Hide resolved
src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@real-yfprojects real-yfprojects left a comment

Choose a reason for hiding this comment

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

Only some minor typing problems which make them even more minor.

src/vorta/utils.py Outdated Show resolved Hide resolved
src/vorta/utils.py Show resolved Hide resolved
hariseldon78 and others added 2 commits February 21, 2023 01:24
Co-authored-by: yfprojects <62463991+real-yfprojects@users.noreply.github.com>
@real-yfprojects real-yfprojects requested a review from m3nu February 21, 2023 09:37
@m3nu
Copy link
Contributor

m3nu commented Feb 21, 2023

Thanks all! Give me until this evening to run this locally.

@m3nu
Copy link
Contributor

m3nu commented Feb 21, 2023

Works as advertised. Interesting addition. Thanks for your work and patience on this!

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