summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-01-30 16:36:12 +0000
committerGerrit Code Review <review@openstack.org>2017-01-30 16:36:12 +0000
commitf15bf6bb141f4b0b14087a6007f74922e45a709e (patch)
treed5bd679fd6bc245d3b13cbe2bade65ea9e17bd15
parent5ecc28189d60f63c4e5a65f86de5c5868067ba35 (diff)
parent040210239fdd8d531dd65d1bf7588df6f14dbbee (diff)
downloadhorizon-f15bf6bb141f4b0b14087a6007f74922e45a709e.tar.gz
Merge "Reuse Overview tab for Admin Volume Snapshots"
-rw-r--r--openstack_dashboard/dashboards/admin/volumes/snapshots/tabs.py2
-rw-r--r--openstack_dashboard/dashboards/admin/volumes/snapshots/views.py9
-rw-r--r--openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html50
-rw-r--r--openstack_dashboard/dashboards/project/volumes/snapshots/views.py3
-rw-r--r--openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html2
5 files changed, 14 insertions, 52 deletions
diff --git a/openstack_dashboard/dashboards/admin/volumes/snapshots/tabs.py b/openstack_dashboard/dashboards/admin/volumes/snapshots/tabs.py
index e229f9ce3..c387f0b13 100644
--- a/openstack_dashboard/dashboards/admin/volumes/snapshots/tabs.py
+++ b/openstack_dashboard/dashboards/admin/volumes/snapshots/tabs.py
@@ -22,7 +22,7 @@ from openstack_dashboard.dashboards.project.volumes.snapshots \
class OverviewTab(overview_tab.OverviewTab):
name = _("Overview")
slug = "overview"
- template_name = ("admin/volumes/snapshots/_detail_overview.html")
+ template_name = ("project/volumes/snapshots/_detail_overview.html")
def get_redirect_url(self):
return reverse('horizon:admin:volumes:index')
diff --git a/openstack_dashboard/dashboards/admin/volumes/snapshots/views.py b/openstack_dashboard/dashboards/admin/volumes/snapshots/views.py
index 8dc27197a..8dc0eb053 100644
--- a/openstack_dashboard/dashboards/admin/volumes/snapshots/views.py
+++ b/openstack_dashboard/dashboards/admin/volumes/snapshots/views.py
@@ -64,6 +64,15 @@ class UpdateStatusView(forms.ModalFormView):
class DetailView(views.DetailView):
tab_group_class = vol_snapshot_tabs.SnapshotDetailsTabs
+ volume_url = 'horizon:admin:volumes:volumes:detail'
+
+ def get_context_data(self, **kwargs):
+ context = super(DetailView, self).get_context_data(**kwargs)
+ snapshot = self.get_data()
+ snapshot.volume_url = reverse(self.volume_url,
+ args=(snapshot.volume_id,))
+ context["snapshot"] = snapshot
+ return context
@staticmethod
def get_redirect_url():
diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html
deleted file mode 100644
index 9f8390d5b..000000000
--- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_detail_overview.html
+++ /dev/null
@@ -1,50 +0,0 @@
-{% load i18n sizeformat parse_date %}
-
-<h3>{% trans "Volume Snapshot Overview" %}</h3>
-
-<div class="info row detail">
- <h4>{% trans "Information" %}</h4>
- <hr class="header_rule">
- <dl class="dl-horizontal">
- <dt>{% trans "Name" %}</dt>
- <dd>{{ snapshot.name }}</dd>
- <dt>{% trans "ID" %}</dt>
- <dd>{{ snapshot.id }}</dd>
- {% if snapshot.description %}
- <dt>{% trans "Description" %}</dt>
- <dd>{{ snapshot.description }}</dd>
- {% endif %}
- <dt>{% trans "Status" %}</dt>
- <dd>{{ snapshot.status|capfirst }}</dd>
- <dt>{% trans "Volume" %}</dt>
- <dd>
- <a href="{% url 'horizon:admin:volumes:volumes:detail' snapshot.volume_id %}">
- {{ volume.name }}
- </a>
- </dd>
- </dl>
-</div>
-
-<div class="specs row detail">
- <h4>{% trans "Specs" %}</h4>
- <hr class="header_rule">
- <dl class="dl-horizontal">
- <dt>{% trans "Size" %}</dt>
- <dd>{{ snapshot.size }} {% trans "GiB" %}</dd>
- <dt>{% trans "Created" %}</dt>
- <dd>{{ snapshot.created_at|parse_date }}</dd>
- </dl>
-
- <h4>{% trans "Metadata" %}</h4>
- <hr class="header_rule">
- <dl class="dl-horizontal">
- {% if snapshot.metadata.items %}
- {% for key, value in snapshot.metadata.items %}
- <dt>{{ key }}</dt>
- <dd>{{ value }}</dd>
- {% endfor %}
- {% else %}
- <dd>{% trans "None" %}</dd>
- {% endif %}
- </dl>
-</div>
diff --git a/openstack_dashboard/dashboards/project/volumes/snapshots/views.py b/openstack_dashboard/dashboards/project/volumes/snapshots/views.py
index 97b205dcf..4dfe0b799 100644
--- a/openstack_dashboard/dashboards/project/volumes/snapshots/views.py
+++ b/openstack_dashboard/dashboards/project/volumes/snapshots/views.py
@@ -68,10 +68,13 @@ class DetailView(tabs.TabView):
tab_group_class = vol_snapshot_tabs.SnapshotDetailTabs
template_name = 'horizon/common/_detail.html'
page_title = "{{ snapshot.name|default:snapshot.id }}"
+ volume_url = 'horizon:project:volumes:volumes:detail'
def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs)
snapshot = self.get_data()
+ snapshot.volume_url = reverse(self.volume_url,
+ args=(snapshot.volume_id,))
table = vol_snapshot_tables.VolumeSnapshotsTable(self.request)
context["snapshot"] = snapshot
context["url"] = self.get_redirect_url()
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html
index 211d83517..b14f9775c 100644
--- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html
+++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_detail_overview.html
@@ -14,7 +14,7 @@
<dd>{{ snapshot.status|capfirst }}</dd>
<dt>{% trans "Volume" %}</dt>
<dd>
- <a href="{% url 'horizon:project:volumes:volumes:detail' snapshot.volume_id %}">
+ <a href="{{ snapshot.volume_url }}">
{% if volume.name %}
{{ volume.name }}
{% else %}