Stop preloading Admin Volumes tabs

API calls can take a long time, no need to preload all the tabs before
they are needed.

Change-Id: I51eb0ca2cf288a75a7c43d7c010affebf33b8912
Closes-Bug: 1357186
This commit is contained in:
Sam Betts 2014-08-18 12:52:10 +01:00
parent bf0c4aa49e
commit 94a22d0f33
2 changed files with 3 additions and 23 deletions

View File

@ -34,6 +34,7 @@ class VolumeTab(tabs.TableTab, volumes_tabs.VolumeTableMixIn):
name = _("Volumes")
slug = "volumes_tab"
template_name = "admin/volumes/volumes/volumes_tables.html"
preload = False
def get_volumes_data(self):
volumes = self._get_volumes(search_opts={'all_tenants': True})
@ -71,6 +72,7 @@ class SnapshotTab(tabs.TableTab):
name = _("Volume Snapshots")
slug = "snapshots_tab"
template_name = ("horizon/common/_detail_table.html")
preload = False
def get_volume_snapshots_data(self):
if api.base.is_service_enabled(self.request, 'volume'):

View File

@ -25,8 +25,7 @@ from openstack_dashboard.test import helpers as test
class VolumeTests(test.BaseAdminViewTests):
@test.create_stubs({api.nova: ('server_list',),
cinder: ('volume_list',
'volume_type_list',
'volume_snapshot_list'),
'volume_type_list',),
keystone: ('tenant_list',)})
def test_index(self):
cinder.volume_list(IsA(http.HttpRequest), search_opts={
@ -36,15 +35,6 @@ class VolumeTests(test.BaseAdminViewTests):
.AndReturn([self.servers.list(), False])
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
keystone.tenant_list(IsA(http.HttpRequest)) \
.AndReturn([self.tenants.list(), False])
cinder.volume_snapshot_list(IsA(http.HttpRequest), search_opts={
'all_tenants': True}).\
AndReturn(self.cinder_volume_snapshots.list())
cinder.volume_list(IsA(http.HttpRequest), search_opts={
'all_tenants': True}).\
AndReturn(self.cinder_volumes.list())
keystone.tenant_list(IsA(http.HttpRequest)). \
AndReturn([self.tenants.list(), False])
@ -123,21 +113,9 @@ class VolumeTests(test.BaseAdminViewTests):
@test.create_stubs({api.nova: ('server_list',),
cinder: ('volume_list',
'volume_type_list',
'volume_snapshot_list',),
keystone: ('tenant_list',)})
def test_snapshot_tab(self):
cinder.volume_list(IsA(http.HttpRequest), search_opts={
'all_tenants': True}).\
AndReturn(self.cinder_volumes.list())
api.nova.server_list(IsA(http.HttpRequest), search_opts={
'all_tenants': True}).\
AndReturn([self.servers.list(), False])
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
keystone.tenant_list(IsA(http.HttpRequest)). \
AndReturn([self.tenants.list(), False])
cinder.volume_snapshot_list(IsA(http.HttpRequest), search_opts={
'all_tenants': True}). \
AndReturn(self.cinder_volume_snapshots.list())