diff --git a/docs/configuration/miscellaneous.md b/docs/configuration/miscellaneous.md index c3fbb40aa..e3728acab 100644 --- a/docs/configuration/miscellaneous.md +++ b/docs/configuration/miscellaneous.md @@ -29,6 +29,17 @@ This defines custom content to be displayed on the login page above the login fo --- +## BANNER_MAINTENANCE + +!!! tip "Dynamic Configuration Parameter" + +!!! note + This parameter was added in NetBox v3.5. + +This adds a banner to the top of every page when maintenance mode is enabled. HTML is allowed. + +--- + ## BANNER_TOP !!! tip "Dynamic Configuration Parameter" diff --git a/netbox/extras/admin.py b/netbox/extras/admin.py index 04a67b521..6d1b14370 100644 --- a/netbox/extras/admin.py +++ b/netbox/extras/admin.py @@ -25,7 +25,7 @@ class ConfigRevisionAdmin(admin.ModelAdmin): 'fields': ('ALLOWED_URL_SCHEMES',), }), ('Banners', { - 'fields': ('BANNER_LOGIN', 'BANNER_TOP', 'BANNER_BOTTOM'), + 'fields': ('BANNER_LOGIN', 'BANNER_MAINTENANCE', 'BANNER_TOP', 'BANNER_BOTTOM'), 'classes': ('monospace',), }), ('Pagination', { diff --git a/netbox/netbox/config/parameters.py b/netbox/netbox/config/parameters.py index 2bfa234f0..9c613217c 100644 --- a/netbox/netbox/config/parameters.py +++ b/netbox/netbox/config/parameters.py @@ -28,6 +28,17 @@ PARAMS = ( ), }, ), + ConfigParam( + name='BANNER_MAINTENANCE', + label=_('Maintenance banner'), + default='NetBox is currently in maintenance mode. Functionality may be limited.', + description=_('Additional content to display when in maintenance mode'), + field_kwargs={ + 'widget': forms.Textarea( + attrs={'class': 'vLargeTextField'} + ), + }, + ), ConfigParam( name='BANNER_TOP', label=_('Top banner'), diff --git a/netbox/templates/base/layout.html b/netbox/templates/base/layout.html index 6b247d81a..9e8b7d7bf 100644 --- a/netbox/templates/base/layout.html +++ b/netbox/templates/base/layout.html @@ -77,10 +77,10 @@ Blocks: {% endif %} - {% if config.MAINTENANCE_MODE %} + {% if config.MAINTENANCE_MODE and config.BANNER_MAINTENANCE %} {% endif %}