Remove an unused method in admin/hypervisors view

AdminIndexView.get_data() in view.py is removed as it is not called
at all; HypervisorTab.get_hypervisors_data() in tabs.py is called to
fetch a list of hypervisors.

Also, add natural_sort to the list of hypervisors in HypervisorTab.

Change-Id: I0fbcca126d1bfac71990efcfc4982f98c1bd3c1a
This commit is contained in:
Arata Notsu 2015-08-18 19:27:19 +09:00
parent 363a341e9a
commit 85ab738c4e
2 changed files with 2 additions and 12 deletions

View File

@ -14,6 +14,7 @@ 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.api import nova
from openstack_dashboard.dashboards.admin.hypervisors.compute \
@ -31,6 +32,7 @@ class HypervisorTab(tabs.TableTab):
hypervisors = []
try:
hypervisors = nova.hypervisor_list(self.request)
hypervisors.sort(key=utils.natural_sort('hypervisor_hostname'))
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve hypervisor information.'))

View File

@ -18,7 +18,6 @@ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tables
from horizon import tabs
from horizon.utils import functions as utils
from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.hypervisors \
@ -32,17 +31,6 @@ class AdminIndexView(tabs.TabbedTableView):
template_name = 'admin/hypervisors/index.html'
page_title = _("All Hypervisors")
def get_data(self):
hypervisors = []
try:
hypervisors = api.nova.hypervisor_list(self.request)
hypervisors.sort(key=utils.natural_sort('hypervisor_hostname'))
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve hypervisor information.'))
return hypervisors
def get_context_data(self, **kwargs):
context = super(AdminIndexView, self).get_context_data(**kwargs)
try: