diff options
author | Shu Muto <shu-mutou@rf.jp.nec.com> | 2017-11-16 16:55:46 +0900 |
---|---|---|
committer | Akihiro Motoki <amotoki@gmail.com> | 2018-02-01 20:30:03 +0900 |
commit | 077163a03c9aea08efd56251e49d69eb1cc4d093 (patch) | |
tree | d9cdef9efbb1f4f3a517093e64aa7b137c675e18 /horizon/browsers | |
parent | 7c087f0cadde861cd42090cf562bae25385f5e5b (diff) | |
download | horizon-077163a03c9aea08efd56251e49d69eb1cc4d093.tar.gz |
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
Diffstat (limited to 'horizon/browsers')
-rw-r--r-- | horizon/browsers/views.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/horizon/browsers/views.py b/horizon/browsers/views.py index 9d4bf769d..81e0c5cff 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 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 |