Consolidated common angular view

We have views that references angular.html all over the dashboard.
This patch creates a single view for angular views and consolidate others.

Change-Id: I31bd7eb1ce9eac5ec4e13531679b12fc5ebbe60b
This commit is contained in:
Thai Tran 2016-11-17 11:33:13 -08:00
parent 7018cd3fea
commit 8c7c33381c
14 changed files with 20 additions and 111 deletions

View File

@ -13,6 +13,7 @@
# under the License.
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from horizon.tables import MultiTableView # noqa
from horizon.utils import memoized
@ -56,3 +57,7 @@ class ResourceBrowserView(MultiTableView):
browser = self.get_browser()
context["%s_browser" % browser.name] = browser
return context
class AngularIndexView(generic.TemplateView):
template_name = 'angular.html'

View File

@ -13,8 +13,8 @@
# under the License.
from django.conf.urls import url
from openstack_dashboard.contrib.developer.resource_browser import views
from horizon.browsers.views import AngularIndexView
urlpatterns = [
url('', views.IndexView.as_view(), name='index'),
url('', AngularIndexView.as_view(), name='index'),
]

View File

@ -1,19 +0,0 @@
# (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 django.views import generic
class IndexView(generic.TemplateView):
template_name = 'angular.html'

View File

@ -18,16 +18,16 @@
from django.conf import settings
from django.conf.urls import url
from horizon.browsers.views import AngularIndexView
from openstack_dashboard.dashboards.admin.flavors import views
if settings.ANGULAR_FEATURES['flavors_panel']:
# New angular panel
urlpatterns = [
url(r'^$', views.AngularIndexView.as_view(), name='index'),
url(r'^create/$', views.AngularIndexView.as_view(), name='create'),
url(r'^(?P<id>[^/]+)/update/$', views.AngularIndexView.as_view(),
url(r'^$', AngularIndexView.as_view(), name='index'),
url(r'^create/$', AngularIndexView.as_view(), name='create'),
url(r'^(?P<id>[^/]+)/update/$', AngularIndexView.as_view(),
name='index'),
]
else:

View File

@ -18,7 +18,6 @@
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from horizon import exceptions
from horizon import tables
@ -35,10 +34,6 @@ from openstack_dashboard.dashboards.admin.flavors \
INDEX_URL = "horizon:admin:flavors:index"
class AngularIndexView(generic.TemplateView):
template_name = 'angular.html'
class IndexView(tables.DataTableView):
table_class = project_tables.FlavorsTable
template_name = 'admin/flavors/index.html'

View File

@ -18,15 +18,15 @@
from django.conf import settings
from django.conf.urls import url
from horizon.browsers.views import AngularIndexView
from openstack_dashboard.dashboards.admin.images import views
if settings.ANGULAR_FEATURES['images_panel']:
# New angular images
urlpatterns = [
url(r'^$', views.AngularIndexView.as_view(), name='index'),
url(r'^$', AngularIndexView.as_view(), name='index'),
url(r'^(?P<image_id>[^/]+)/detail/$',
views.AngularIndexView.as_view(), name='detail'),
AngularIndexView.as_view(), name='detail'),
]
else:
urlpatterns = [

View File

@ -24,7 +24,6 @@ from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from horizon import exceptions
from horizon import messages
@ -42,10 +41,6 @@ from openstack_dashboard.dashboards.admin.images \
LOG = logging.getLogger(__name__)
class AngularIndexView(generic.TemplateView):
template_name = 'angular.html'
class IndexView(tables.DataTableView):
DEFAULT_FILTERS = {'is_public': None}
table_class = project_tables.AdminImagesTable

View File

@ -18,14 +18,13 @@
from django.conf import settings
from django.conf.urls import url
from horizon.browsers.views import AngularIndexView
from openstack_dashboard.dashboards.project.images.images import views
from openstack_dashboard.dashboards.project.images import views as imgviews
if settings.ANGULAR_FEATURES['images_panel']:
urlpatterns = [
url(r'^(?P<image_id>[^/]+)/$', imgviews.AngularIndexView.as_view(),
url(r'^(?P<image_id>[^/]+)/$', AngularIndexView.as_view(),
name='detail'),
]
else:

View File

@ -19,7 +19,7 @@
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import url
from horizon.browsers.views import AngularIndexView
from openstack_dashboard.dashboards.project.images.images \
import urls as image_urls
from openstack_dashboard.dashboards.project.images.snapshots \
@ -30,7 +30,7 @@ from openstack_dashboard.dashboards.project.images import views
if settings.ANGULAR_FEATURES['images_panel']:
# New angular images
urlpatterns = [
url(r'^$', views.AngularIndexView.as_view(), name='index'),
url(r'^$', AngularIndexView.as_view(), name='index'),
url(r'', include(image_urls, namespace='images')),
url(r'', include(snapshot_urls, namespace='snapshots')),
]

View File

@ -22,7 +22,6 @@ Views for managing Images and Snapshots.
"""
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from horizon import exceptions
from horizon import messages
@ -35,10 +34,6 @@ from openstack_dashboard.dashboards.project.images.images \
import tables as images_tables
class AngularIndexView(generic.TemplateView):
template_name = 'angular.html'
class IndexView(tables.DataTableView):
table_class = images_tables.ImagesTable
template_name = 'project/images/index.html'

View File

@ -1,22 +0,0 @@
# (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 django.conf.urls import url
from openstack_dashboard.dashboards.project.ngdetails import views
urlpatterns = [
url('', views.IndexView.as_view(), name='index'),
]

View File

@ -1,19 +0,0 @@
# (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 django.views import generic
class IndexView(generic.TemplateView):
template_name = 'angular.html'

View File

@ -13,10 +13,9 @@
# under the License.
from django.conf.urls import url
from openstack_dashboard.dashboards.project.ngvolumes import views
from horizon.browsers.views import AngularIndexView
urlpatterns = [
url('', views.IndexView.as_view(), name='index'),
url('', AngularIndexView.as_view(), name='index'),
]

View File

@ -1,19 +0,0 @@
# (c) Copyright 2016 NEC Corporation, L.P.
#
# 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 django.views import generic
class IndexView(generic.TemplateView):
template_name = 'angular.html'