Merge "Enable to refresh ngdetails view" into stable/pike

This commit is contained in:
Zuul 2018-02-15 05:59:25 +00:00 committed by Gerrit Code Review
commit 5d77b95586
5 changed files with 48 additions and 0 deletions

View File

@ -869,6 +869,13 @@ class Site(Registry, HorizonComponent):
urlpatterns.append(url(r'^%s/' % dash.slug,
include(dash._decorated_urls)))
# add URL for ngdetails
views = import_module('horizon.browsers.views')
urlpatterns.append(url(r'^ngdetails/',
views.AngularDetailsView.as_view(),
name='ngdetails'))
_decorate_urlconf(urlpatterns, require_auth)
# Return the three arguments to django.conf.urls.include
return urlpatterns, self.namespace, self.slug

View File

@ -15,6 +15,7 @@
from django.utils.translation import ugettext_lazy as _
from django.views import generic
import horizon
from horizon.tables import MultiTableView
from horizon.utils import memoized
@ -83,3 +84,23 @@ class AngularIndexView(generic.TemplateView):
else:
context["page_title"] = self.page_title
return context
class AngularDetailsView(generic.TemplateView):
'''View for Angularized details view
This is used to load ngdetails view via Django.
i.e. refresh or link directly for '^ngdetails/'
'''
template_name = 'angular.html'
def get_context_data(self, **kwargs):
context = super(AngularDetailsView, self).get_context_data(**kwargs)
# some parameters are needed for navigation side bar and breadcrumb.
title = _("Horizon")
context["title"] = title
context["page_title"] = title
dashboard = horizon.get_default_dashboard()
self.request.horizon['dashboard'] = dashboard
self.request.horizon['panel'] = dashboard.get_panels()[0]
return context

View File

@ -328,6 +328,12 @@ class HorizonTests(BaseHorizonTests):
# Restore settings
settings.SECURE_PROXY_SSL_HEADER = None
def test_urls_ngdetails(self):
resp = self.client.get("/ngdetails/")
self.assertEqual(200, resp.status_code)
resp = self.client.get("/ngdetails/OS::Glance::Image/xxxxx-xxx")
self.assertEqual(200, resp.status_code)
class GetUserHomeTests(BaseHorizonTests):
"""Test get_user_home parameters."""

View File

@ -0,0 +1,14 @@
---
issues:
- |
[:bug:`1746706`] When reloading or opening Angular-based detail page
directly, the navigation menu and breadcrumb list are not recovered
properly and the first panel is focused.
[:bug:`1746709`] when we try to open non-existing Angular-based detail
page, "Not Found" (404) page is not shown. A blank page only with
the navigation menu will be shown.
fixes:
- |
[:bug:`1681627`] A problem that Angular-based detail page (ngdetail page)
cannot be reloaded or opened via direct URL has been fixed. Note that
there are some known issues described in the `Known Issues`_ section.