Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/configuration/miscellaneous.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion netbox/extras/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
11 changes: 11 additions & 0 deletions netbox/netbox/config/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ def __init__(self, name, label, default, description='', field=None, field_kwarg
),
},
),
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'),
Expand Down
4 changes: 2 additions & 2 deletions netbox/templates/base/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
</div>
{% endif %}

{% if config.MAINTENANCE_MODE %}
{% if config.MAINTENANCE_MODE and config.BANNER_MAINTENANCE %}
<div class="alert alert-warning text-center mx-3" role="alert">
<h5><i class="mdi mdi-alert"></i> Maintenance Mode</h5>
NetBox is currently in maintenance mode. Functionality may be limited.
{{ config.BANNER_MAINTENANCE|escape }}
</div>
{% endif %}

Expand Down