Reduce page title duplication in Admin views

Patch https://review.openstack.org/#/c/142802 adds a method of
reducing duplication of page title logic, this patch applies that change
to the admin info, instances, metering and metadata_defs views.

Change-Id: Ia30fee5318391283cb471a32547e75b1ecfb6de6
Partial-Bug: 1413749
This commit is contained in:
Sam Betts 2015-02-10 13:26:56 +00:00
parent 1934a7eaa8
commit 73ad5ec186
11 changed files with 7 additions and 28 deletions

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "System Information" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("System Information")%}
{% endblock page_header %}
{% block main %}
<div class="row">
<div class="col-sm-12">

View File

@ -29,6 +29,7 @@ from openstack_dashboard.dashboards.admin.info import tabs as project_tabs
class IndexView(tabs.TabbedTableView):
tab_group_class = project_tabs.SystemInfoTabs
template_name = constants.INFO_TEMPLATE_NAME
page_title = _("System Information")
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Instances" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("All Instances") %}
{% endblock page_header %}
{% block main %}
{{ table.render }}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Live Migrate" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Live Migrate") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/instances/_live_migrate.html' %}
{% endblock %}

View File

@ -64,6 +64,7 @@ class AdminUpdateView(views.UpdateView):
class AdminIndexView(tables.DataTableView):
table_class = project_tables.AdminInstancesTable
template_name = 'admin/instances/index.html'
page_title = _("All Instances")
def has_more_data(self, table):
return self._more
@ -152,6 +153,7 @@ class LiveMigrateView(forms.ModalFormView):
template_name = 'admin/instances/live_migrate.html'
context_object_name = 'instance'
success_url = reverse_lazy("horizon:admin:instances:index")
page_title = _("Live Migrate")
def get_context_data(self, **kwargs):
context = super(LiveMigrateView, self).get_context_data(**kwargs)

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Create a Metadata Namespace" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create a Metadata Namespace") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/metadata_defs/_create.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Metadata Definitions" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Metadata Definitions") %}
{% endblock page_header %}
{% block main %}
{{ table.render }}
{% endblock %}

View File

@ -37,6 +37,7 @@ from openstack_dashboard.dashboards.admin.metadata_defs \
class AdminIndexView(tables.DataTableView):
table_class = admin_tables.AdminNamespacesTable
template_name = constants.METADATA_INDEX_TEMPLATE
page_title = _("Metadata Definitions")
def has_prev_data(self, table):
return self._prev
@ -82,6 +83,7 @@ class CreateView(forms.ModalFormView):
template_name = constants.METADATA_CREATE_TEMPLATE
context_object_name = 'namespace'
success_url = reverse_lazy(constants.METADATA_INDEX_URL)
page_title = _("Create a Metadata Namespace")
class DetailView(tabs.TabView):

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Modify Usage Report Parameters" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Modify Usage Report Parameters") %}
{% endblock page_header %}
{% block main %}
{% include "admin/metering/_daily.html" %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Resources Usage Overview" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Resources Usage Overview")%}
{% endblock page_header %}
{% block main %}
<div class="row">
<div class="col-sm-12">

View File

@ -38,12 +38,14 @@ LOG = logging.getLogger(__name__)
class IndexView(tabs.TabbedTableView):
tab_group_class = metering_tabs.CeilometerOverviewTabs
template_name = 'admin/metering/index.html'
page_title = _("Resources Usage Overview")
class CreateUsageReport(forms.ModalFormView):
form_class = metering_forms.UsageReportForm
template_name = 'admin/metering/daily.html'
success_url = reverse_lazy('horizon:admin:metering:index')
page_title = _("Modify Usage Report Parameters")
class SamplesView(django.views.generic.TemplateView):