diff -Nru horizon-11.0.4/debian/changelog horizon-11.0.4/debian/changelog --- horizon-11.0.4/debian/changelog 2018-07-16 21:24:31.000000000 +0800 +++ horizon-11.0.4/debian/changelog 2019-04-03 10:51:19.000000000 +0800 @@ -1,3 +1,11 @@ +horizon (3:11.0.4-0ubuntu1~cloud2.6) xenial; urgency=medium + + * Enable to refresh ngdetails view (LP: #1681627) + - d/p/0001-Enable-to-refresh-ngdetails-view.patch + - d/p/0002-Fix-Angular-errors-in-openstack_auth.patch + + -- Zhang Hua Wed, 03 Apr 2019 10:51:19 +0800 + horizon (3:11.0.4-0ubuntu1~cloud2.5) xenial-ocata; urgency=medium * d/openstack-dashboard.preinst: Prior to installing package, ensure diff -Nru horizon-11.0.4/debian/patches/0001-Enable-to-refresh-ngdetails-view.patch horizon-11.0.4/debian/patches/0001-Enable-to-refresh-ngdetails-view.patch --- horizon-11.0.4/debian/patches/0001-Enable-to-refresh-ngdetails-view.patch 1970-01-01 08:00:00.000000000 +0800 +++ horizon-11.0.4/debian/patches/0001-Enable-to-refresh-ngdetails-view.patch 2019-04-03 10:47:47.000000000 +0800 @@ -0,0 +1,136 @@ +From ddb537ec649e6a305d59349eea5448bea0901c51 Mon Sep 17 00:00:00 2001 +From: Shu Muto +Date: Thu, 16 Nov 2017 16:55:46 +0900 +Subject: [PATCH] Enable to refresh ngdetails view + +For now, refreshing ngdetails view by browser using F5 key or reload +button, it causes 404 error from django. To fix this issue, this patch +adds the url for '/ngdetails' into django. + +To reproduce navigations, each request for views.py requires +'dashboard' and 'panel' object. Otherwise django side returns +500 error. + +However the URL for request of details page (i.e. /ngdetails/) +can not provide informations to set the proper navigation. + +So this patch set them to default dashboard and default panel. + +This patch focuses to prevent 500 error. So the issue for +settings of proper navigation will be fixed by subsequent patch. + +Change-Id: Ib9f1fe48b3cdecff5ad56e68a5ba58a41cb35f38 +Closes-Bug: #1681627 +(cherry picked from commit 077163a03c9aea08efd56251e49d69eb1cc4d093) +(cherry picked from commit a0fc40b4e85d3090e657cca9824de719b33a7ba2) +Signed-off-by: Zhang Hua +Origin: upstream, https://git.openstack.org/cgit/openstack/horizon/ \ + commit/?id=f557a8dd34e91b60de2f4a192aad3a0861b4b5ac +Bug-Ubuntu: https://bugs.launchpad.net/horizon/+bug/1681627 +--- + horizon/base.py | 7 +++++++ + horizon/browsers/views.py | 21 +++++++++++++++++++ + horizon/test/tests/base.py | 6 ++++++ + horizon/test/tests/templates/angular.html | 0 + .../ngdetail-reload-e711a77b2d07191a.yaml | 14 +++++++++++++ + 5 files changed, 48 insertions(+) + create mode 100644 horizon/test/tests/templates/angular.html + create mode 100644 releasenotes/notes/ngdetail-reload-e711a77b2d07191a.yaml + +diff --git a/horizon/base.py b/horizon/base.py +index 93630e735..271c287f5 100644 +--- a/horizon/base.py ++++ b/horizon/base.py +@@ -865,6 +865,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 + +diff --git a/horizon/browsers/views.py b/horizon/browsers/views.py +index 10ef3238d..8701e694d 100644 +--- a/horizon/browsers/views.py ++++ b/horizon/browsers/views.py +@@ -15,6 +15,7 @@ + from django.utils.translation import ugettext_lazy as _ + from django.views import generic + ++import horizon + from horizon.tables import MultiTableView # noqa + 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 +diff --git a/horizon/test/tests/base.py b/horizon/test/tests/base.py +index 53869c165..c330d9744 100644 +--- a/horizon/test/tests/base.py ++++ b/horizon/test/tests/base.py +@@ -326,6 +326,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.""" +diff --git a/horizon/test/tests/templates/angular.html b/horizon/test/tests/templates/angular.html +new file mode 100644 +index 000000000..e69de29bb +diff --git a/releasenotes/notes/ngdetail-reload-e711a77b2d07191a.yaml b/releasenotes/notes/ngdetail-reload-e711a77b2d07191a.yaml +new file mode 100644 +index 000000000..c62ad32a7 +--- /dev/null ++++ b/releasenotes/notes/ngdetail-reload-e711a77b2d07191a.yaml +@@ -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. +-- +2.17.1 + diff -Nru horizon-11.0.4/debian/patches/0002-Fix-Angular-errors-in-openstack_auth.patch horizon-11.0.4/debian/patches/0002-Fix-Angular-errors-in-openstack_auth.patch --- horizon-11.0.4/debian/patches/0002-Fix-Angular-errors-in-openstack_auth.patch 1970-01-01 08:00:00.000000000 +0800 +++ horizon-11.0.4/debian/patches/0002-Fix-Angular-errors-in-openstack_auth.patch 2019-04-03 10:48:47.000000000 +0800 @@ -0,0 +1,165 @@ +From 8076dae032be818115c75e285106a349eb180f6b Mon Sep 17 00:00:00 2001 +From: Shu Muto +Date: Wed, 14 Mar 2018 11:43:12 +0900 +Subject: [PATCH] Fix Angular errors in openstack_auth + +Angular errors on login page are caused by loading ngdetails view. +Although registration of URL for ngdetails is executed on top level +of Horizon, ngdetails view is not needed to be loaded in login page, +i.e. openstack_auth side. +To fix this issue, this patch moves registration of URL for ngdetails +into openstack_dashboard side. + +Conflicts: + openstack_dashboard/test/urls.py + openstack_dashboard/urls.py + +The above conflicts are caused by bp/django2-support which landed in Rocky, +particully by https://review.openstack.org/#/c/527323/12. + +Another problem: + +ngdetails url doesn't have project prefix after Ocata release, pls see: +https://github.com/openstack/horizon/blob/stable/ocata/ \ + openstack_dashboard/static/app/core/images/images.service.js#L59 +https://github.com/openstack/horizon/blob/stable/pike/ \ + openstack_dashboard/static/app/core/images/images.service.js#L69 + +So the following simple changes need to be made in urls.py +in addition to the primitive backport patches. + +-ngdetails_url = url(r'^ngdetails/', ++ngdetails_url = url(r'^project/ngdetails/', + +Change-Id: Ib039417b4e666c2341f17ac05fd7723bc758816c +Closes-Bug: #1754133 +Closes-Bug: #1753557 +(cherry picked from commit f494c6f2d475bfc936b78fda7ce11ed4d46c7224) +(cherry picked from commit 6f6f46dc6d2f38719b114a80edabe2eb01b1ab06) +Signed-off-by: Zhang Hua +Origin: upstream, https://git.openstack.org/cgit/openstack/horizon/ \ + commit/?id=c920dc9d42bea38a5ea9d1964161f14a80fe7ae7 +Bug-Ubuntu: https://bugs.launchpad.net/horizon/+bug/1681627 +--- + horizon/base.py | 7 ------- + horizon/test/tests/base.py | 6 ------ + openstack_dashboard/test/urls.py | 5 +++++ + openstack_dashboard/test/views.py | 23 +++++++++++++++++++++++ + openstack_dashboard/urls.py | 10 ++++++++++ + 5 files changed, 38 insertions(+), 13 deletions(-) + create mode 100644 openstack_dashboard/test/views.py + +Index: horizon-11.0.4/horizon/base.py +=================================================================== +--- horizon-11.0.4.orig/horizon/base.py ++++ horizon-11.0.4/horizon/base.py +@@ -865,13 +865,6 @@ 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 + +Index: horizon-11.0.4/horizon/test/tests/base.py +=================================================================== +--- horizon-11.0.4.orig/horizon/test/tests/base.py ++++ horizon-11.0.4/horizon/test/tests/base.py +@@ -326,12 +326,6 @@ 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.""" +Index: horizon-11.0.4/openstack_dashboard/test/urls.py +=================================================================== +--- horizon-11.0.4.orig/openstack_dashboard/test/urls.py ++++ horizon-11.0.4/openstack_dashboard/test/urls.py +@@ -24,6 +24,8 @@ from django.conf.urls import url + from django.contrib.staticfiles.urls import staticfiles_urlpatterns # noqa + from django.views import defaults + ++from horizon.browsers import views as browsers_views ++ + from openstack_dashboard.api import rest + from openstack_dashboard.test.jasmine import jasmine + from openstack_dashboard import views +@@ -36,6 +38,9 @@ urlpatterns = [ + url(r'^api/', include(rest.urls)), + url(r'^jasmine/(.*?)$', jasmine.dispatcher), + url(r'', include(horizon.urls)), ++ url(r'^project/ngdetails/', ++ browsers_views.AngularDetailsView.as_view(), ++ name='ngdetails'), + ] + + # Development static app and project media serving using the staticfiles app. +Index: horizon-11.0.4/openstack_dashboard/test/views.py +=================================================================== +--- /dev/null ++++ horizon-11.0.4/openstack_dashboard/test/views.py +@@ -0,0 +1,23 @@ ++# Licensed under the Apache License, Version 2.0 (the "License"); you may ++# not use this file except in compliance with the License. You may obtain ++# a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ++# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ++# License for the specific language governing permissions and limitations ++# under the License. ++ ++from openstack_dashboard.test import helpers as test ++ ++ ++class DashboardViewsTest(test.TestCase): ++ ++ def test_urls_ngdetails(self): ++ resp = self.client.get("/project/ngdetails/") ++ self.assertEqual(200, resp.status_code) ++ resp = self.client.get("/project/ngdetails/" ++ "OS::Glance::Image/xxxxx-xxx") ++ self.assertEqual(200, resp.status_code) +Index: horizon-11.0.4/openstack_dashboard/urls.py +=================================================================== +--- horizon-11.0.4.orig/openstack_dashboard/urls.py ++++ horizon-11.0.4/openstack_dashboard/urls.py +@@ -28,6 +28,9 @@ from django.contrib.staticfiles.urls imp + from django.views import defaults + + import horizon ++import horizon.base ++from horizon.browsers import views as browsers_views ++from horizon.decorators import require_auth + + from openstack_dashboard.api import rest + from openstack_dashboard import views +@@ -38,6 +41,13 @@ urlpatterns = [ + url(r'', include(horizon.urls)), + ] + ++# add URL for ngdetails ++ngdetails_url = url(r'^project/ngdetails/', ++ browsers_views.AngularDetailsView.as_view(), ++ name='ngdetails') ++urlpatterns.append(ngdetails_url) ++horizon.base._decorate_urlconf([ngdetails_url], require_auth) ++ + for u in getattr(settings, 'AUTHENTICATION_URLS', ['openstack_auth.urls']): + urlpatterns.append(url(r'^auth/', include(u))) + diff -Nru horizon-11.0.4/debian/patches/series horizon-11.0.4/debian/patches/series --- horizon-11.0.4/debian/patches/series 2018-07-16 21:24:31.000000000 +0800 +++ horizon-11.0.4/debian/patches/series 2019-04-03 10:48:25.000000000 +0800 @@ -6,3 +6,5 @@ add-juju-environment-download.patch fetch-cinder-availability-zones-list-for-volume-creation.patch fix_create_consistency_group_form_exception.patch +0001-Enable-to-refresh-ngdetails-view.patch +0002-Fix-Angular-errors-in-openstack_auth.patch