diff --git a/netbox/extras/constants.py b/netbox/extras/constants.py index 2a47c15e2..e1ce7b713 100644 --- a/netbox/extras/constants.py +++ b/netbox/extras/constants.py @@ -7,8 +7,8 @@ DEFAULT_DASHBOARD = [ 'widget': 'extras.ObjectCountsWidget', 'width': 4, 'height': 3, + 'title': 'IPAM', 'config': { - 'title': 'IPAM', 'models': [ 'ipam.Aggregate', 'ipam.Prefix', @@ -21,8 +21,8 @@ DEFAULT_DASHBOARD = [ 'widget': 'extras.ObjectCountsWidget', 'width': 4, 'height': 3, + 'title': 'DCIM', 'config': { - 'title': 'DCIM', 'models': [ 'dcim.Site', 'dcim.Rack', @@ -36,7 +36,7 @@ DEFAULT_DASHBOARD = [ 'width': 4, 'height': 3, 'config': { - 'content': 'Welcome to NetBox!' + 'content': 'Welcome to **NetBox**!' } }, { diff --git a/netbox/extras/dashboard/utils.py b/netbox/extras/dashboard/utils.py index 1da34b72f..345b00ff6 100644 --- a/netbox/extras/dashboard/utils.py +++ b/netbox/extras/dashboard/utils.py @@ -28,7 +28,6 @@ def get_dashboard(user): config = user.config.get('dashboard') else: config = get_default_dashboard_config() - print(config) if not user.is_anonymous: user.config.set('dashboard', config, commit=True) @@ -60,6 +59,7 @@ def get_default_dashboard_config(): }) config['widgets'][id] = { 'class': widget['widget'], + 'title': widget.get('title'), 'config': widget.get('config', {}), } diff --git a/netbox/extras/dashboard/widgets.py b/netbox/extras/dashboard/widgets.py index 776e75d90..5107b276d 100644 --- a/netbox/extras/dashboard/widgets.py +++ b/netbox/extras/dashboard/widgets.py @@ -2,8 +2,10 @@ import uuid from django.contrib.contenttypes.models import ContentType from django.template.loader import render_to_string +from django.utils.safestring import mark_safe from django.utils.translation import gettext as _ +from utilities.templatetags.builtins.filters import render_markdown from .utils import register_widget __all__ = ( @@ -15,6 +17,8 @@ __all__ = ( class DashboardWidget: + title = None + description = None width = 4 height = 3 @@ -45,14 +49,23 @@ class DashboardWidget: @register_widget class StaticContentWidget(DashboardWidget): + description = _('Display some arbitrary custom content. Markdown is supported.') + default_content = """ +