From b891bd1889e4cf99cc440c91b1f6678c4139c2f5 Mon Sep 17 00:00:00 2001 From: Jonathan Senecal Date: Thu, 18 May 2023 13:22:32 -0400 Subject: [PATCH] Docs and defaults --- docs/configuration/default-values.md | 10 +++++++++- netbox/extras/constants.py | 7 +++++++ netbox/extras/dashboard/utils.py | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/configuration/default-values.md b/docs/configuration/default-values.md index e76930208..8a9db5ae2 100644 --- a/docs/configuration/default-values.md +++ b/docs/configuration/default-values.md @@ -11,6 +11,7 @@ This parameter must specify an iterable of dictionaries, each representing a dis * `height`: Default widget height, in rows * `title`: Widget title * `color`: Color of the widget's title bar, specified by name +* `icon_name`: Icon name from Material design icons (e.g. "earth") * `config`: Dictionary mapping of any widget configuration parameters A brief example configuration is provided below. @@ -20,8 +21,9 @@ DEFAULT_DASHBOARD = [ { 'widget': 'extras.ObjectCountsWidget', 'width': 4, - 'height': 2, + 'height': 5, 'title': 'Organization', + 'icon_name': 'domain', 'config': { 'models': [ 'dcim.site', @@ -32,13 +34,19 @@ DEFAULT_DASHBOARD = [ }, { 'widget': 'extras.ObjectCountsWidget', + 'width': 4, + 'height': 8, 'title': 'IPAM', 'color': 'blue', + 'icon_name': 'counter', 'config': { 'models': [ + 'ipam.vrf', + 'ipam.aggregate', 'ipam.prefix', 'ipam.iprange', 'ipam.ipaddress', + 'ipam.vlan', ] } }, diff --git a/netbox/extras/constants.py b/netbox/extras/constants.py index 49e29cbba..cacfebe6c 100644 --- a/netbox/extras/constants.py +++ b/netbox/extras/constants.py @@ -24,6 +24,7 @@ DEFAULT_DASHBOARD = [ 'width': 4, 'height': 5, 'title': 'Organization', + 'icon_name': 'domain', 'config': { 'models': [ 'dcim.site', @@ -37,6 +38,7 @@ DEFAULT_DASHBOARD = [ 'width': 4, 'height': 8, 'title': 'IPAM', + 'icon_name': 'counter', 'config': { 'models': [ 'ipam.vrf', @@ -67,6 +69,7 @@ DEFAULT_DASHBOARD = [ 'width': 4, 'height': 4, 'title': 'Circuits', + 'icon_name': 'transit-connection-variant', 'config': { 'models': [ 'circuits.provider', @@ -80,6 +83,7 @@ DEFAULT_DASHBOARD = [ 'width': 4, 'height': 8, 'title': 'NetBox News', + 'icon_name': 'newspaper-variant-outline', 'config': { 'feed_url': 'http://netbox.dev/rss/', 'max_entries': 10, @@ -91,6 +95,7 @@ DEFAULT_DASHBOARD = [ 'width': 4, 'height': 6, 'title': 'DCIM', + 'icon_name': 'server', 'config': { 'models': [ 'dcim.site', @@ -106,6 +111,7 @@ DEFAULT_DASHBOARD = [ 'width': 4, 'height': 4, 'title': 'Virtualization', + 'icon_name': 'monitor', 'config': { 'models': [ 'virtualization.cluster', @@ -118,6 +124,7 @@ DEFAULT_DASHBOARD = [ 'width': 12, 'height': 10, 'title': 'Change Log', + 'icon_name': 'clipboard-clock', 'color': 'blue', 'config': { 'model': 'extras.objectchange', diff --git a/netbox/extras/dashboard/utils.py b/netbox/extras/dashboard/utils.py index f7ffad2b2..9cbef481d 100644 --- a/netbox/extras/dashboard/utils.py +++ b/netbox/extras/dashboard/utils.py @@ -72,6 +72,7 @@ def get_default_dashboard(): 'class': widget['widget'], 'title': widget.get('title'), 'color': widget.get('color'), + 'icon_name': widget.get('icon_name'), 'config': widget.get('config', {}), }