diff --git a/netbox/extras/admin.py b/netbox/extras/admin.py index 5e2de7e16..6df9c55cf 100644 --- a/netbox/extras/admin.py +++ b/netbox/extras/admin.py @@ -28,9 +28,9 @@ class ConfigRevisionAdmin(admin.ModelAdmin): # ('Pagination', { # 'fields': ('MAX_PAGE_SIZE', 'PAGINATE_COUNT'), # }), - # ('Miscellaneous', { - # 'fields': ('GRAPHQL_ENABLED', 'METRICS_ENABLED', 'MAINTENANCE_MODE', 'MAPS_URL'), - # }), + ('Miscellaneous', { + 'fields': ('MAINTENANCE_MODE', 'MAPS_URL'), + }), ('Config Revision', { 'fields': ('comment',), }) diff --git a/netbox/netbox/config/parameters.py b/netbox/netbox/config/parameters.py index 8ad02a5dd..4e77cec0e 100644 --- a/netbox/netbox/config/parameters.py +++ b/netbox/netbox/config/parameters.py @@ -56,14 +56,14 @@ PARAMS = ( # Racks ConfigParam( name='RACK_ELEVATION_DEFAULT_UNIT_HEIGHT', - label='Rack Unit Height', + label='Rack unit height', default=22, description="Default unit height for rendered rack elevations", field=forms.IntegerField ), ConfigParam( name='RACK_ELEVATION_DEFAULT_UNIT_WIDTH', - label='Rack Unit Width', + label='Rack unit width', default=220, description="Default unit width for rendered rack elevations", field=forms.IntegerField @@ -82,4 +82,19 @@ PARAMS = ( field_kwargs={'base_field': forms.CharField()} ), + # Miscellaneous + ConfigParam( + name='MAINTENANCE_MODE', + label='Maintenance mode', + default=False, + description="Enable maintenance mode", + field=OptionalBooleanField + ), + ConfigParam( + name='MAPS_URL', + label='Maps URL', + default='https://maps.google.com/?q=', + description="Base URL for mapping geographic locations" + ), + ) diff --git a/netbox/netbox/configuration.example.py b/netbox/netbox/configuration.example.py index 63e74524a..c40ea4eff 100644 --- a/netbox/netbox/configuration.example.py +++ b/netbox/netbox/configuration.example.py @@ -158,12 +158,6 @@ LOGIN_REQUIRED = False # re-authenticate. (Default: 1209600 [14 days]) LOGIN_TIMEOUT = None -# Setting this to True will display a "maintenance mode" banner at the top of every page. -MAINTENANCE_MODE = False - -# The URL to use when mapping physical addresses or GPS coordinates -MAPS_URL = 'https://maps.google.com/?q=' - # An API consumer can request an arbitrary number of objects =by appending the "limit" parameter to the URL (e.g. # "?limit=1000"). This setting defines the maximum limit. Setting it to 0 or None will allow an API consumer to request # all objects by specifying "?limit=0". diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index f42c99dbf..beae4d568 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -128,8 +128,6 @@ GRAPHQL_ENABLED = getattr(configuration, 'GRAPHQL_ENABLED', True) LOGIN_PERSISTENCE = getattr(configuration, 'LOGIN_PERSISTENCE', False) LOGIN_REQUIRED = getattr(configuration, 'LOGIN_REQUIRED', False) LOGIN_TIMEOUT = getattr(configuration, 'LOGIN_TIMEOUT', None) -MAINTENANCE_MODE = getattr(configuration, 'MAINTENANCE_MODE', False) -MAPS_URL = getattr(configuration, 'MAPS_URL', 'https://maps.google.com/?q=') MAX_PAGE_SIZE = getattr(configuration, 'MAX_PAGE_SIZE', 1000) METRICS_ENABLED = getattr(configuration, 'METRICS_ENABLED', False) NAPALM_ARGS = getattr(configuration, 'NAPALM_ARGS', {}) diff --git a/netbox/templates/base/layout.html b/netbox/templates/base/layout.html index a4c8c77b6..2770a6dc6 100644 --- a/netbox/templates/base/layout.html +++ b/netbox/templates/base/layout.html @@ -64,7 +64,7 @@ {% endif %} - {% if settings.MAINTENANCE_MODE %} + {% if config.MAINTENANCE_MODE %}