Remove owner filter from Package Definitions page

This patch deletes owner filter which breaks pagination and leads to
the impossibility to add filter by package name

Change-Id: Iae8cd43b6b4034f38d8064536028790afe333c5a
Partial-Bug: #1476682
Closes-Bug: #1475277
This commit is contained in:
Dmytro Dovbii 2015-09-04 15:48:07 +03:00
parent 4cf9fc2a77
commit 626b21824c
1 changed files with 1 additions and 57 deletions

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from collections import defaultdict
from django.core.urlresolvers import reverse
from django import http
from django.template import defaultfilters
@ -194,58 +192,6 @@ class ModifyPackage(tables.LinkAction):
return True
def get_package_categories(pkg, user_tenant_id):
categories = []
if pkg.is_public:
categories.append('public')
if pkg.owner_id == user_tenant_id:
categories.append('project')
else:
categories.append('other')
return categories
class OwnerFilter(tables.FixedFilterAction):
def get_fixed_buttons(self):
def make_dict(text, tenant, icon):
return dict(text=text, value=tenant, icon=icon)
buttons = [make_dict(_('Project'), 'project', 'fa-home')]
buttons.append(make_dict(_('Public'), 'public', 'fa-group'))
buttons.append(make_dict(_('Other'), 'other', 'fa-cloud'))
return buttons
def categorize(self, table, packages):
user_tenant_id = table.request.user.tenant_id
tenants = defaultdict(list)
for pkg in packages:
categories = get_package_categories(pkg, user_tenant_id)
for category in categories:
tenants[category].append(pkg)
return tenants
def allowed(self, request, package):
return request.user.is_superuser
class UpdateRow(tables.Row):
ajax = True
def get_data(self, request, package_id):
package = api.muranoclient(request).packages.get(package_id)
return package
def load_cells(self, package=None):
super(UpdateRow, self).load_cells(package)
package = self.datum
my_tenant_id = self.table.request.user.tenant_id
pkg_categories = get_package_categories(package, my_tenant_id)
for category in pkg_categories:
self.classes.append('category-' + category)
class PackageDefinitionsTable(tables.DataTable):
name = tables.Column('name', verbose_name=_('Package Name'))
enabled = tables.Column('enabled', verbose_name=_('Active'))
@ -266,9 +212,7 @@ class PackageDefinitionsTable(tables.DataTable):
prev_pagination_param = 'marker'
verbose_name = _('Package Definitions')
template = 'common/_data_table.html'
row_class = UpdateRow
table_actions = (OwnerFilter,
ImportPackage,
table_actions = (ImportPackage,
ImportBundle,
ToggleEnabled,
TogglePublicEnabled,