diff --git a/netbox/utilities/templates/helpers/utilization_graph.html b/netbox/utilities/templates/helpers/utilization_graph.html index fe1c0fc9a..04b0391bf 100644 --- a/netbox/utilities/templates/helpers/utilization_graph.html +++ b/netbox/utilities/templates/helpers/utilization_graph.html @@ -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 %} @@ -18,4 +23,4 @@ {{ utilization }}% {% endif %} -{% endif %} +{% endif %} \ No newline at end of file diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index 0e45cb581..cfba03b87 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -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, }