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:
@ -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
|
||||
)
|
||||
|
Reference in New Issue
Block a user