Docs and defaults

This commit is contained in:
Jonathan Senecal 2023-05-18 13:22:32 -04:00
parent b03ce4d1d6
commit b891bd1889
3 changed files with 17 additions and 1 deletions

View File

@ -11,6 +11,7 @@ This parameter must specify an iterable of dictionaries, each representing a dis
* `height`: Default widget height, in rows * `height`: Default widget height, in rows
* `title`: Widget title * `title`: Widget title
* `color`: Color of the widget's title bar, specified by name * `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 * `config`: Dictionary mapping of any widget configuration parameters
A brief example configuration is provided below. A brief example configuration is provided below.
@ -20,8 +21,9 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.ObjectCountsWidget', 'widget': 'extras.ObjectCountsWidget',
'width': 4, 'width': 4,
'height': 2, 'height': 5,
'title': 'Organization', 'title': 'Organization',
'icon_name': 'domain',
'config': { 'config': {
'models': [ 'models': [
'dcim.site', 'dcim.site',
@ -32,13 +34,19 @@ DEFAULT_DASHBOARD = [
}, },
{ {
'widget': 'extras.ObjectCountsWidget', 'widget': 'extras.ObjectCountsWidget',
'width': 4,
'height': 8,
'title': 'IPAM', 'title': 'IPAM',
'color': 'blue', 'color': 'blue',
'icon_name': 'counter',
'config': { 'config': {
'models': [ 'models': [
'ipam.vrf',
'ipam.aggregate',
'ipam.prefix', 'ipam.prefix',
'ipam.iprange', 'ipam.iprange',
'ipam.ipaddress', 'ipam.ipaddress',
'ipam.vlan',
] ]
} }
}, },

View File

@ -24,6 +24,7 @@ DEFAULT_DASHBOARD = [
'width': 4, 'width': 4,
'height': 5, 'height': 5,
'title': 'Organization', 'title': 'Organization',
'icon_name': 'domain',
'config': { 'config': {
'models': [ 'models': [
'dcim.site', 'dcim.site',
@ -37,6 +38,7 @@ DEFAULT_DASHBOARD = [
'width': 4, 'width': 4,
'height': 8, 'height': 8,
'title': 'IPAM', 'title': 'IPAM',
'icon_name': 'counter',
'config': { 'config': {
'models': [ 'models': [
'ipam.vrf', 'ipam.vrf',
@ -67,6 +69,7 @@ DEFAULT_DASHBOARD = [
'width': 4, 'width': 4,
'height': 4, 'height': 4,
'title': 'Circuits', 'title': 'Circuits',
'icon_name': 'transit-connection-variant',
'config': { 'config': {
'models': [ 'models': [
'circuits.provider', 'circuits.provider',
@ -80,6 +83,7 @@ DEFAULT_DASHBOARD = [
'width': 4, 'width': 4,
'height': 8, 'height': 8,
'title': 'NetBox News', 'title': 'NetBox News',
'icon_name': 'newspaper-variant-outline',
'config': { 'config': {
'feed_url': 'http://netbox.dev/rss/', 'feed_url': 'http://netbox.dev/rss/',
'max_entries': 10, 'max_entries': 10,
@ -91,6 +95,7 @@ DEFAULT_DASHBOARD = [
'width': 4, 'width': 4,
'height': 6, 'height': 6,
'title': 'DCIM', 'title': 'DCIM',
'icon_name': 'server',
'config': { 'config': {
'models': [ 'models': [
'dcim.site', 'dcim.site',
@ -106,6 +111,7 @@ DEFAULT_DASHBOARD = [
'width': 4, 'width': 4,
'height': 4, 'height': 4,
'title': 'Virtualization', 'title': 'Virtualization',
'icon_name': 'monitor',
'config': { 'config': {
'models': [ 'models': [
'virtualization.cluster', 'virtualization.cluster',
@ -118,6 +124,7 @@ DEFAULT_DASHBOARD = [
'width': 12, 'width': 12,
'height': 10, 'height': 10,
'title': 'Change Log', 'title': 'Change Log',
'icon_name': 'clipboard-clock',
'color': 'blue', 'color': 'blue',
'config': { 'config': {
'model': 'extras.objectchange', 'model': 'extras.objectchange',

View File

@ -72,6 +72,7 @@ def get_default_dashboard():
'class': widget['widget'], 'class': widget['widget'],
'title': widget.get('title'), 'title': widget.get('title'),
'color': widget.get('color'), 'color': widget.get('color'),
'icon_name': widget.get('icon_name'),
'config': widget.get('config', {}), 'config': widget.get('config', {}),
} }