1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Permit disabling utilization graph warning/danger thresholds

This commit is contained in:
jeremystretch
2021-05-11 14:52:27 -04:00
parent bf56145a09
commit ecf51406c5
4 changed files with 41 additions and 42 deletions

View File

@ -256,6 +256,21 @@ class RoleTable(BaseTable):
# Prefixes
#
class PrefixUtilizationColumn(UtilizationColumn):
"""
Extend UtilizationColumn to allow disabling the warning & danger thresholds for prefixes
marked as fully utilized.
"""
template_code = """
{% load helpers %}
{% if record.pk and record.mark_utilized %}
{% utilization_graph value warning_threshold=0 danger_threshold=0 %}
{% elif record.pk %}
{% utilization_graph value %}
{% endif %}
"""
class PrefixTable(BaseTable):
pk = ToggleColumn()
prefix = tables.TemplateColumn(
@ -300,7 +315,7 @@ class PrefixTable(BaseTable):
class PrefixDetailTable(PrefixTable):
utilization = UtilizationColumn(
utilization = PrefixUtilizationColumn(
accessor='get_utilization',
orderable=False
)