Remove admin_filter_first from horizon module to avoid confusion

The admin_filter_first attribute in
'horizon.tables.views.MultiTableMixin' causes confusion since "admin"
is an OpenStack concept. The intention of this attribute is just to
provide a setting that allows views to request for a search criteria
first before loading data, not to merge concepts between 'horizon' and
'openstack_dashboard'. Removing the setting from it's original position
and permorming the check of the setting in each admin view that
whishes to implement admin-filter-first should eliminate this confusion

Change-Id: I77fb0566155e5e5b868cb86c5718ca7048d5d7d4
This commit is contained in:
Luis Daniel Castellanos committed 2016-08-18 15:24:41 -05:00
1 parent d668fcd81b
commit adabe6ec3b
3 files changed
+10 -9

No files matched your search

-4
View File
@@ -14,7 +14,6 @@
from collections import defaultdict
from django.conf import settings
from django import shortcuts
from horizon import views
@@ -33,9 +32,6 @@ class MultiTableMixin(object):
self._tables = {}
self._data_methods = defaultdict(list)
self.get_data_methods(self.table_classes, self._data_methods)
self.admin_filter_first = getattr(settings,
'ADMIN_FILTER_DATA_FIRST',
False)
def _get_data_dict(self):
if not self._data:
@@ -20,6 +20,7 @@ import logging
from oslo_utils import units
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
@@ -69,7 +70,8 @@ class IndexView(tables.DataTableView):
return images
filters = self.get_filters()
if self.admin_filter_first and \
filter_first = getattr(settings, 'ADMIN_FILTER_DATA_FIRST', False)
if filter_first and \
len(filters) == len(self.DEFAULT_FILTERS):
self._prev = False
self._more = False
@@ -18,6 +18,8 @@
# under the License.
from collections import OrderedDict
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
@@ -81,10 +83,11 @@ class AdminIndexView(tables.DataTableView):
search_opts = self.get_filters(default_search_opts.copy())
"""If admin_filter_first is set and if there are not other filters
selected, then search criteria must be provided and return an empty
list"""
if self.admin_filter_first and \
# If filter_first is set and if there are not other filters
# selected, then search criteria must be provided and return an empty
# list
filter_first = getattr(settings, 'ADMIN_FILTER_DATA_FIRST', False)
if filter_first and \
len(search_opts) == len(default_search_opts):
self._needs_filter_first = True
self._more = False