mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Created a template tag for displaying utilization graphs
This commit is contained in:
@@ -95,3 +95,15 @@ def querystring_toggle(request, multi=True, page_key='page', **kwargs):
|
||||
return '?' + querystring
|
||||
else:
|
||||
return ''
|
||||
|
||||
|
||||
@register.inclusion_tag('utilities/templatetags/utilization_graph.html')
|
||||
def utilization_graph(utilization, warning_threshold=75, danger_threshold=90):
|
||||
"""
|
||||
Display a horizontal bar graph indicating a percentage of utilization.
|
||||
"""
|
||||
return {
|
||||
'utilization': utilization,
|
||||
'warning_threshold': warning_threshold,
|
||||
'danger_threshold': danger_threshold,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user