Reduce page title duplication in Adv net services

Patch https://review.openstack.org/#/c/142802 adds a method of
reducing duplication of page title logic, this patch applies that change
to the project firewalls, loadbalancers and vpn views.

Change-Id: I7e342df51eca075da76d80eb9b5722654edad1e4
Partial-Bug: 1413749
This commit is contained in:
Sam Betts 2015-02-10 13:45:00 +00:00
parent 673bfed6c8
commit db27b5942e
20 changed files with 34 additions and 89 deletions

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Add New Firewall" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Add New Firewall") %}
{% endblock page_header %}
{% block main %}
{% include 'horizon/common/_workflow.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Add New Policy" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Add New Policy") %}
{% endblock page_header %}
{% block main %}
{% include 'horizon/common/_workflow.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Add New Rule" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Add New Rule") %}
{% endblock page_header %}
{% block main %}
{% include 'horizon/common/_workflow.html' %}
{% endblock %}

View File

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

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Insert Rule to Policy" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Insert Rule to Policy") %}
{% endblock page_header %}
{% block main %}
{% include 'project/firewalls/_insert_rule_to_policy.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Remove Rule from Policy" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Remove Rule from Policy") %}
{% endblock page_header %}
{% block main %}
{% include 'project/firewalls/_remove_rule_from_policy.html' %}
{% endblock %}

View File

@ -89,31 +89,36 @@ class IndexView(tabs.TabView):
class AddRuleView(workflows.WorkflowView):
workflow_class = AddRule
template_name = "project/firewalls/addrule.html"
page_title = _("Add New Rule")
class AddPolicyView(workflows.WorkflowView):
workflow_class = AddPolicy
template_name = "project/firewalls/addpolicy.html"
page_title = _("Add New Policy")
class AddFirewallView(workflows.WorkflowView):
workflow_class = AddFirewall
template_name = "project/firewalls/addfirewall.html"
page_title = _("Add New Firewall")
class RuleDetailsView(tabs.TabView):
class FireWallDetailTabs(tabs.TabView):
template_name = 'project/firewalls/details_tabs.html'
page_title = _("Firewalls")
class RuleDetailsView(FireWallDetailTabs):
tab_group_class = (RuleDetailsTabs)
template_name = 'project/firewalls/details_tabs.html'
class PolicyDetailsView(tabs.TabView):
class PolicyDetailsView(FireWallDetailTabs):
tab_group_class = (PolicyDetailsTabs)
template_name = 'project/firewalls/details_tabs.html'
class FirewallDetailsView(tabs.TabView):
class FirewallDetailsView(FireWallDetailTabs):
tab_group_class = (FirewallDetailsTabs)
template_name = 'project/firewalls/details_tabs.html'
class UpdateRuleView(forms.ModalFormView):
@ -121,7 +126,7 @@ class UpdateRuleView(forms.ModalFormView):
template_name = "project/firewalls/updaterule.html"
context_object_name = 'rule'
success_url = reverse_lazy("horizon:project:firewalls:index")
page_title = _("Edit Rule")
page_title = _("Edit Rule {{ name }}")
def get_context_data(self, **kwargs):
context = super(UpdateRuleView, self).get_context_data(**kwargs)
@ -129,9 +134,6 @@ class UpdateRuleView(forms.ModalFormView):
obj = self._get_object()
if obj:
context['name'] = obj.name_or_id
context['page_title'] = _("Edit Rule "
"%(rule_name)s") % {'rule_name':
obj.name}
return context
@memoized.memoized_method
@ -159,7 +161,7 @@ class UpdatePolicyView(forms.ModalFormView):
template_name = "project/firewalls/updatepolicy.html"
context_object_name = 'policy'
success_url = reverse_lazy("horizon:project:firewalls:index")
page_title = _("Edit Policy")
page_title = _("Edit Policy {{ name }}")
def get_context_data(self, **kwargs):
context = super(UpdatePolicyView, self).get_context_data(**kwargs)
@ -167,7 +169,6 @@ class UpdatePolicyView(forms.ModalFormView):
obj = self._get_object()
if obj:
context['name'] = obj.name_or_id
context['page_title'] = _("Edit Policy %s") % obj.name
return context
@memoized.memoized_method
@ -192,7 +193,7 @@ class UpdateFirewallView(forms.ModalFormView):
template_name = "project/firewalls/updatefirewall.html"
context_object_name = 'firewall'
success_url = reverse_lazy("horizon:project:firewalls:index")
page_title = _("Edit Firewall")
page_title = _("Edit Firewall {{ name }}")
def get_context_data(self, **kwargs):
context = super(UpdateFirewallView, self).get_context_data(**kwargs)
@ -200,7 +201,6 @@ class UpdateFirewallView(forms.ModalFormView):
obj = self._get_object()
if obj:
context['name'] = obj.name
context['page_title'] = _("Edit Firewall %s") % obj.name
return context
@memoized.memoized_method
@ -226,6 +226,7 @@ class InsertRuleToPolicyView(forms.ModalFormView):
template_name = "project/firewalls/insert_rule_to_policy.html"
context_object_name = 'policy'
success_url = reverse_lazy("horizon:project:firewalls:index")
page_title = _("Insert Rule to Policy")
def get_context_data(self, **kwargs):
context = super(InsertRuleToPolicyView,
@ -259,6 +260,7 @@ class RemoveRuleFromPolicyView(forms.ModalFormView):
template_name = "project/firewalls/remove_rule_from_policy.html"
context_object_name = 'policy'
success_url = reverse_lazy("horizon:project:firewalls:index")
page_title = _("Remove Rule from Policy")
def get_context_data(self, **kwargs):
context = super(RemoveRuleFromPolicyView,

View File

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

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit Member" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit Member") %}
{% endblock page_header %}
{% block main %}
{% include 'project/loadbalancers/_updatemember.html' %}
{% endblock %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit Monitor" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit Monitor") %}
{% endblock page_header %}
{% block main %}
{% include 'project/loadbalancers/_updatemonitor.html' %}
{% endblock %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit Pool" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit Pool") %}
{% endblock page_header %}
{% block main %}
{% include 'project/loadbalancers/_updatepool.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit VIP" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit VIP") %}
{% endblock page_header %}
{% block main %}
{% include 'project/loadbalancers/_updatevip.html' %}
{% endblock %}
{% endblock %}

View File

@ -39,6 +39,7 @@ import re
class IndexView(tabs.TabView):
tab_group_class = (project_tabs.LoadBalancerTabs)
template_name = 'project/loadbalancers/details_tabs.html'
page_title = _("Load Balancer")
def post(self, request, *args, **kwargs):
obj_ids = request.POST.getlist('object_ids')
@ -228,6 +229,7 @@ class UpdatePoolView(forms.ModalFormView):
template_name = "project/loadbalancers/updatepool.html"
context_object_name = 'pool'
success_url = reverse_lazy("horizon:project:loadbalancers:index")
page_title = _("Edit Pool")
def get_context_data(self, **kwargs):
context = super(UpdatePoolView, self).get_context_data(**kwargs)
@ -258,6 +260,7 @@ class UpdateVipView(forms.ModalFormView):
template_name = "project/loadbalancers/updatevip.html"
context_object_name = 'vip'
success_url = reverse_lazy("horizon:project:loadbalancers:index")
page_title = _("Edit VIP")
def get_context_data(self, **kwargs):
context = super(UpdateVipView, self).get_context_data(**kwargs)
@ -302,6 +305,7 @@ class UpdateMemberView(forms.ModalFormView):
template_name = "project/loadbalancers/updatemember.html"
context_object_name = 'member'
success_url = reverse_lazy("horizon:project:loadbalancers:index")
page_title = _("Edit Member")
def get_context_data(self, **kwargs):
context = super(UpdateMemberView, self).get_context_data(**kwargs)
@ -331,6 +335,7 @@ class UpdateMonitorView(forms.ModalFormView):
template_name = "project/loadbalancers/updatemonitor.html"
context_object_name = 'monitor'
success_url = reverse_lazy("horizon:project:loadbalancers:index")
page_title = _("Edit Monitor")
def get_context_data(self, **kwargs):
context = super(UpdateMonitorView, self).get_context_data(**kwargs)

View File

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

View File

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

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit IKE Policy" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit IKE Policy") %}
{% endblock page_header %}
{% block main %}
{% include 'project/vpn/_update_ikepolicy.html' %}
{% endblock %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit IPSec Policy" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit IPSec Policy") %}
{% endblock page_header %}
{% block main %}
{% include 'project/vpn/_update_ipsecpolicy.html' %}
{% endblock %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit IPSec Site Connection" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit IPSec Site Connection") %}
{% endblock page_header %}
{% block main %}
{% include 'project/vpn/_update_ipsecsiteconnection.html' %}
{% endblock %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit VPN Service" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit VPN Service") %}
{% endblock page_header %}
{% block main %}
{% include 'project/vpn/_update_vpnservice.html' %}
{% endblock %}
{% endblock %}

View File

@ -37,6 +37,7 @@ import re
class IndexView(tabs.TabView):
tab_group_class = vpn_tabs.VPNTabs
template_name = 'project/vpn/index.html'
page_title = _("Virtual Private Network")
def post(self, request, *args, **kwargs):
obj_ids = request.POST.getlist('object_ids')
@ -123,6 +124,7 @@ class AddIPSecPolicyView(workflows.WorkflowView):
class IKEPolicyDetailsView(tabs.TabView):
tab_group_class = vpn_tabs.IKEPolicyDetailsTabs
template_name = 'project/vpn/details_tabs.html'
page_title = _("Virtual Private Network")
@memoized.memoized_method
def get_data(self):
@ -267,6 +269,7 @@ class UpdateVPNServiceView(forms.ModalFormView):
template_name = "project/vpn/update_vpnservice.html"
context_object_name = 'vpnservice'
success_url = reverse_lazy("horizon:project:vpn:index")
page_title = _("Edit VPN Service")
def get_context_data(self, **kwargs):
context = super(UpdateVPNServiceView, self).get_context_data(**kwargs)
@ -296,6 +299,7 @@ class UpdateIKEPolicyView(forms.ModalFormView):
template_name = "project/vpn/update_ikepolicy.html"
context_object_name = 'ikepolicy'
success_url = reverse_lazy("horizon:project:vpn:index")
page_title = _("Edit IKE Policy")
def get_context_data(self, **kwargs):
context = super(UpdateIKEPolicyView, self).get_context_data(**kwargs)
@ -332,6 +336,7 @@ class UpdateIPSecPolicyView(forms.ModalFormView):
template_name = "project/vpn/update_ipsecpolicy.html"
context_object_name = 'ipsecpolicy'
success_url = reverse_lazy("horizon:project:vpn:index")
page_title = _("Edit IPSec Policy")
def get_context_data(self, **kwargs):
context = super(UpdateIPSecPolicyView, self).get_context_data(**kwargs)
@ -367,6 +372,7 @@ class UpdateIPSecSiteConnectionView(forms.ModalFormView):
template_name = "project/vpn/update_ipsecsiteconnection.html"
context_object_name = 'ipsecsiteconnection'
success_url = reverse_lazy("horizon:project:vpn:index")
page_title = _("Edit IPSec Site Connection")
def get_context_data(self, **kwargs):
context = super(