Merge "Fix generating empty pagination link in TableTab"

This commit is contained in:
Zuul 2020-09-19 10:40:22 +00:00 committed by Gerrit Code Review
commit fe74538ae2
7 changed files with 90 additions and 18 deletions

View File

@ -15,6 +15,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from horizon import utils as horizon_utils
from tacker_horizon.openstack_dashboard import api
from tacker_horizon.openstack_dashboard.dashboards.nfv.nscatalog import tables
@ -40,9 +41,15 @@ class NSCatalogTab(tabs.TableTab):
def get_nscatalog_data(self):
try:
self._has_more = False
instances = []
nsds = api.tacker.nsd_list(self.request)
if len(nsds) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for nsd in nsds:
item = NSCatalogItem(nsd['name'],
nsd['description'],
@ -84,10 +91,16 @@ class NSDEventsTab(tabs.TableTab):
def get_events_data(self):
try:
self._has_more = True
utils.EventItemList.clear_list()
events = api.tacker.events_list(self.request,
self.tab_group.kwargs['nsd_id'])
if len(events) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for event in events:
evt_obj = utils.EventItem(
event['id'], event['resource_state'],

View File

@ -13,6 +13,7 @@
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from horizon import utils as horizon_utils
from tacker_horizon.openstack_dashboard import api
from tacker_horizon.openstack_dashboard.dashboards.nfv.nsmanager import tables
@ -31,9 +32,15 @@ class NSManagerTab(tabs.TableTab):
def get_nsmanager_data(self):
try:
self._has_more = True
tables.NSManagerItemList.clear_list()
nss = api.tacker.ns_list(self.request)
if len(nss) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for ns in nss:
try:
ns_desc_str = ns['description']
@ -76,10 +83,16 @@ class NSEventsTab(tabs.TableTab):
def get_events_data(self):
try:
self._has_more = True
utils.EventItemList.clear_list()
events = api.tacker.events_list(self.request,
self.tab_group.kwargs['ns_id'])
if len(events) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for event in events:
evt_obj = utils.EventItem(
event['id'], event['resource_state'],

View File

@ -17,6 +17,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from horizon import utils as horizon_utils
from tacker_horizon.openstack_dashboard import api
from tacker_horizon.openstack_dashboard.dashboards.nfv import utils # noqa
@ -50,9 +51,15 @@ class VIMTab(tabs.TableTab):
def get_vim_data(self):
try:
self._has_more = False
instances = []
vims = api.tacker.vim_list(self.request)
if len(vims) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for vim in vims:
auth_cred = vim['auth_cred']
placement_attr = vim['placement_attr']
@ -97,10 +104,16 @@ class VIMEventsTab(tabs.TableTab):
def get_events_data(self):
try:
self._has_more = True
utils.EventItemList.clear_list()
events = api.tacker.events_list(self.request,
self.tab_group.kwargs['vim_id'])
if len(events) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for event in events:
evt_obj = utils.EventItem(
event['id'], event['resource_state'],

View File

@ -17,6 +17,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from horizon import utils as horizon_utils
from tacker_horizon.openstack_dashboard import api
from tacker_horizon.openstack_dashboard.dashboards.nfv import utils
@ -43,11 +44,16 @@ class VNFCatalogTab(tabs.TableTab):
def get_vnfcatalog_data(self):
try:
self._has_more = False
catalogs = []
vnfds = api.tacker.vnfd_list(self.request,
template_source="onboarded")
if len(vnfds) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for vnfd in vnfds:
s_types = [s_type for s_type in vnfd['service_types']]
s_types_string = ""
@ -94,10 +100,16 @@ class VNFDEventsTab(tabs.TableTab):
def get_events_data(self):
try:
self._has_more = True
utils.EventItemList.clear_list()
events = api.tacker.events_list(self.request,
self.tab_group.kwargs['vnfd_id'])
if len(events) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for event in events:
evt_obj = utils.EventItem(
event['id'], event['resource_state'],

View File

@ -16,6 +16,7 @@ import yaml
from horizon import exceptions
from horizon import tabs
from horizon import utils as horizon_utils
from tacker_horizon.openstack_dashboard import api
from tacker_horizon.openstack_dashboard.dashboards.nfv.vnffgcatalog \
@ -41,9 +42,15 @@ class VNFFGCatalogTab(tabs.TableTab):
def get_vnffgcatalog_data(self):
try:
self._has_more = False
instances = []
vnffgds = api.tacker.vnffgd_list(self.request)
if len(vnffgds) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for vnffgd in vnffgds:
item = VNFFGCatalogItem(vnffgd['name'],
vnffgd['description'],

View File

@ -14,6 +14,7 @@
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from horizon import utils as horizon_utils
from tacker_horizon.openstack_dashboard import api
from tacker_horizon.openstack_dashboard.dashboards.nfv.vnffgmanager \
@ -36,9 +37,15 @@ class VNFFGManagerTab(tabs.TableTab):
def get_vnffgmanager_data(self):
try:
self._has_more = True
VNFFGManagerItemList.clear_list()
vnffgs = api.tacker.vnffg_list(self.request)
if len(vnffgs) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for vnffg in vnffgs:
try:
vnffg_desc_str = vnffg['description']

View File

@ -15,6 +15,7 @@
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from horizon import utils as horizon_utils
from tacker_horizon.openstack_dashboard import api
from tacker_horizon.openstack_dashboard.dashboards.nfv import utils
@ -33,15 +34,15 @@ class VNFManagerTab(tabs.TableTab):
def get_vnfmanager_data(self):
try:
# marker = self.request.GET.get(
# tables.VNFManagerTable._meta.pagination_param, None)
# instances, self._has_more = api.nova.server_list(
# self.request,
# search_opts={'marker': marker, 'paginate': True})
self._has_more = True
tables.VNFManagerItemList.clear_list()
vnfs = api.tacker.vnf_list(self.request)
if len(vnfs) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for vnf in vnfs:
try:
vnf_services_str = vnf['attributes']['service_type']
@ -99,10 +100,16 @@ class VNFEventsTab(tabs.TableTab):
def get_events_data(self):
try:
self._has_more = True
utils.EventItemList.clear_list()
events = api.tacker.events_list(self.request,
self.tab_group.kwargs['vnf_id'])
if len(events) > horizon_utils.functions.get_page_size(
self.request):
self._has_more = True
else:
self._has_more = False
for event in events:
evt_obj = utils.EventItem(
event['id'], event['resource_state'],