mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-16 20:48:17 -06:00
Closes #8232: Add color show full 100% utilization
This commit is contained in:
parent
a5603c9953
commit
d434c3d7e5
@ -9,8 +9,13 @@
|
||||
aria-valuemin="0"
|
||||
aria-valuemax="100"
|
||||
aria-valuenow="{{ utilization }}"
|
||||
{% if is_full_danger %}
|
||||
class="progress-bar"
|
||||
style="width: {{ utilization }}%; background-color: #800080;"
|
||||
{% else %}
|
||||
class="progress-bar {{ bar_class }}"
|
||||
style="width: {{ utilization }}%;"
|
||||
{% endif %}
|
||||
>
|
||||
{% if utilization >= 25 %}{{ utilization }}%{% endif %}
|
||||
</div>
|
||||
@ -18,4 +23,4 @@
|
||||
<span class="ps-1">{{ utilization }}%</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
@ -389,6 +389,9 @@ def utilization_graph(utilization, warning_threshold=75, danger_threshold=90):
|
||||
"""
|
||||
Display a horizontal bar graph indicating a percentage of utilization.
|
||||
"""
|
||||
is_full_danger = False
|
||||
if utilization == 100:
|
||||
is_full_danger = True
|
||||
if danger_threshold and utilization >= danger_threshold:
|
||||
bar_class = 'bg-danger'
|
||||
elif warning_threshold and utilization >= warning_threshold:
|
||||
@ -397,9 +400,11 @@ def utilization_graph(utilization, warning_threshold=75, danger_threshold=90):
|
||||
bar_class = 'bg-success'
|
||||
else:
|
||||
bar_class = 'bg-gray'
|
||||
is_full_danger = False
|
||||
return {
|
||||
'utilization': utilization,
|
||||
'bar_class': bar_class,
|
||||
'is_full_danger': is_full_danger,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user