-
Notifications
You must be signed in to change notification settings - Fork 1k
UI improvements to the admin interface for setting project upload limits #2473
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
UI improvements to the admin interface for setting project upload limits #2473
Conversation
* Uses a number field instead of a text field. * The text field now uses megabytes instead of bytes. * The detail page now shows the value in megabytes as well as the full value in bytes. * The detail page now shows "Default" as well as indicating what the default limit is in MB instead of just displaying "None". Unfortunately, I couldn't use "step" in the form field as it would have limited the input to multiples of the step value. Fixes pypi#2471
A bummer, I was hoping it would just control the arrows and not be part of the client side validation. Ah well. |
I tried my best. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, small tweak on formatting in the display, but otherwise LGTM.
<td>{{ project.upload_limit }}</td> | ||
<td> | ||
{% if project.upload_limit %} | ||
{{ project.upload_limit / ONE_MB }} MB ({{ "{:,.0f}".format(project.upload_limit) }} bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To format the bytes, I think it'd be better to use project.upload_limit|format_number()
, it's more comprehensible then the terrible Python mini language :D
I'm torn on the display of the MB itself, we have filesizeformat(binary=True)
which will do the same thing, except work nicer if we go > 1GB... but I don't think that we're likely to do that so I don't know how much it matters. Since I'm already asking for you to fix the number formatting for the bytes, I think unless you feel strongly about it using {{ project.upload_limit|filesizeformat(binary=True) }}
would be my preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
<input type="text" name="upload_limit" class="form-control" id="uploadLimit" rows="3" value="{{ project.upload_limit | default('', True)}}"> | ||
<label for="uploadLimit">Upload limit (in Megabytes)</label> | ||
{% if project.upload_limit %} | ||
{% set upload_limit_value = project.upload_limit / ONE_MB %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike the display issue, this needs to use the same logic as the python code to go from bytes to MB, so this makes sense to keep this regardless of what happens above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted.
Great, thanks a lot! |
Happy to help
…On Fri, Oct 6, 2017, 3:11 PM Donald Stufft ***@***.***> wrote:
Great, thanks a lot!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2473 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPUcxtlE6wOF0Micir1HJkdvSafq4P2ks5spqWngaJpZM4PxEID>
.
|
Unfortunately, I couldn't use "step" in the form field as it would have limited the input to multiples of the step value.
Fixes #2471