diff --git a/docs/configuration/miscellaneous.md b/docs/configuration/miscellaneous.md index c3fbb40aa..f86086d53 100644 --- a/docs/configuration/miscellaneous.md +++ b/docs/configuration/miscellaneous.md @@ -121,6 +121,15 @@ Default: False Setting this to True will display a "maintenance mode" banner at the top of every page. Additionally, NetBox will no longer update a user's "last active" time upon login. This is to allow new logins when the database is in a read-only state. Recording of login times will resume when maintenance mode is disabled. +## 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. + --- ## MAPS_URL diff --git a/netbox/extras/admin.py b/netbox/extras/admin.py index 04a67b521..6cc503096 100644 --- a/netbox/extras/admin.py +++ b/netbox/extras/admin.py @@ -39,7 +39,10 @@ class ConfigRevisionAdmin(admin.ModelAdmin): 'fields': ('DEFAULT_USER_PREFERENCES',), }), ('Miscellaneous', { - 'fields': ('MAINTENANCE_MODE', 'GRAPHQL_ENABLED', 'CHANGELOG_RETENTION', 'JOB_RETENTION', 'MAPS_URL'), + 'fields': ( + 'MAINTENANCE_MODE', 'BANNER_MAINTENANCE', 'GRAPHQL_ENABLED', 'CHANGELOG_RETENTION', 'JOB_RETENTION', + 'MAPS_URL' + ), }), ('Config Revision', { 'fields': ('comment',), diff --git a/netbox/netbox/config/parameters.py b/netbox/netbox/config/parameters.py index 2bfa234f0..228cbd4f7 100644 --- a/netbox/netbox/config/parameters.py +++ b/netbox/netbox/config/parameters.py @@ -199,6 +199,13 @@ PARAMS = ( description=_("Enable maintenance mode"), field=forms.BooleanField ), + ConfigParam( + name='BANNER_MAINTENANCE', + label=_('Maintenance banner'), + default=None, + description=_('Additional content to display when in maintenance mode'), + field=forms.CharField, + ), ConfigParam( name='GRAPHQL_ENABLED', label=_('GraphQL enabled'), 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 %}