Reuse Overview tab for Admin Volume Snapshots
Admin should reuse Project's Overview tab. Change-Id: I2c8adff108593f539ddf28713de59b0f9f5c4dd1 Closes-Bug: #1642104
This commit is contained in:
parent
29beb99e93
commit
040210239f
@ -22,7 +22,7 @@ from openstack_dashboard.dashboards.project.volumes.snapshots \
|
|||||||
class OverviewTab(overview_tab.OverviewTab):
|
class OverviewTab(overview_tab.OverviewTab):
|
||||||
name = _("Overview")
|
name = _("Overview")
|
||||||
slug = "overview"
|
slug = "overview"
|
||||||
template_name = ("admin/volumes/snapshots/_detail_overview.html")
|
template_name = ("project/volumes/snapshots/_detail_overview.html")
|
||||||
|
|
||||||
def get_redirect_url(self):
|
def get_redirect_url(self):
|
||||||
return reverse('horizon:admin:volumes:index')
|
return reverse('horizon:admin:volumes:index')
|
||||||
|
@ -64,6 +64,15 @@ class UpdateStatusView(forms.ModalFormView):
|
|||||||
|
|
||||||
class DetailView(views.DetailView):
|
class DetailView(views.DetailView):
|
||||||
tab_group_class = vol_snapshot_tabs.SnapshotDetailsTabs
|
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
|
@staticmethod
|
||||||
def get_redirect_url():
|
def get_redirect_url():
|
||||||
|
@ -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>
|
|
@ -68,10 +68,13 @@ class DetailView(tabs.TabView):
|
|||||||
tab_group_class = vol_snapshot_tabs.SnapshotDetailTabs
|
tab_group_class = vol_snapshot_tabs.SnapshotDetailTabs
|
||||||
template_name = 'horizon/common/_detail.html'
|
template_name = 'horizon/common/_detail.html'
|
||||||
page_title = "{{ snapshot.name|default:snapshot.id }}"
|
page_title = "{{ snapshot.name|default:snapshot.id }}"
|
||||||
|
volume_url = 'horizon:project:volumes:volumes:detail'
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(DetailView, self).get_context_data(**kwargs)
|
context = super(DetailView, self).get_context_data(**kwargs)
|
||||||
snapshot = self.get_data()
|
snapshot = self.get_data()
|
||||||
|
snapshot.volume_url = reverse(self.volume_url,
|
||||||
|
args=(snapshot.volume_id,))
|
||||||
table = vol_snapshot_tables.VolumeSnapshotsTable(self.request)
|
table = vol_snapshot_tables.VolumeSnapshotsTable(self.request)
|
||||||
context["snapshot"] = snapshot
|
context["snapshot"] = snapshot
|
||||||
context["url"] = self.get_redirect_url()
|
context["url"] = self.get_redirect_url()
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<dd>{{ snapshot.status|capfirst }}</dd>
|
<dd>{{ snapshot.status|capfirst }}</dd>
|
||||||
<dt>{% trans "Volume" %}</dt>
|
<dt>{% trans "Volume" %}</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<a href="{% url 'horizon:project:volumes:volumes:detail' snapshot.volume_id %}">
|
<a href="{{ snapshot.volume_url }}">
|
||||||
{% if volume.name %}
|
{% if volume.name %}
|
||||||
{{ volume.name }}
|
{{ volume.name }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
Loading…
Reference in New Issue
Block a user