Format utilization percentage below 1 percent #6740

Closed
opened 2025-12-29 19:44:52 +01:00 by adam · 1 comment
Owner

Originally created by @barnebyte on GitHub (Jul 29, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.2.5

Feature type

Change to existing functionality

Proposed functionality

Currently utilization percentage is formatted with utilization|floatformat:0. This can lead to values smaller than 1 being rendered as 0% which can be confusing. My suggestion is to change the utilization_graph.html template file so values smaller than 1 can have a utilization|floatformat formatting.

As a result, the percentage for values below 1 will look like this:
image

Currently it is rendered like this:
image

Use case

This would help users getting real values of utilization percentage if it's smaller than 1%, while it would also help avoiding having two differently rendered 0% value.

Database changes

No database changes are necessary for this change.

External dependencies

No external dependency for this change.

Originally created by @barnebyte on GitHub (Jul 29, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.2.5 ### Feature type Change to existing functionality ### Proposed functionality Currently utilization percentage is formatted with `utilization|floatformat:0`. This can lead to values smaller than 1 being rendered as 0% which can be confusing. My suggestion is to change the `utilization_graph.html` template file so values smaller than 1 can have a `utilization|floatformat` formatting. As a result, the percentage for values below 1 will look like this: ![image](https://user-images.githubusercontent.com/16874816/181773598-3abc6a1b-5a16-451f-b606-340fb0b1c27b.png) Currently it is rendered like this: ![image](https://user-images.githubusercontent.com/16874816/181773805-129a75bc-3996-4d1a-ab4a-82b3175ae4d9.png) ### Use case This would help users getting real values of utilization percentage if it's smaller than 1%, while it would also help avoiding having two differently rendered 0% value. ### Database changes No database changes are necessary for this change. ### External dependencies No external dependency for this change.
adam added the status: acceptedtype: feature labels 2025-12-29 19:44:52 +01:00
adam closed this issue 2025-12-29 19:44:52 +01:00
Author
Owner

@atownson commented on GitHub (Jul 29, 2022):

Additionally values like 99.6% are rendered as 100% when there is at least one available IP.

@atownson commented on GitHub (Jul 29, 2022): Additionally values like 99.6% are rendered as 100% when there is at least one available IP.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6740