summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/project/stacks/template_versions/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstack_dashboard/dashboards/project/stacks/template_versions/views.py')
-rw-r--r--openstack_dashboard/dashboards/project/stacks/template_versions/views.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/openstack_dashboard/dashboards/project/stacks/template_versions/views.py b/openstack_dashboard/dashboards/project/stacks/template_versions/views.py
deleted file mode 100644
index 22eabd7..0000000
--- a/openstack_dashboard/dashboards/project/stacks/template_versions/views.py
+++ /dev/null
@@ -1,61 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10# implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14from django.core.urlresolvers import reverse
15from django.utils.translation import ugettext_lazy as _
16
17from horizon import exceptions
18from horizon import tables
19from horizon import tabs
20
21from openstack_dashboard import api
22import openstack_dashboard.dashboards.project.stacks.template_versions.tables \
23 as project_tables
24import openstack_dashboard.dashboards.project.stacks.template_versions.tabs \
25 as project_tabs
26
27
28class TemplateVersionsView(tables.DataTableView):
29 table_class = project_tables.TemplateVersionsTable
30 template_name = 'project/stacks.template_versions/index.html'
31 page_title = _("Template Versions")
32
33 def get_data(self):
34 try:
35 template_versions = sorted(
36 api.heat.template_version_list(self.request),
37 key=lambda template_version: template_version.version)
38 except Exception:
39 template_versions = []
40 msg = _('Unable to retrieve template versions.')
41 exceptions.handle(self.request, msg)
42 return template_versions
43
44
45class DetailView(tabs.TabView):
46 tab_group_class = project_tabs.TemplateVersionDetailsTabs
47 template_name = 'horizon/common/_detail.html'
48 page_title = "{{ template_version }}"
49
50 def get_template_version(self, request, **kwargs):
51 try:
52 template_functions = api.heat.template_function_list(
53 request, kwargs['template_version'])
54 return template_functions
55 except Exception:
56 msg = _('Unable to retrieve template functions.')
57 exceptions.handle(request, msg, redirect=self.get_redirect_url())
58
59 @staticmethod
60 def get_redirect_url():
61 return reverse('horizon:project:stacks.template_versions:index')