Different Alignment and Decimal Places on Aggregate Usage #6735

Closed
opened 2025-12-29 19:44:45 +01:00 by adam · 8 comments
Owner

Originally created by @tobikris on GitHub (Jul 28, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.2.7

Python version

3.10

Steps to Reproduce

Create multiple Aggregates. Leave some of them empty (without used IP addresses).

Expected Behavior

The shown percentage of used IP space should look the same for all aggregates.

Observed Behavior

Some percentages are center-aligned and have more precision than most (it seems to happen for empty aggregates).

image

Originally created by @tobikris on GitHub (Jul 28, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.2.7 ### Python version 3.10 ### Steps to Reproduce Create multiple Aggregates. Leave some of them empty (without used IP addresses). ### Expected Behavior The shown percentage of used IP space should look the same for all aggregates. ### Observed Behavior Some percentages are center-aligned and have more precision than most (it seems to happen for empty aggregates). ![image](https://user-images.githubusercontent.com/2772132/181626751-7e750b5f-5077-4a4d-a1f3-0b28c8cc4cbe.png)
adam added the type: bugstatus: accepted labels 2025-12-29 19:44:45 +01:00
adam closed this issue 2025-12-29 19:44:45 +01:00
Author
Owner

@PieterL75 commented on GitHub (Jul 30, 2022):

Looks like #9881 could be combined with this one...

@PieterL75 commented on GitHub (Jul 30, 2022): Looks like #9881 could be combined with this one...
Author
Owner

@atownson commented on GitHub (Aug 1, 2022):

I can work on this.

@atownson commented on GitHub (Aug 1, 2022): I can work on this.
Author
Owner

@jeremystretch commented on GitHub (Aug 1, 2022):

Thanks @atownson, but I'm going to fold this one into #9881 as I feel like the rounding issue is better captured there. We can also address the alignment under that issue.

@jeremystretch commented on GitHub (Aug 1, 2022): Thanks @atownson, but I'm going to fold this one into #9881 as I feel like the rounding issue is better captured there. We can also address the alignment under that issue.
Author
Owner

@jeremystretch commented on GitHub (Aug 1, 2022):

On second thought, rather than left-aligning zero values, I think hiding the graph entirely more readily differentiates unused objects. For example, compare the second and third prefixes in the screenshot below. Thoughts?

Screenshot 2022-08-01 at 10-20-47 Prefixes NetBox

@jeremystretch commented on GitHub (Aug 1, 2022): On second thought, rather than left-aligning zero values, I think hiding the graph entirely more readily differentiates unused objects. For example, compare the second and third prefixes in the screenshot below. Thoughts? ![Screenshot 2022-08-01 at 10-20-47 Prefixes NetBox](https://user-images.githubusercontent.com/13487278/182168901-410eb191-4555-4ec2-aef3-b2e830b6dd2a.png)
Author
Owner

@tobikris commented on GitHub (Aug 1, 2022):

Interesting idea indeed. I am not sure if I prefer this though as it seems to be exaggerating the difference between an unused prefix/aggregate and another one that is empty for all practical use cases. I would be fine with both but would prefer the same look as the left-aligned "0.0%".

Edit: I think your proposal is not as self-explanatory as showing the 0.0% in both cases.

@tobikris commented on GitHub (Aug 1, 2022): Interesting idea indeed. I am not sure if I prefer this though as it seems to be exaggerating the difference between an unused prefix/aggregate and another one that is empty for all practical use cases. I would be fine with both but would prefer the same look as the left-aligned "0.0%". Edit: I think your proposal is not as self-explanatory as showing the 0.0% in both cases.
Author
Owner

@jeremystretch commented on GitHub (Aug 1, 2022):

Fair enough, let's keep things simple.

@jeremystretch commented on GitHub (Aug 1, 2022): Fair enough, let's keep things simple.
Author
Owner

@jeremystretch commented on GitHub (Aug 1, 2022):

Between this and #9881 it looks much cleaner now:
Screenshot 2022-08-01 at 11-55-06 Aggregates NetBox

@jeremystretch commented on GitHub (Aug 1, 2022): Between this and #9881 it looks much cleaner now: ![Screenshot 2022-08-01 at 11-55-06 Aggregates NetBox](https://user-images.githubusercontent.com/13487278/182189920-f82834ee-a130-43cd-9346-8871e94e2d6f.png)
Author
Owner

@atownson commented on GitHub (Aug 1, 2022):

@jeremystretch, you might want to consider increasing the percentage evaluation logic from 25% to 30%, because with the addition of the decimal the progress bar text can look a bit squashed at 25%.
image

<div class="progress">
  <div
    role="progressbar"
    aria-valuemin="0"
    aria-valuemax="100"
    aria-valuenow="{{ utilization }}"
    class="progress-bar {{ bar_class }}"
    style="width: {{ utilization }}%;"
  >
    {% if utilization >= 30 %}{{ utilization|floatformat:1 }}%{% endif %}
  </div>
  {% if utilization < 30 %}
    <span class="ps-1">{{ utilization|floatformat:1 }}%</span>
  {% endif %}
</div>

image

@atownson commented on GitHub (Aug 1, 2022): @jeremystretch, you might want to consider increasing the percentage evaluation logic from 25% to 30%, because with the addition of the decimal the progress bar text can look a bit squashed at 25%. ![image](https://user-images.githubusercontent.com/52260120/182193327-425c90c7-61a7-4439-9b19-e9adec394e5e.png) ``` <div class="progress"> <div role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="{{ utilization }}" class="progress-bar {{ bar_class }}" style="width: {{ utilization }}%;" > {% if utilization >= 30 %}{{ utilization|floatformat:1 }}%{% endif %} </div> {% if utilization < 30 %} <span class="ps-1">{{ utilization|floatformat:1 }}%</span> {% endif %} </div> ``` ![image](https://user-images.githubusercontent.com/52260120/182192928-f4164a8d-6215-4bc9-884d-6b6479283645.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6735