Move openstack_dashboard specific settings from horizon
Cookie-based settings related to openstack_dashboard are located under horizon directory,, but they are not related to "horizon". This commit moves them to "openstack_dashboard" directory. Part of blueprint ini-based-configuration Change-Id: Id48ececdbe819a95485e9a91dc5a1a163a5568c3
This commit is contained in:
parent
02d9a05eea
commit
7c897b677c
@ -100,14 +100,6 @@ def save_config_value(request, response, key, value):
|
||||
return response
|
||||
|
||||
|
||||
def get_page_size(request):
|
||||
return get_config_value(request, 'API_RESULT_PAGE_SIZE', 20)
|
||||
|
||||
|
||||
def get_log_length(request):
|
||||
return get_config_value(request, 'INSTANCE_LOG_LENGTH', 35)
|
||||
|
||||
|
||||
def get_timezone(request):
|
||||
# Session and cookie store timezone as django_timezone.
|
||||
# In case there is no timezone neither in session nor in cookie,
|
||||
|
@ -32,13 +32,14 @@ from cinderclient import exceptions as cinder_exception
|
||||
from cinderclient.v2.contrib import list_extensions as cinder_list_extensions
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon.utils import functions as utils
|
||||
from horizon.utils.memoized import memoized
|
||||
|
||||
from openstack_dashboard.api import _nova
|
||||
from openstack_dashboard.api import base
|
||||
from openstack_dashboard.api import microversions
|
||||
from openstack_dashboard.contrib.developer.profiler import api as profiler
|
||||
from openstack_dashboard.utils import settings as utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -34,10 +34,10 @@ import glanceclient as glance_client
|
||||
import six
|
||||
from six.moves import _thread as thread
|
||||
|
||||
from horizon.utils import functions as utils
|
||||
from horizon.utils.memoized import memoized
|
||||
from openstack_dashboard.api import base
|
||||
from openstack_dashboard.contrib.developer.profiler import api as profiler
|
||||
from openstack_dashboard.utils import settings as utils
|
||||
|
||||
# Python 3.8 removes the ability to import the abstract base classes from
|
||||
# 'collections', but 'collections.abc' is not present in Python 2.7
|
||||
|
@ -34,11 +34,11 @@ from openstack_auth import utils as auth_utils
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import messages
|
||||
from horizon.utils import functions as utils
|
||||
|
||||
from openstack_dashboard.api import base
|
||||
from openstack_dashboard.contrib.developer.profiler import api as profiler
|
||||
from openstack_dashboard import policy
|
||||
from openstack_dashboard.utils import settings as utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -34,13 +34,13 @@ from novaclient.v2 import list_extensions as nova_list_extensions
|
||||
from novaclient.v2 import servers as nova_servers
|
||||
|
||||
from horizon import exceptions as horizon_exceptions
|
||||
from horizon.utils import functions as utils
|
||||
from horizon.utils import memoized
|
||||
|
||||
from openstack_dashboard.api import _nova
|
||||
from openstack_dashboard.api import base
|
||||
from openstack_dashboard.api import cinder
|
||||
from openstack_dashboard.contrib.developer.profiler import api as profiler
|
||||
from openstack_dashboard.utils import settings as utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -18,7 +18,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
from horizon.utils import functions as utils
|
||||
|
||||
from openstack_dashboard.dashboards.project.instances \
|
||||
import audit_tables as a_tables
|
||||
@ -26,6 +25,7 @@ from openstack_dashboard.dashboards.project.instances \
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.project.instances import console
|
||||
from openstack_dashboard.dashboards.project.instances import interfaces_tables
|
||||
from openstack_dashboard.utils import settings as settings_utils
|
||||
|
||||
|
||||
class OverviewTab(tabs.Tab):
|
||||
@ -72,7 +72,7 @@ class LogTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
instance = self.tab_group.kwargs['instance']
|
||||
log_length = utils.get_log_length(request)
|
||||
log_length = settings_utils.get_log_length(request)
|
||||
try:
|
||||
data = api.nova.server_console_output(request,
|
||||
instance.id,
|
||||
|
@ -18,6 +18,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import forms
|
||||
from horizon.utils import functions as utils
|
||||
from openstack_dashboard.dashboards.settings.user import forms as user_forms
|
||||
from openstack_dashboard.utils import settings as settings_utils
|
||||
|
||||
|
||||
class UserSettingsView(forms.ModalFormView):
|
||||
@ -33,8 +34,9 @@ class UserSettingsView(forms.ModalFormView):
|
||||
return {
|
||||
'language': utils.get_language(self.request),
|
||||
'timezone': utils.get_timezone(self.request),
|
||||
'pagesize': utils.get_page_size(self.request),
|
||||
'instance_log_length': utils.get_log_length(self.request)}
|
||||
'pagesize': settings_utils.get_page_size(self.request),
|
||||
'instance_log_length': settings_utils.get_log_length(self.request),
|
||||
}
|
||||
|
||||
def form_valid(self, form):
|
||||
return form.handle(self.request, form.cleaned_data)
|
||||
|
@ -17,7 +17,10 @@ import os
|
||||
import pkgutil
|
||||
import re
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from horizon.utils import file_discovery
|
||||
from horizon.utils import functions as utils
|
||||
from openstack_dashboard import theme_settings
|
||||
|
||||
|
||||
@ -368,3 +371,13 @@ def find_static_files(
|
||||
|
||||
# Add the theme file info to the horizon config for use by template tags
|
||||
HORIZON_CONFIG['theme_static_files'] = theme_static_files
|
||||
|
||||
|
||||
def get_page_size(request):
|
||||
return utils.get_config_value(request, 'API_RESULT_PAGE_SIZE',
|
||||
settings.API_RESULT_PAGE_SIZE)
|
||||
|
||||
|
||||
def get_log_length(request):
|
||||
return utils.get_config_value(request, 'INSTANCE_LOG_LENGTH',
|
||||
settings.INSTANCE_LOG_LENGTH)
|
||||
|
Loading…
x
Reference in New Issue
Block a user