Browse Source

Removes and simplifies GBPUI templates

Removes unused templates and simplifies remaining templates and views by extracting common logic
in the same way as the previous partial patch for this bug did.

Change-Id: I832a7ab88e99103b9e6abdfd8be44fcd8bee1a11
Closes-Bug: 1710852
Co-Authored-By: viktor.krivak@ultimum.io
tags/7.0.0
Marek Lycka 1 year ago
parent
commit
f3048c76ec
44 changed files with 311 additions and 1094 deletions
  1. 7
    0
      gbpui/common/forms.py
  2. 0
    25
      gbpui/panels/application_policy/templates/application_policy/_add_policy_action.html
  3. 0
    30
      gbpui/panels/application_policy/templates/application_policy/_add_policy_classifier.html
  4. 1
    1
      gbpui/panels/application_policy/templates/application_policy/_policyaction_details.html
  5. 0
    25
      gbpui/panels/application_policy/templates/application_policy/_update_policy_action.html
  6. 0
    29
      gbpui/panels/application_policy/templates/application_policy/_update_policy_classifier.html
  7. 0
    25
      gbpui/panels/application_policy/templates/application_policy/_update_policy_rule.html
  8. 0
    26
      gbpui/panels/application_policy/templates/application_policy/_update_policy_rule_set.html
  9. 0
    11
      gbpui/panels/application_policy/templates/application_policy/addpolicy_rule_set.html
  10. 0
    11
      gbpui/panels/application_policy/templates/application_policy/addpolicyaction.html
  11. 0
    11
      gbpui/panels/application_policy/templates/application_policy/addpolicyclassifier.html
  12. 0
    11
      gbpui/panels/application_policy/templates/application_policy/addpolicyrule.html
  13. 0
    15
      gbpui/panels/application_policy/templates/application_policy/details_tabs.html
  14. 70
    48
      gbpui/panels/application_policy/views.py
  15. 0
    25
      gbpui/panels/network_policy/templates/network_policy/_add_l2policy.html
  16. 0
    45
      gbpui/panels/network_policy/templates/network_policy/_add_l3policy.html
  17. 0
    24
      gbpui/panels/network_policy/templates/network_policy/_create_external_connectivity.html
  18. 0
    24
      gbpui/panels/network_policy/templates/network_policy/_create_external_route_param.html
  19. 0
    24
      gbpui/panels/network_policy/templates/network_policy/_create_external_segment_param.html
  20. 0
    24
      gbpui/panels/network_policy/templates/network_policy/_create_nat_pool.html
  21. 0
    24
      gbpui/panels/network_policy/templates/network_policy/_create_network_service_param.html
  22. 0
    25
      gbpui/panels/network_policy/templates/network_policy/_create_service_policy.html
  23. 0
    25
      gbpui/panels/network_policy/templates/network_policy/_update_external_connectivity.html
  24. 0
    25
      gbpui/panels/network_policy/templates/network_policy/_update_l2policy.html
  25. 0
    44
      gbpui/panels/network_policy/templates/network_policy/_update_l3policy.html
  26. 0
    25
      gbpui/panels/network_policy/templates/network_policy/_update_nat_pool.html
  27. 0
    25
      gbpui/panels/network_policy/templates/network_policy/_update_service_policy.html
  28. 0
    15
      gbpui/panels/network_policy/templates/network_policy/details_tabs.html
  29. 130
    83
      gbpui/panels/network_policy/views.py
  30. 0
    88
      gbpui/panels/network_services/forms.py
  31. 0
    25
      gbpui/panels/network_services/templates/network_services/_create_service_chain_instance.html
  32. 0
    26
      gbpui/panels/network_services/templates/network_services/_create_service_chain_node.html
  33. 0
    26
      gbpui/panels/network_services/templates/network_services/_create_service_profile.html
  34. 32
    32
      gbpui/panels/network_services/templates/network_services/_scspec_details.html
  35. 0
    0
      gbpui/panels/network_services/templates/network_services/_service_chain_spec_details.html
  36. 0
    25
      gbpui/panels/network_services/templates/network_services/_update_service_chain_instance.html
  37. 0
    25
      gbpui/panels/network_services/templates/network_services/_update_service_chain_node.html
  38. 0
    15
      gbpui/panels/network_services/templates/network_services/details_tabs.html
  39. 0
    0
      gbpui/panels/network_services/templates/network_services/index.html
  40. 0
    7
      gbpui/panels/network_services/urls.py
  41. 39
    52
      gbpui/panels/network_services/views.py
  42. 0
    11
      gbpui/panels/policytargets/templates/policytargets/group_details.html
  43. 31
    36
      gbpui/panels/policytargets/views.py
  44. 1
    1
      gbpui/templates/gbpui/details_tabs.html

+ 7
- 0
gbpui/common/forms.py View File

@@ -31,3 +31,10 @@ class ReversingModalFormView(forms.ModalFormView):
31 31
         submit_params = self.get_submit_url_params(**kwargs)
32 32
         submit_url = reverse(self.submit_url, kwargs=submit_params)
33 33
         return submit_url
34
+
35
+
36
+class HelpTextModalMixin(object):
37
+    def get_context_data(self, **kwargs):
38
+        context = super(HelpTextModalMixin, self).get_context_data(**kwargs)
39
+        context["help_text"] = self.help_text
40
+        return context

+ 0
- 25
gbpui/panels/application_policy/templates/application_policy/_add_policy_action.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}add_policy_action_form{% endblock %}
6
-{% block form_action %}{% url "horizon:project:application_policy:addpolicyaction" %}{% endblock %}
7
-
8
-{% block modal_id %}add_policy_action_modal{% endblock %}
9
-{% block modal-header %}{% trans "Create Policy Action" %}{% endblock %}
10
-
11
-{% block modal-body %}
12
-<div class="left">
13
-  <fieldset>
14
-  {% include "horizon/common/_form_fields.html" %}
15
-  </fieldset>
16
-</div>
17
-<div class="right">
18
-  <h3>{% trans "Description" %}:</h3>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Policy Action" %}" />
24
-  <a href="{% url "horizon:project:application_policy:index" %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 30
gbpui/panels/application_policy/templates/application_policy/_add_policy_classifier.html View File

@@ -1,30 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}add_policy_classifier_form{% endblock %}
6
-{% block form_action %}{% url "horizon:project:application_policy:addpolicyclassifier" %}{% endblock %}
7
-
8
-{% block modal_id %}add_policy_classifier_modal{% endblock %}
9
-{% block modal-header %}{% trans "Create Policy Classifier" %}{% endblock %}
10
-
11
-{% block modal-body %}
12
-<div class="left">
13
-  <fieldset>
14
-  {% include "horizon/common/_form_fields.html" %}
15
-  </fieldset>
16
-</div>
17
-<div class="right">
18
-  <h3>{% trans "Description" %}:</h3>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Policy Classifier" %}" />
24
-  <a href="{% url "horizon:project:application_policy:index" %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}  
26
-
27
-
28
-{% block modal-js %}
29
-    <script src='{{ STATIC_URL }}dashboard/js/horizon.protocolmap.js' type="text/javascript"></script>
30
-{% endblock %}

+ 1
- 1
gbpui/panels/application_policy/templates/application_policy/_policyaction_details.html View File

@@ -16,7 +16,7 @@
16 16
     <dt>{% trans "Project ID" %}</dt>
17 17
     <dd>{{ policyaction.tenant_id }}</dd>
18 18
 	
19
-	<dt>{% trans "Action Value" %}</dt>
19
+	  <dt>{% trans "Action Value" %}</dt>
20 20
     <dd>{{ policyaction.action_value|default:_("-") }}</dd>
21 21
 
22 22
     <dt>{% trans "Action Type" %}</dt>

+ 0
- 25
gbpui/panels/application_policy/templates/application_policy/_update_policy_action.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_policy_action_form{% endblock %}
6
-{% block form_action %}{% url "horizon:project:application_policy:updatepolicyaction" policyaction_id %}{% endblock %}
7
-
8
-{% block modal_id %}update_policy_action_modal{% endblock %}
9
-{% block modal-header %}{% trans "Edit Policy Action" %}{% endblock %}
10
-
11
-{% block modal-body %}
12
-<div class="left">
13
-  <fieldset>
14
-  {% include "horizon/common/_form_fields.html" %}
15
-  </fieldset>
16
-</div>
17
-<div class="right">
18
-  <h3>{% trans "Description" %}:</h3>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Policy Action" %}" />
24
-  <a href="{% url "horizon:project:application_policy:index" %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 29
gbpui/panels/application_policy/templates/application_policy/_update_policy_classifier.html View File

@@ -1,29 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_policy_classifier_form{% endblock %}
6
-{% block form_action %}{% url "horizon:project:application_policy:updatepolicyclassifier" policyclassifier_id %}{% endblock %}
7
-
8
-{% block modal_id %}update_policy_classifier_modal{% endblock %}
9
-{% block modal-header %}{% trans "Edit Policy Classifier" %}{% endblock %}
10
-
11
-{% block modal-body %}
12
-<div class="left">
13
-  <fieldset>
14
-  {% include "horizon/common/_form_fields.html" %}
15
-  </fieldset>
16
-</div>
17
-<div class="right">
18
-  <h3>{% trans "Description" %}:</h3>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Policy Classifier" %}" />
24
-  <a href="{% url "horizon:project:application_policy:index" %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 
26
-
27
-{% block modal-js %}
28
-    <script src='{{ STATIC_URL }}dashboard/js/horizon.protocolmap.js' type="text/javascript"></script>
29
-{% endblock %}

+ 0
- 25
gbpui/panels/application_policy/templates/application_policy/_update_policy_rule.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_policy_rule_form{% endblock %}
6
-{% block form_action %}{% url "horizon:project:application_policy:updatepolicyrule" policyrule_id %}{% endblock %}
7
-
8
-{% block modal_id %}update_policy_rule_modal{% endblock %}
9
-{% block modal-header %}{% trans "Edit Policy Rule" %}{% endblock %}
10
-
11
-{% block modal-body %}
12
-<div class="left">
13
-  <fieldset>
14
-  {% include "horizon/common/_form_fields.html" %}
15
-  </fieldset>
16
-</div>
17
-<div class="right">
18
-  <h3>{% trans "Description" %}:</h3>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Policy Rule" %}" />
24
-  <a href="{% url "horizon:project:application_policy:index" %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 26
gbpui/panels/application_policy/templates/application_policy/_update_policy_rule_set.html View File

@@ -1,26 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_policy_rule_set_form{% endblock %}
6
-{% block form_action %}{% url "horizon:project:application_policy:updatepolicy_rule_set" policy_rule_set_id %}{% endblock %}
7
-
8
-{% block modal_id %}update_policy_rule_set_modal{% endblock %}
9
-{% block modal-header %}{% trans "Edit Policy Rule Set" %}{% endblock %}
10
-
11
-{% block modal-body %}
12
-<div class="left">
13
-  <fieldset>
14
-  {% include "horizon/common/_form_fields.html" %}
15
-  </fieldset>
16
-</div>
17
-<div class="right">
18
-  <h3>{% trans "Description" %}:</h3>
19
-  <p>{% trans "Select one or multiple rules by pressing Ctrl" %}</p>
20
-</div>
21
-{% endblock %}
22
-
23
-{% block modal-footer %}
24
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Policy Rule Set" %}" />
25
-  <a href="{% url "horizon:project:application_policy:index" %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
26
-{% endblock %}

+ 0
- 11
gbpui/panels/application_policy/templates/application_policy/addpolicy_rule_set.html View File

@@ -1,11 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Create Policy Rule Set" %}{% endblock %}
4
-
5
-{% block page_header %}
6
-  {% include "horizon/common/_page_header.html" with title=_("Create Policy Rule Set") %}
7
-{% endblock page_header %}
8
-
9
-{% block main %}
10
-  {% include 'horizon/common/_workflow.html' %}
11
-{% endblock %}

+ 0
- 11
gbpui/panels/application_policy/templates/application_policy/addpolicyaction.html View File

@@ -1,11 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Create New Action" %}{% endblock %}
4
-
5
-{% block page_header %}
6
-  {% include "horizon/common/_page_header.html" with title=_("Create New Action") %}
7
-{% endblock page_header %}
8
-
9
-{% block main %}
10
-  {% include 'horizon/common/_workflow.html' %}
11
-{% endblock %}

+ 0
- 11
gbpui/panels/application_policy/templates/application_policy/addpolicyclassifier.html View File

@@ -1,11 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Create New Classifier" %}{% endblock %}
4
-
5
-{% block page_header %}
6
-  {% include "horizon/common/_page_header.html" with title=_("Create New Classifier") %}
7
-{% endblock page_header %}
8
-
9
-{% block main %}
10
-  {% include 'horizon/common/_workflow.html' %}
11
-{% endblock %}

+ 0
- 11
gbpui/panels/application_policy/templates/application_policy/addpolicyrule.html View File

@@ -1,11 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Create New Policy Rule Set" %}{% endblock %}
4
-
5
-{% block page_header %}
6
-  {% include "horizon/common/_page_header.html" with title=_("Create New Policy Rule Set") %}
7
-{% endblock page_header %}
8
-
9
-{% block main %}
10
-  {% include 'horizon/common/_workflow.html' %}
11
-{% endblock %}

+ 0
- 15
gbpui/panels/application_policy/templates/application_policy/details_tabs.html View File

@@ -1,15 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Application Policies" %}{% endblock %}
4
-
5
-{% block page_header %}
6
-  {% include "horizon/common/_page_header.html" with title=_("Application Policies") %}
7
-{% endblock page_header %}
8
-
9
-{% block main %}
10
-<div class="row">
11
-  <div class="col-sm-12">
12
-  {{ tab_group.render }}
13
-  </div>
14
-</div>
15
-{% endblock %}

+ 70
- 48
gbpui/panels/application_policy/views.py View File

@@ -11,7 +11,6 @@
11 11
 # under the License.
12 12
 from django.core.urlresolvers import reverse
13 13
 
14
-from horizon import forms
15 14
 from horizon import tabs
16 15
 from horizon import workflows
17 16
 
@@ -19,6 +18,9 @@ import forms as policy_rule_set_forms
19 18
 import tabs as policy_rule_set_tabs
20 19
 import workflows as policy_rule_set_workflows
21 20
 
21
+from django.utils.translation import ugettext_lazy as _
22
+from gbpui.common import forms as gbforms
23
+
22 24
 PolicyRuleSetTabs = policy_rule_set_tabs.ApplicationPoliciesTabs
23 25
 PolicyRuleSetDetailsTabs = policy_rule_set_tabs.PolicyRuleSetDetailsTabs
24 26
 PolicyRuleDetailsTabs = policy_rule_set_tabs.PolicyRuleDetailsTabs
@@ -31,26 +33,26 @@ AddPolicyClassifier = policy_rule_set_workflows.AddPolicyClassifier
31 33
 
32 34
 class IndexView(tabs.TabbedTableView):
33 35
     tab_group_class = (PolicyRuleSetTabs)
34
-    template_name = 'project/application_policy/details_tabs.html'
36
+    template_name = "gbpui/details_tabs.html"
37
+    page_title = _("Application Policies")
35 38
 
36 39
 
37 40
 class AddPolicyRuleSetView(workflows.WorkflowView):
38 41
     workflow_class = AddPolicyRuleSet
39
-    template_name = "project/application_policy/addpolicy_rule_set.html"
40
-
41
-    def get_object_id(self, policy_rule_set):
42
-        return [policy_rule_set.id]
43 42
 
44 43
 
45
-class UpdatePolicyRuleSetView(forms.ModalFormView):
44
+class UpdatePolicyRuleSetView(gbforms.HelpTextModalMixin,
45
+                              gbforms.ReversingModalFormView):
46 46
     form_class = policy_rule_set_forms.UpdatePolicyRuleSetForm
47
-    template_name = 'project/application_policy/update_policy_rule_set.html'
47
+    modal_header = _("Edit Policy Rule Set")
48
+    submit_label = _("Update Policy Rule Set")
49
+    submit_url = "horizon:project:application_policy:updatepolicy_rule_set"
50
+    template_name = "gbpui/form_with_description.html"
51
+    page_title = _("Update Rule Set")
52
+    help_text = _("Update Rule Set.")
48 53
 
49
-    def get_context_data(self, **kwargs):
50
-        context = super(
51
-            UpdatePolicyRuleSetView, self).get_context_data(**kwargs)
52
-        context['policy_rule_set_id'] = self.kwargs['policy_rule_set_id']
53
-        return context
54
+    def get_submit_url_params(self, **kwargs):
55
+        return {"policy_rule_set_id": self.kwargs['policy_rule_set_id']}
54 56
 
55 57
     def get_initial(self):
56 58
         return {'policy_rule_set_id': self.kwargs['policy_rule_set_id']}
@@ -58,15 +60,17 @@ class UpdatePolicyRuleSetView(forms.ModalFormView):
58 60
 
59 61
 class AddPolicyRuleView(workflows.WorkflowView):
60 62
     workflow_class = AddPolicyRule
61
-    template_name = "project/application_policy/addpolicyrule.html"
62
-
63
-    def get_object_id(self, rule):
64
-        return [rule.id]
65 63
 
66 64
 
67
-class AddPolicyClassifierView(forms.ModalFormView):
65
+class AddPolicyClassifierView(gbforms.HelpTextModalMixin,
66
+                              gbforms.ReversingModalFormView):
68 67
     form_class = policy_rule_set_forms.AddPolicyClassifierForm
69
-    template_name = "project/application_policy/add_policy_classifier.html"
68
+    template_name = "gbpui/form_with_description.html"
69
+    submit_url = "horizon:project:application_policy:addpolicyclassifier"
70
+    modal_header = _("Create Policy Classifier")
71
+    page_title = _("Create Policy Classifier")
72
+    help_text = _("Create Policy Classifier.")
73
+    submit_label = _("Save Changes")
70 74
 
71 75
     def get_success_url(self):
72 76
         return reverse('horizon:project:application_policy:index')
@@ -75,26 +79,32 @@ class AddPolicyClassifierView(forms.ModalFormView):
75 79
         return [classifier.id]
76 80
 
77 81
 
78
-class AddPolicyActionView(forms.ModalFormView):
82
+class AddPolicyActionView(gbforms.HelpTextModalMixin,
83
+                          gbforms.ReversingModalFormView):
79 84
     form_class = policy_rule_set_forms.AddPolicyActionForm
80
-    template_name = "project/application_policy/add_policy_action.html"
85
+    template_name = "gbpui/form_with_description.html"
86
+    submit_url = "horizon:project:application_policy:addpolicyaction"
87
+    modal_header = _("Create Policy Action")
88
+    page_title = _("Create Policy Action")
89
+    submit_label = _("Create")
90
+    help_text = _("Create Policy Action.")
81 91
 
82 92
     def get_success_url(self):
83 93
         return reverse('horizon:project:application_policy:index')
84 94
 
85
-    def get_object_id(self, policyaction):
86
-        return [policyaction.id]
87 95
 
88
-
89
-class UpdatePolicyActionView(forms.ModalFormView):
96
+class UpdatePolicyActionView(gbforms.HelpTextModalMixin,
97
+                             gbforms.ReversingModalFormView):
90 98
     form_class = policy_rule_set_forms.UpdatePolicyActionForm
91
-    template_name = "project/application_policy/update_policy_action.html"
99
+    template_name = "gbpui/form_with_description.html"
100
+    submit_url = "horizon:project:application_policy:updatepolicyaction"
101
+    modal_header = _("Edit Policy Action")
102
+    page_title = _("Edit Policy Action")
103
+    submit_label = _("Save Changes")
104
+    help_text = _("Edit Policy Action.")
92 105
 
93
-    def get_context_data(self, **kwargs):
94
-        context = super(
95
-            UpdatePolicyActionView, self).get_context_data(**kwargs)
96
-        context['policyaction_id'] = self.kwargs['policyaction_id']
97
-        return context
106
+    def get_submit_url_params(self, **kwargs):
107
+        return {"policyaction_id": self.kwargs['policyaction_id']}
98 108
 
99 109
     def get_initial(self):
100 110
         return {'policyaction_id': self.kwargs['policyaction_id']}
@@ -102,22 +112,29 @@ class UpdatePolicyActionView(forms.ModalFormView):
102 112
 
103 113
 class PolicyRuleSetDetailsView(tabs.TabView):
104 114
     tab_group_class = (PolicyRuleSetDetailsTabs)
105
-    template_name = 'project/application_policy/details_tabs.html'
115
+    template_name = 'gbpui/details_tabs.html'
116
+    page_title = _("Policy Rule Set Details")
106 117
 
107 118
 
108 119
 class PolicyRuleDetailsView(tabs.TabView):
109 120
     tab_group_class = (PolicyRuleDetailsTabs)
110
-    template_name = 'project/application_policy/details_tabs.html'
121
+    template_name = 'gbpui/details_tabs.html'
122
+    page_title = _("Policy Rule Details")
111 123
 
112 124
 
113
-class UpdatePolicyRuleView(forms.ModalFormView):
125
+class UpdatePolicyRuleView(gbforms.HelpTextModalMixin,
126
+                           gbforms.ReversingModalFormView):
114 127
     form_class = policy_rule_set_forms.UpdatePolicyRuleForm
115
-    template_name = "project/application_policy/update_policy_rule.html"
116 128
 
117
-    def get_context_data(self, **kwargs):
118
-        context = super(UpdatePolicyRuleView, self).get_context_data(**kwargs)
119
-        context['policyrule_id'] = self.kwargs['policyrule_id']
120
-        return context
129
+    modal_header = _("Edit Policy Rule")
130
+    submit_label = _("Update Policy Rule")
131
+    submit_url = "horizon:project:application_policy:updatepolicyrule"
132
+    template_name = "gbpui/form_with_description.html"
133
+    page_title = _("Edit Policy Rule")
134
+    help_text = _("Edit Policy Rule.")
135
+
136
+    def get_submit_url_params(self, **kwargs):
137
+        return {"policyrule_id": self.kwargs['policyrule_id']}
121 138
 
122 139
     def get_initial(self):
123 140
         return {'policyrule_id': self.kwargs['policyrule_id']}
@@ -125,18 +142,22 @@ class UpdatePolicyRuleView(forms.ModalFormView):
125 142
 
126 143
 class PolicyClassifierDetailsView(tabs.TabView):
127 144
     tab_group_class = (PolicyClassifierDetailsTabs)
128
-    template_name = 'project/application_policy/details_tabs.html'
145
+    template_name = "gbpui/details_tabs.html"
146
+    page_title = _("Policy Classifier Details")
129 147
 
130 148
 
131
-class UpdatePolicyClassifierView(forms.ModalFormView):
149
+class UpdatePolicyClassifierView(gbforms.HelpTextModalMixin,
150
+                                 gbforms.ReversingModalFormView):
132 151
     form_class = policy_rule_set_forms.UpdatePolicyClassifierForm
133
-    template_name = "project/application_policy/update_policy_classifier.html"
152
+    modal_header = _("Edit Policy Classifier")
153
+    submit_label = _("Update Policy Classifier")
154
+    submit_url = "horizon:project:application_policy:updatepolicyclassifier"
155
+    template_name = "gbpui/form_with_description.html"
156
+    page_title = _("Edit Policy Classifier")
157
+    help_text = _("Edit Policy Classifier.")
134 158
 
135
-    def get_context_data(self, **kwargs):
136
-        context = super(
137
-            UpdatePolicyClassifierView, self).get_context_data(**kwargs)
138
-        context['policyclassifier_id'] = self.kwargs['policyclassifier_id']
139
-        return context
159
+    def get_submit_url_params(self, **kwargs):
160
+        return {"policyclassifier_id": self.kwargs['policyclassifier_id']}
140 161
 
141 162
     def get_initial(self):
142 163
         return {'policyclassifier_id': self.kwargs['policyclassifier_id']}
@@ -144,4 +165,5 @@ class UpdatePolicyClassifierView(forms.ModalFormView):
144 165
 
145 166
 class PolicyActionDetailsView(tabs.TabView):
146 167
     tab_group_class = (PolicyActionDetailsTabs)
147
-    template_name = 'project/application_policy/details_tabs.html'
168
+    template_name = "gbpui/details_tabs.html"
169
+    page_title = _("Policy Action Details")

+ 0
- 25
gbpui/panels/network_policy/templates/network_policy/_add_l2policy.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}add_l2policy_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:addl2policy' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add L2Policy" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Add L2 Policy." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
24
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}  

+ 0
- 45
gbpui/panels/network_policy/templates/network_policy/_add_l3policy.html View File

@@ -1,45 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}add_l3policy_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:addl3policy' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add L3Policy" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Add L3 Policy." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-
23
-{% block modal-js %}
24
-<script>
25
- $(function(){
26
-   if($('#id_external_segments>option:selected').val() == ''){
27
-       $('#id_segment_ip').parent().parent().hide();
28
-   }
29
-   $('#id_external_segments').on('change',function(){
30
-   if($('#id_external_segments>option:selected').val() == ''){
31
-       $('#id_segment_ip').parent().parent().hide();
32
-   }else{
33
-       $('#id_segment_ip').parent().parent().show();
34
-   }
35
-  });
36
-});
37
-</script>
38
-{% endblock %}
39
-
40
-
41
-
42
-{% block modal-footer %}
43
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
44
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
45
-{% endblock %}    

+ 0
- 24
gbpui/panels/network_policy/templates/network_policy/_create_external_connectivity.html View File

@@ -1,24 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}create_external_connectivity{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:create_external_connectivity' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Create External Connectivity" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-</div>
19
-{% endblock %}
20
-
21
-{% block modal-footer %}
22
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Create" %}" />
23
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
24
-{% endblock %} 

+ 0
- 24
gbpui/panels/network_policy/templates/network_policy/_create_external_route_param.html View File

@@ -1,24 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}add_external_route_param_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:add_external_route_param' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add External Route Parameter" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-</div>
19
-{% endblock %}
20
-
21
-{% block modal-footer %}
22
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Create" %}" />
23
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
24
-{% endblock %} 

+ 0
- 24
gbpui/panels/network_policy/templates/network_policy/_create_external_segment_param.html View File

@@ -1,24 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}add_external_segment_param_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:add_external_segment_param' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add External Segment Parameter" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-</div>
19
-{% endblock %}
20
-
21
-{% block modal-footer %}
22
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Create" %}" />
23
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
24
-{% endblock %}

+ 0
- 24
gbpui/panels/network_policy/templates/network_policy/_create_nat_pool.html View File

@@ -1,24 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}create_nat_pool{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:create_nat_pool' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Create NAT Pool" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-</div>
19
-{% endblock %}
20
-
21
-{% block modal-footer %}
22
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Create" %}" />
23
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
24
-{% endblock %}

+ 0
- 24
gbpui/panels/network_policy/templates/network_policy/_create_network_service_param.html View File

@@ -1,24 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}add_network_service_param_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:add_network_service_param' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add Network Service Parameter" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-</div>
19
-{% endblock %}
20
-
21
-{% block modal-footer %}
22
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Create" %}" />
23
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
24
-{% endblock %} 

+ 0
- 25
gbpui/panels/network_policy/templates/network_policy/_create_service_policy.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}create_service_policy_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:create_servicepolicy' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Create Service Policy" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Create Service Policy." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Create" %}" />
24
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}   

+ 0
- 25
gbpui/panels/network_policy/templates/network_policy/_update_external_connectivity.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_external_connectivity_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:update_externalconnectivity' external_connectivity_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Update External Connectivity" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Update Service Policy." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Update" %}" />
24
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}    

+ 0
- 25
gbpui/panels/network_policy/templates/network_policy/_update_l2policy.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_l2policy_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:update_l2policy' l2policy_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Update L2Policy" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Update L2 Policy." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
24
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 44
gbpui/panels/network_policy/templates/network_policy/_update_l3policy.html View File

@@ -1,44 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_l3policy_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:update_l3policy' l3policy_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Update L3Policy" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Update L3 Policy." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-
23
-{% block modal-js %}
24
-<script>
25
- $(function(){
26
-   if($('#id_external_segments>option:selected').val() == ''){
27
-       $('#id_segment_ip').parent().parent().hide();
28
-   }
29
-   $('#id_external_segments').on('change',function(){
30
-   if($('#id_external_segments>option:selected').val() == ''){
31
-       $('#id_segment_ip').parent().parent().hide();
32
-   }else{
33
-       $('#id_segment_ip').parent().parent().show();
34
-   }
35
-  });
36
-});
37
-</script>
38
-{% endblock %}
39
-
40
-
41
-{% block modal-footer %}
42
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
43
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
44
-{% endblock %}

+ 0
- 25
gbpui/panels/network_policy/templates/network_policy/_update_nat_pool.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_nat_pool_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:update_natpool' nat_pool_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Update NAT Pool" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Update NAT Pool." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Update" %}" />
24
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/network_policy/templates/network_policy/_update_service_policy.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_service_policy_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_policy:update_service_policy' service_policy_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Update Service Policy" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Update Service Policy." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Update" %}" />
24
-  <a href="{% url 'horizon:project:network_policy:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}    

+ 0
- 15
gbpui/panels/network_policy/templates/network_policy/details_tabs.html View File

@@ -1,15 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Network and Services' Policies" %}{% endblock %}
4
-
5
-{% block page_header %}
6
-{% include "horizon/common/_page_header.html" with title=_("Network and Services' Policies") %}
7
-{% endblock page_header %}
8
-
9
-{% block main %}
10
-<div class="row">
11
-  <div class="col-sm-12">
12
-  {{ tab_group.render }}
13
-  </div>
14
-</div>
15
-{% endblock %} 

+ 130
- 83
gbpui/panels/network_policy/views.py View File

@@ -13,11 +13,11 @@ from django.core.urlresolvers import reverse
13 13
 from django.utils.translation import ugettext_lazy as _
14 14
 
15 15
 from horizon import exceptions
16
-from horizon import forms
17 16
 from horizon import tables
18 17
 from horizon import tabs
19 18
 
20 19
 from gbpui import client
20
+from gbpui.common import forms as gbforms
21 21
 
22 22
 import forms as np_forms
23 23
 import tables as np_tables
@@ -26,29 +26,37 @@ import tabs as np_tabs
26 26
 
27 27
 class IndexView(tabs.TabbedTableView):
28 28
     tab_group_class = (np_tabs.L3PolicyTabs)
29
-    template_name = 'project/network_policy/details_tabs.html'
29
+    template_name = "gbpui/details_tabs.html"
30
+    page_title = _("Network and Services' Policies")
30 31
 
31 32
 
32
-class AddL3policyView(forms.ModalFormView):
33
+class AddL3policyView(gbforms.HelpTextModalMixin,
34
+                      gbforms.ReversingModalFormView):
33 35
     form_class = np_forms.AddL3PolicyForm
34
-    template_name = "project/network_policy/add_l3policy.html"
35 36
 
36
-    def get_context_data(self, **kwargs):
37
-        context = super(AddL3policyView, self).get_context_data(**kwargs)
38
-        return context
37
+    template_name = "gbpui/form_with_description.html"
38
+    submit_url = "horizon:project:network_policy:addl3policy"
39
+    modal_header = _("Add L3Policy")
40
+    submit_label = _("Create")
41
+    page_title = _("Add L3Policy")
42
+    help_text = _("Add L3 Policy.")
39 43
 
40 44
     def get_initial(self):
41 45
         return self.kwargs
42 46
 
43 47
 
44
-class L3PolicyUpdateView(forms.ModalFormView):
48
+class L3PolicyUpdateView(gbforms.HelpTextModalMixin,
49
+                         gbforms.ReversingModalFormView):
45 50
     form_class = np_forms.UpdateL3PolicyForm
46
-    template_name = "project/network_policy/update_l3policy.html"
51
+    template_name = "gbpui/form_with_description.html"
52
+    submit_url = "horizon:project:network_policy:update_l3policy"
53
+    modal_header = _("Update L3Policy")
54
+    submit_label = _("Save Changes")
55
+    page_title = _("Update L3Policy")
56
+    help_text = _("Update L3Policy.")
47 57
 
48
-    def get_context_data(self, **kwargs):
49
-        context = super(L3PolicyUpdateView, self).get_context_data(**kwargs)
50
-        context['l3policy_id'] = self.kwargs['l3policy_id']
51
-        return context
58
+    def get_submit_url_params(self, **kwargs):
59
+        return {"l3policy_id": self.kwargs["l3policy_id"]}
52 60
 
53 61
     def get_initial(self):
54 62
         return self.kwargs
@@ -76,26 +84,29 @@ class L3PolicyDetailsView(tables.MultiTableView):
76 84
         return context
77 85
 
78 86
 
79
-class AddL2policyView(forms.ModalFormView):
87
+class AddL2policyView(gbforms.HelpTextModalMixin,
88
+                      gbforms.ReversingModalFormView):
80 89
     form_class = np_forms.AddL2PolicyForm
81
-    template_name = "project/network_policy/add_l2policy.html"
82
-
83
-    def get_context_data(self, **kwargs):
84
-        context = super(AddL2policyView, self).get_context_data(**kwargs)
85
-        return context
90
+    template_name = "gbpui/form_with_description.html"
91
+    submit_url = "horizon:project:network_policy:addl2policy"
92
+    modal_header = _("Add L2Policy")
93
+    submit_label = _("Save Changes")
94
+    page_title = _("Add L2Policy")
95
+    help_text = _("Add L2Policy.")
86 96
 
87
-    def get_initial(self):
88
-        return self.kwargs
89 97
 
90
-
91
-class L2PolicyUpdateView(forms.ModalFormView):
98
+class L2PolicyUpdateView(gbforms.HelpTextModalMixin,
99
+                         gbforms.ReversingModalFormView):
92 100
     form_class = np_forms.UpdateL2PolicyForm
93
-    template_name = "project/network_policy/update_l2policy.html"
101
+    template_name = "gbpui/form_with_description.html"
102
+    submit_url = "horizon:project:network_policy:update_l2policy"
103
+    modal_header = _("Update L2Policy")
104
+    submit_label = _("Save Changes")
105
+    page_title = _("Update L2Policy")
106
+    help_text = _("Update L2Policy.")
94 107
 
95
-    def get_context_data(self, **kwargs):
96
-        context = super(L2PolicyUpdateView, self).get_context_data(**kwargs)
97
-        context['l2policy_id'] = self.kwargs['l2policy_id']
98
-        return context
108
+    def get_submit_url_params(self, **kwargs):
109
+        return {"l2policy_id": self.kwargs["l2policy_id"]}
99 110
 
100 111
     def get_initial(self):
101 112
         return self.kwargs
@@ -103,81 +114,112 @@ class L2PolicyUpdateView(forms.ModalFormView):
103 114
 
104 115
 class L2PolicyDetailsView(tabs.TabView):
105 116
     tab_group_class = (np_tabs.L2PolicyDetailsTabs)
106
-    template_name = 'project/network_policy/details_tabs.html'
117
+    template_name = "gbpui/details_tabs.html"
118
+    page_title = _("L2 Policy Details")
107 119
 
108 120
 
109
-class CreateServicePolicyView(forms.ModalFormView):
121
+class CreateServicePolicyView(gbforms.HelpTextModalMixin,
122
+                              gbforms.ReversingModalFormView):
110 123
     form_class = np_forms.CreateServicePolicyForm
111
-    template_name = "project/network_policy/create_service_policy.html"
112 124
 
113
-    def get_context_data(self, **kwargs):
114
-        context = super(
115
-            CreateServicePolicyView, self).get_context_data(**kwargs)
116
-        return context
125
+    template_name = "gbpui/form_with_description.html"
126
+    submit_url = "horizon:project:network_policy:create_servicepolicy"
127
+    modal_header = _("Create Service Policy")
128
+    submit_label = _("Create")
129
+    page_title = _("Create Service Policy")
130
+    help_text = _("Create Service Policy.")
117 131
 
118 132
 
119
-class AddExternalSegmentParamView(forms.ModalFormView):
133
+class AddExternalSegmentParamView(gbforms.HelpTextModalMixin,
134
+                                  gbforms.ReversingModalFormView):
120 135
     form_class = np_forms.CreateExternalSegmentParamForm
121
-    template_name = "project/network_policy/create_external_segment_param.html"
136
+    template_name = "gbpui/form_with_description.html"
137
+    submit_url = "horizon:project:network_policy:add_external_segment_param"
138
+    modal_header = _("Add External Segment Parameter")
139
+    submit_label = _("Create")
140
+    page_title = _("Add External Segment Parameter")
141
+    help_text = _("Add External Segment Parameter.")
122 142
 
123 143
     def get_object_id(self, params):
124 144
         return params.name
125 145
 
126 146
 
127
-class AddNetworkServiceParamView(forms.ModalFormView):
147
+class AddNetworkServiceParamView(gbforms.HelpTextModalMixin,
148
+                                 gbforms.ReversingModalFormView):
128 149
     form_class = np_forms.CreateNetworkServiceParamForm
129
-    template_name = "project/network_policy/create_network_service_param.html"
150
+    template_name = "gbpui/form_with_description.html"
151
+    submit_url = "horizon:project:network_policy:add_network_service_param"
152
+    modal_header = _("Add Network Service Parameter")
153
+    submit_label = _("Create")
154
+    page_title = _("Add Network Service Parameter")
155
+    help_text = _("Add Network Service Parameter.")
130 156
 
131 157
     def get_object_id(self, params):
132 158
         return params.name
133 159
 
134 160
 
135
-class AddExternalRouteParamView(forms.ModalFormView):
161
+class AddExternalRouteParamView(gbforms.HelpTextModalMixin,
162
+                                 gbforms.ReversingModalFormView):
136 163
     form_class = np_forms.CreateExternalRouteParamForm
137
-    template_name = "project/network_policy/create_external_route_param.html"
164
+    template_name = "gbpui/form_with_description.html"
165
+    submit_url = "horizon:project:network_policy:add_external_route_param"
166
+    modal_header = _("Add External Route Parameter")
167
+    submit_label = _("Create")
168
+    page_title = _("Add External Route Parameter")
169
+    help_text = _("Add External Route Parameter.")
138 170
 
139 171
     def get_object_id(self, params):
140 172
         return params.name
141 173
 
142 174
 
143
-class UpdateNATPoolView(forms.ModalFormView):
175
+class UpdateNATPoolView(gbforms.HelpTextModalMixin,
176
+                        gbforms.ReversingModalFormView):
144 177
     form_class = np_forms.UpdateNATPoolForm
145
-    template_name = "project/network_policy/update_nat_pool.html"
178
+    template_name = "gbpui/form_with_description.html"
179
+    submit_url = "horizon:project:network_policy:update_natpool"
180
+    modal_header = _("Update NAT Pool")
181
+    submit_label = _("Save Changes")
182
+    page_title = _("Update NAT Pool")
183
+    help_text = _("Update NAT Pool.")
146 184
 
147
-    def get_context_data(self, **kwargs):
148
-        context = super(
149
-            UpdateNATPoolView, self).get_context_data(**kwargs)
150
-        context['nat_pool_id'] = self.kwargs['nat_pool_id']
151
-        return context
185
+    def get_submit_url_params(self, **kwargs):
186
+        return {"nat_pool_id": self.kwargs["nat_pool_id"]}
152 187
 
153 188
     def get_initial(self):
154 189
         return self.kwargs
155 190
 
156 191
 
157
-class UpdateExternalConnectivityView(forms.ModalFormView):
192
+class UpdateExternalConnectivityView(gbforms.HelpTextModalMixin,
193
+                                     gbforms.ReversingModalFormView):
158 194
     form_class = np_forms.UpdateExternalConnectivityForm
159
-    template_name = "project/network_policy/update_external_connectivity.html"
160
-
161
-    def get_context_data(self, **kwargs):
162
-        context = super(
163
-            UpdateExternalConnectivityView, self).get_context_data(**kwargs)
164
-        context['external_connectivity_id'] = \
165
-            self.kwargs['external_connectivity_id']
166
-        return context
195
+    template_name = "gbpui/form_with_description.html"
196
+    submit_url = "horizon:project:network_policy:update_externalconnectivity"
197
+    modal_header = _("Update External Connectivity")
198
+    submit_label = _("Save Changes")
199
+    page_title = _("Update External Connectivity")
200
+    help_text = _("Update External Connectivity.")
201
+
202
+    def get_submit_url_params(self, **kwargs):
203
+        return {
204
+            "external_connectivity_id": self.kwargs["external_connectivity_id"]
205
+        }
167 206
 
168 207
     def get_initial(self):
169 208
         return self.kwargs
170 209
 
171 210
 
172
-class UpdateServicePolicyView(forms.ModalFormView):
211
+class UpdateServicePolicyView(gbforms.HelpTextModalMixin,
212
+                              gbforms.ReversingModalFormView):
173 213
     form_class = np_forms.UpdateServicePolicyForm
174
-    template_name = "project/network_policy/update_service_policy.html"
214
+    template_name = "gbpui/form_with_description.html"
215
+    submit_url = "horizon:project:network_policy:update_service_policy"
216
+    modal_header = _("Update Service Policy")
217
+    submit_label = _("Save Changes")
218
+    page_title = _("Update Service Policy")
219
+    help_text = _("Update Service Policy.")
175 220
 
176
-    def get_context_data(self, **kwargs):
177
-        context = super(
178
-            UpdateServicePolicyView, self).get_context_data(**kwargs)
179
-        context['service_policy_id'] = self.kwargs['service_policy_id']
180
-        return context
221
+    def get_submit_url_params(self, **kwargs):
222
+        return {"service_policy_id": self.kwargs["service_policy_id"]}
181 223
 
182 224
     def get_initial(self):
183 225
         return self.kwargs
@@ -185,40 +227,45 @@ class UpdateServicePolicyView(forms.ModalFormView):
185 227
 
186 228
 class ServicePolicyDetailsView(tabs.TabView):
187 229
     tab_group_class = (np_tabs.ServicePolicyDetailsTabs)
188
-    template_name = 'project/network_policy/details_tabs.html'
230
+    template_name = 'gbpui/details_tabs.html'
231
+    page_title = _("Service Policy Details")
189 232
 
190 233
 
191
-class CreateExternalConnectivityView(forms.ModalFormView):
234
+class CreateExternalConnectivityView(gbforms.HelpTextModalMixin,
235
+                                     gbforms.ReversingModalFormView):
192 236
     form_class = np_forms.CreateExternalConnectivityForm
193
-    template_name = "project/network_policy/create_external_connectivity.html"
194
-
195
-    def get_context_data(self, **kwargs):
196
-        context = super(
197
-            CreateExternalConnectivityView, self).get_context_data(**kwargs)
198
-        return context
237
+    template_name = "gbpui/form_with_description.html"
238
+    submit_url = "horizon:project:network_policy:create_external_connectivity"
239
+    modal_header = _("Create External Connectivity")
240
+    submit_label = _("Save Changes")
241
+    page_title = _("Create External Connectivity")
242
+    help_text = _("Create External Connectivity.")
199 243
 
200 244
     def get_success_url(self):
201 245
         return reverse('horizon:project:network_policy:index')
202 246
 
203
-    def get_object_id(self, external_segment):
204
-        return [external_segment.id]
205
-
206 247
 
207 248
 class ExternalConnectivityDetailsView(tabs.TabView):
208 249
     tab_group_class = (np_tabs.ExternalConnectivityDetailsTabs)
209
-    template_name = 'project/network_policy/details_tabs.html'
250
+    template_name = "gbpui/details_tabs.html"
251
+    page_title = _("External Connectivity Details")
210 252
 
211 253
 
212
-class CreateNATPoolView(forms.ModalFormView):
254
+class CreateNATPoolView(gbforms.HelpTextModalMixin,
255
+                        gbforms.ReversingModalFormView):
213 256
     form_class = np_forms.CreateNATPoolForm
214
-    template_name = "project/network_policy/create_nat_pool.html"
257
+    template_name = "gbpui/form_with_description.html"
258
+    submit_url = "horizon:project:network_policy:create_nat_pool"
259
+    modal_header = _("Create NAT Pool")
260
+    submit_label = _("Create")
261
+    page_title = _("Create NAT Pool")
262
+    help_text = _("Create NAT Pool.")
215 263
 
216
-    def get_context_data(self, **kwargs):
217
-        context = super(
218
-            CreateNATPoolView, self).get_context_data(**kwargs)
219
-        return context
264
+    def get_success_url(self):
265
+        return reverse('horizon:project:application_policy:index')
220 266
 
221 267
 
222 268
 class NATPoolDetailsView(tabs.TabView):
223 269
     tab_group_class = (np_tabs.NATPoolDetailsTabs)
224
-    template_name = 'project/network_policy/details_tabs.html'
270
+    template_name = 'gbpui/details_tabs.html'
271
+    page_title = _("NAT Pool Details")

+ 0
- 88
gbpui/panels/network_services/forms.py View File

@@ -298,91 +298,3 @@ class UpdateServiceChainSpecForm(CreateServiceChainSpecForm, BaseUpdateForm):
298 298
             msg = _("Failed to update Service Chain Spec.  %s") % (str(e))
299 299
             LOG.error(msg)
300 300
             exceptions.handle(request, msg, redirect=shortcuts.redirect)
301
-
302
-
303
-class CreateServiceChainInstanceForm(forms.SelfHandlingForm):
304
-    name = forms.CharField(max_length=80, label=_("Name"))
305
-    description = forms.CharField(
306
-        max_length=80, label=_("Description"), required=False)
307
-    servicechain_spec = forms.ChoiceField(label=_("ServiceChain Spec"))
308
-    provider_ptg = forms.ChoiceField(label=_("Provider PTG"))
309
-    consumer_ptg = forms.ChoiceField(label=_("Consumer PTG"))
310
-    classifier = forms.ChoiceField(label=_("Classifier"))
311
-
312
-    def __init__(self, request, *args, **kwargs):
313
-        super(CreateServiceChainInstanceForm, self).__init__(
314
-            request, *args, **kwargs)
315
-        try:
316
-            sc_specs = client.servicechainspec_list(request,
317
-                tenant_id=request.user.tenant_id)
318
-            ptgs = client.policy_target_list(request,
319
-                tenant_id=request.user.tenant_id)
320
-            ptgs = [(item.id, item.name) for item in ptgs]
321
-            classifiers = client.policyclassifier_list(request,
322
-                tenant_id=request.user.tenant_id)
323
-            self.fields['servicechain_spec'].choices = [
324
-                (item.id, item.name) for item in sc_specs]
325
-            self.fields['provider_ptg'].choices = ptgs
326
-            self.fields['consumer_ptg'].choices = ptgs
327
-            self.fields['classifier'].choices = [
328
-                (item.id, item.name) for item in classifiers]
329
-        except Exception:
330
-            msg = _("Failed to retrive policy targets")
331
-            LOG.error(msg)
332
-
333
-    def handle(self, request, context):
334
-        url = reverse("horizon:project:network_services:index")
335
-        try:
336
-            if context.get('name'):
337
-                context['name'] = html.escape(context['name'])
338
-            if context.get('description'):
339
-                context['description'] = html.escape(context['description'])
340
-            client.create_servicechain_instance(request, **context)
341
-            msg = _("Service Chain Instance Created Successfully!")
342
-            LOG.debug(msg)
343
-            return http.HttpResponseRedirect(url)
344
-        except Exception as e:
345
-            msg = _("Failed to create Service Chain Instance.  %s") % (str(e))
346
-            LOG.error(msg)
347
-            exceptions.handle(request, msg, redirect=shortcuts.redirect)
348
-
349
-
350
-class UpdateServiceChainInstanceForm(forms.SelfHandlingForm):
351
-    name = forms.CharField(max_length=80, label=_("Name"))
352
-    description = forms.CharField(
353
-        max_length=80, label=_("Description"), required=False)
354
-    servicechain_spec = forms.ChoiceField(label=_("ServiceChain Spec"))
355
-
356
-    def __init__(self, request, *args, **kwargs):
357
-        super(UpdateServiceChainInstanceForm, self).__init__(
358
-            request, *args, **kwargs)
359
-        try:
360
-            scinstance_id = self.initial['scinstance_id']
361
-            sc_specs = client.servicechainspec_list(request,
362
-                tenant_id=request.user.tenant_id)
363
-            self.fields['servicechain_spec'].choices = [
364
-                (item.id, item.name) for item in sc_specs]
365
-            scinstance = client.get_servicechain_instance(
366
-                request, scinstance_id)
367
-            for attr in ['name', 'description', 'servicechain_spec']:
368
-                self.fields[attr].initial = getattr(scinstance, attr)
369
-        except Exception:
370
-            pass
371
-
372
-    def handle(self, request, context):
373
-        url = reverse("horizon:project:network_services:index")
374
-        try:
375
-            scinstance_id = self.initial['scinstance_id']
376
-            if context.get('name'):
377
-                context['name'] = html.escape(context['name'])
378
-            if context.get('description'):
379
-                context['description'] = html.escape(context['description'])
380
-            client.update_servicechain_instance(
381
-                request, scinstance_id, **context)
382
-            msg = _("Service Chain Instance Created Successfully!")
383
-            LOG.debug(msg)
384
-            return http.HttpResponseRedirect(url)
385
-        except Exception as e:
386
-            msg = _("Failed to create Service Chain Instance.  %s") % (str(e))
387
-            LOG.error(msg)
388
-            exceptions.handle(request, msg, redirect=shortcuts.redirect)

+ 0
- 25
gbpui/panels/network_services/templates/network_services/_create_service_chain_instance.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}create_service_chain_instance{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_services:create_sc_instance' %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Create Service Chain Instance" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Create Service Chain Instance." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
24
-  <a href="{% url 'horizon:project:network_services:create_sc_instance' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}   

+ 0
- 26
gbpui/panels/network_services/templates/network_services/_create_service_chain_node.html View File

@@ -1,26 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}create_service_chain_node{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_services:create_sc_node' %}{% endblock %}
7
-{% block form_attrs %}enctype="multipart/form-data"{% endblock %}
8
-
9
-{% block modal-header %}{% trans "Create Service Chain Node" %}{% endblock %}
10
-
11
-{% block modal-body %}
12
-<div class="left">
13
-    <fieldset>
14
-    {% include "horizon/common/_form_fields.html" %}
15
-    </fieldset>
16
-</div>
17
-<div class="right">
18
-    <h3>{% trans "Description:" %}</h3>
19
-    <p>{% trans "Create Service Chain Node." %}</p>
20
-</div>
21
-{% endblock %}
22
-
23
-{% block modal-footer %}
24
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
25
-  <a href="{% url 'horizon:project:network_services:create_sc_node' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
26
-{% endblock %}

+ 0
- 26
gbpui/panels/network_services/templates/network_services/_create_service_profile.html View File

@@ -1,26 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}create_service_profile_form{% endblock %}
6
-{% block form_action %}{% url "horizon:project:network_services:create_service_profile" %}{% endblock %}
7
-
8
-{% block modal_id %}create_service_profile_modal{% endblock %}
9
-{% block modal-header %}{% trans "Create Service Profile" %}{% endblock %}
10
-
11
-{% block modal-body %}
12
-<div class="left">
13
-  <fieldset>
14
-  {% include "horizon/common/_form_fields.html" %}
15
-  </fieldset>
16
-</div>
17
-<div class="right">
18
-  <h3>{% trans "Description" %}:</h3>
19
-  <p>{% trans "Create Service Profile." %}</p>
20
-</div>
21
-{% endblock %}
22
-
23
-{% block modal-footer %}
24
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save changes" %}" />
25
-  <a href="{% url "horizon:project:network_services:index" %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
26
-{% endblock %}

+ 32
- 32
gbpui/panels/network_services/templates/network_services/_scspec_details.html View File

@@ -4,7 +4,7 @@
4 4
 <div class="info row detail">
5 5
 	<hr class="header_rule">
6 6
 	<dl>
7
-		<dt>{% trans "Name" %}</dt>
7
+    <dt>{% trans "Name" %}</dt>
8 8
 		<dd>{{ scspec.name|default:_("-") }}</dd>
9 9
 
10 10
 		<dt>{% trans "Description" %}</dt>
@@ -16,35 +16,35 @@
16 16
 		<dt>{% trans "Shared" %}</dt>
17 17
 		<dd>{{ scspec.shared }}</dd>
18 18
 	</dl>
19
-    {% if scspec.nodes %}
20
-    <div class="panel panel-default">
21
-        <div class="panel-heading">Nodes</div>
22
-        <div class="panel-body">
23
-            <table class="table">
24
-                <thead>
25
-                    <tr>
26
-                        <th>Name</th>
27
-                        <th>Service Profile</th>
28
-                        <th>Config</th>
29
-                    </tr>
30
-                </thead>
31
-                {% for node in scspec.nodes %}
32
-                <tr>
33
-                    <td>
34
-                        <a href="{% url 'horizon:project:network_services:sc_node_details' scnode_id=node.id %}">
35
-                            {{node.name}}</a>
36
-                    </td>
37
-                    <td>
38
-                        <a href="{% url 'horizon:project:network_services:service_profile_details' sp_id=node.service_profile_id %}">
39
-                           {{ node.service_profile_id }}</a>
40
-                    </td>
41
-                    <td> 
42
-                        <div style ="white-space:pre;overflow-y: scroll;height:300px;background-color:#EEEEEE">{{node.config}}</div>
43
-                    </td>
44
-                </tr>
45
-				{% endfor %}
46
-            </table>                                                
47
-        </div>
48
-    </div>
49
-    {% endif %}
19
+  {% if scspec.nodes %}
20
+  <div class="panel panel-default">
21
+      <div class="panel-heading">Nodes</div>
22
+      <div class="panel-body">
23
+          <table class="table">
24
+              <thead>
25
+                  <tr>
26
+                      <th>Name</th>
27
+                      <th>Service Profile</th>
28
+                      <th>Config</th>
29
+                  </tr>
30
+              </thead>
31
+              {% for node in scspec.nodes %}
32
+              <tr>
33
+                  <td>
34
+                      <a href="{% url 'horizon:project:network_services:sc_node_details' scnode_id=node.id %}">
35
+                          {{node.name}}</a>
36
+                  </td>
37
+                  <td>
38
+                      <a href="{% url 'horizon:project:network_services:service_profile_details' sp_id=node.service_profile_id %}">
39
+                         {{ node.service_profile_id }}</a>
40
+                  </td>
41
+                  <td>
42
+                      <div style ="white-space:pre;overflow-y: scroll;height:300px;background-color:#EEEEEE">{{node.config}}</div>
43
+                  </td>
44
+              </tr>
45
+      {% endfor %}
46
+          </table>
47
+      </div>
48
+  </div>
49
+  {% endif %}
50 50
 </div>

+ 0
- 0
gbpui/panels/network_services/templates/network_services/_service_chain_spec_details.html View File


+ 0
- 25
gbpui/panels/network_services/templates/network_services/_update_service_chain_instance.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_service_chain_instance{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_services:update_sc_instance' scinstance_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Update Service Chain Instance" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Update Service Chain Instance." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
24
-  <a href="{% url 'horizon:project:network_services:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/network_services/templates/network_services/_update_service_chain_node.html View File

@@ -1,25 +0,0 @@
1
-{% extends "horizon/common/_modal_form.html" %}
2
-{% load i18n %}
3
-{% load url from future %}
4
-
5
-{% block form_id %}update_service_chain_node{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:network_services:update_sc_node' scnode_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Update Service Chain Node" %}{% endblock %}
9
-
10
-{% block modal-body %}
11
-<div class="left">
12
-    <fieldset>
13
-    {% include "horizon/common/_form_fields.html" %}
14
-    </fieldset>
15
-</div>
16
-<div class="right">
17
-    <h3>{% trans "Description:" %}</h3>
18
-    <p>{% trans "Update Service Chain Node." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
24
-  <a href="{% url 'horizon:project:network_services:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 15
gbpui/panels/network_services/templates/network_services/details_tabs.html View File

@@ -1,15 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Network Services" %}{% endblock %}
4
-
5
-{% block page_header %}
6
-{% include "horizon/common/_page_header.html" with title=_("Network Services") %}
7
-{% endblock page_header %}
8
-
9
-{% block main %}
10
-<div class="row">
11
-  <div class="col-sm-12">
12
-  {{ tab_group.render }}
13
-  </div>
14
-</div>
15
-{% endblock %}  

+ 0
- 0
gbpui/panels/network_services/templates/network_services/index.html View File


+ 0
- 7
gbpui/panels/network_services/urls.py View File

@@ -10,7 +10,6 @@
10 10
 #    License for the specific language governing permissions and limitations
11 11
 #    under the License.
12 12
 
13
-
14 13
 from django.conf.urls import url  # noqa
15 14
 
16 15
 import views
@@ -41,12 +40,6 @@ urlpatterns = [
41 40
     url(r'^sc_spec/(?P<scspec_id>[^/]+)/$',
42 41
         views.ServiceChainSpecDetailsView.as_view(),
43 42
         name='sc_spec_details'),
44
-    url(r'^create_sc_instance$',
45
-        views.CreateServiceChainInstanceView.as_view(),
46
-        name='create_sc_instance'),
47
-    url(r'^update_sc_instance/(?P<scinstance_id>[^/]+)/$',
48
-        views.UpdateServiceChainInstanceView.as_view(),
49
-        name='update_sc_instance'),
50 43
     url(r'^sc_instance/(?P<scinstance_id>[^/]+)/$',
51 44
         views.ServiceChainInstanceDetailsView.as_view(),
52 45
         name='sc_instance_details'),

+ 39
- 52
gbpui/panels/network_services/views.py View File

@@ -15,46 +15,56 @@ from horizon import tabs
15 15
 import forms as ns_forms
16 16
 import tabs as ns_tabs
17 17
 
18
+from django.utils.translation import ugettext_lazy as _
19
+from gbpui.common import forms as gbforms
20
+
18 21
 
19 22
 class IndexView(tabs.TabbedTableView):
20 23
     tab_group_class = (ns_tabs.ServiceChainTabs)
21
-    template_name = 'project/network_services/details_tabs.html'
24
+    template_name = 'gbpui/details_tabs.html'
25
+    page_title = _("Network Services")
22 26
 
23 27
 
24 28
 class ServiceProfileDetailsView(tabs.TabView):
25 29
     tab_group_class = (ns_tabs.ServiceProfileDetailsTabGroup)
26
-    template_name = 'project/network_services/details_tabs.html'
30
+    template_name = 'gbpui/details_tabs.html'
31
+    page_title = _("Service Profile Details")
27 32
 
28 33
 
29
-class CreateServiceProfileView(forms.ModalFormView):
34
+class CreateServiceProfileView(gbforms.HelpTextModalMixin,
35
+                               gbforms.ReversingModalFormView):
30 36
     form_class = ns_forms.CreateServiceProfileForm
31
-    template_name = "project/network_services/create_service_profile.html"
37
+    template_name = "gbpui/form_with_description.html"
38
+    submit_url = "horizon:project:network_services:create_service_profile"
39
+    modal_header = _("Create Service Profile")
40
+    submit_label = _("Create")
41
+    page_title = _("Create Service Profile")
42
+    help_text = _("Create Service Profile.")
32 43
 
33
-    def get_context_data(self, **kwargs):
34
-        context = super(
35
-            CreateServiceProfileView, self).get_context_data(**kwargs)
36
-        return context
37 44
 
38
-
39
-class CreateServiceChainNodeView(forms.ModalFormView):
45
+class CreateServiceChainNodeView(gbforms.HelpTextModalMixin,
46
+                                 gbforms.ReversingModalFormView):
40 47
     form_class = ns_forms.CreateServiceChainNodeForm
41
-    template_name = "project/network_services/create_service_chain_node.html"
42
-
43
-    def get_context_data(self, **kwargs):
44
-        context = super(
45
-            CreateServiceChainNodeView, self).get_context_data(**kwargs)
46
-        return context
48
+    template_name = "gbpui/form_with_description.html"
49
+    submit_url = "horizon:project:network_services:create_sc_node"
50
+    modal_header = _("Create Service Chain Node")
51
+    submit_label = _("Create")
52
+    page_title = _("Create Service Chain Node")
53
+    help_text = _("Create Service Chain Node.")
47 54
 
48 55
 
49
-class UpdateServiceChainNodeView(forms.ModalFormView):
56
+class UpdateServiceChainNodeView(gbforms.HelpTextModalMixin,
57
+                                 gbforms.ReversingModalFormView):
50 58
     form_class = ns_forms.UpdateServiceChainNodeForm
51
-    template_name = "project/network_services/update_service_chain_node.html"
59
+    template_name = "gbpui/form_with_description.html"
60
+    submit_url = "horizon:project:network_services:update_sc_node"
61
+    modal_header = _("Update Service Chain Node")
62
+    submit_label = _("Save Changes")
63
+    page_title = _("Update Service Chain Node")
64
+    help_text = _("Update Service Chain Node.")
52 65
 
53
-    def get_context_data(self, **kwargs):
54
-        context = super(
55
-            UpdateServiceChainNodeView, self).get_context_data(**kwargs)
56
-        context['scnode_id'] = self.kwargs['scnode_id']
57
-        return context
66
+    def get_submit_url_params(self, **kwargs):
67
+        return {"scnode_id": self.kwargs['scnode_id']}
58 68
 
59 69
     def get_initial(self):
60 70
         return self.kwargs
@@ -62,7 +72,8 @@ class UpdateServiceChainNodeView(forms.ModalFormView):
62 72
 
63 73
 class ServiceChainNodeDetailsView(tabs.TabView):
64 74
     tab_group_class = (ns_tabs.SCNodeDetailsTabGroup)
65
-    template_name = 'project/network_services/details_tabs.html'
75
+    template_name = 'gbpui/details_tabs.html'
76
+    page_title = _("Service Chain Node Details")
66 77
 
67 78
 
68 79
 class CreateServiceChainSpecView(forms.ModalFormView):
@@ -91,35 +102,11 @@ class UpdateServiceChainSpecView(forms.ModalFormView):
91 102
 
92 103
 class ServiceChainSpecDetailsView(tabs.TabView):
93 104
     tab_group_class = (ns_tabs.SCSpecDetailsTabGroup)
94
-    template_name = 'project/network_services/details_tabs.html'
95
-
96
-
97
-class CreateServiceChainInstanceView(forms.ModalFormView):
98
-    form_class = ns_forms.CreateServiceChainInstanceForm
99
-    template_name = "project/network_services/" \
100
-                    "create_service_chain_instance.html"
101
-
102
-    def get_context_data(self, **kwargs):
103
-        context = super(
104
-            CreateServiceChainInstanceView, self).get_context_data(**kwargs)
105
-        return context
106
-
107
-
108
-class UpdateServiceChainInstanceView(forms.ModalFormView):
109
-    form_class = ns_forms.UpdateServiceChainInstanceForm
110
-    template_name = "project/network_services/" \
111
-                    "update_service_chain_instance.html"
112
-
113
-    def get_context_data(self, **kwargs):
114
-        context = super(
115
-            UpdateServiceChainInstanceView, self).get_context_data(**kwargs)
116
-        context['scinstance_id'] = self.kwargs['scinstance_id']
117
-        return context
118
-
119
-    def get_initial(self):
120
-        return self.kwargs
105
+    template_name = 'gbpui/details_tabs.html'
106
+    page_title = _("Service Chain Spec Details")
121 107
 
122 108
 
123 109
 class ServiceChainInstanceDetailsView(tabs.TabView):
124 110
     tab_group_class = (ns_tabs.SCInstanceDetailsTabGroup)
125
-    template_name = 'project/network_services/details_tabs.html'
111
+    template_name = 'gbpui/details_tabs.html'
112
+    page_title = _("Service Chain Instance Details")

+ 0
- 11
gbpui/panels/policytargets/templates/policytargets/group_details.html View File

@@ -1,11 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Groups Details" %}{% endblock %}
4
-
5
-{% block main %}
6
-<div class="row">
7
-  <div class="col-sm-12">
8
-  {{ tab_group.render }}
9
-  </div>
10
-</div>
11
-{% endblock %} 

+ 31
- 36
gbpui/panels/policytargets/views.py View File

@@ -12,13 +12,11 @@
12 12
 
13 13
 import json
14 14
 
15
-from django.core.urlresolvers import reverse
16 15
 from django.core.urlresolvers import reverse_lazy
17 16
 from django.http import HttpResponse  # noqa
18 17
 from django.utils.translation import ugettext_lazy as _
19 18
 
20 19
 from horizon import exceptions
21
-from horizon import forms
22 20
 from horizon import tabs
23 21
 from horizon.utils import memoized
24 22
 from horizon import workflows
@@ -45,7 +43,7 @@ AddExternalPTG = policy_target_workflows.AddExternalPTG
45 43
 
46 44
 class IndexView(tabs.TabbedTableView):
47 45
     tab_group_class = (PTGTabs)
48
-    template_name = 'project/policytargets/details_tabs.html'
46
+    template_name = 'gbpui/details_tabs.html'
49 47
     page_title = _("Groups")
50 48
 
51 49
 
@@ -59,7 +57,7 @@ class AddExternalPTGView(workflows.WorkflowView):
59 57
 
60 58
 class PTGDetailsView(tabs.TabbedTableView):
61 59
     tab_group_class = (policy_target_tabs.PTGMemberTabs)
62
-    template_name = 'project/policytargets/group_details.html'
60
+    template_name = 'gbpui/details_tabs.html'
63 61
     page_title = _("Group: {{ policy_target.name }}")
64 62
 
65 63
     def get_context_data(self, **kwargs):
@@ -75,7 +73,7 @@ class PTGDetailsView(tabs.TabbedTableView):
75 73
 
76 74
 class ExternalPTGDetailsView(tabs.TabbedTableView):
77 75
     tab_group_class = (policy_target_tabs.ExternalPTGMemberTabs)
78
-    template_name = 'project/policytargets/group_details.html'
76
+    template_name = 'gbpui/details_tabs.html'
79 77
     page_title = _("Group: {{ policy_target.name }}")
80 78
 
81 79
     def get_context_data(self, **kwargs):
@@ -92,7 +90,6 @@ class ExternalPTGDetailsView(tabs.TabbedTableView):
92 90
 
93 91
 class LaunchVMView(workflows.WorkflowView):
94 92
     workflow_class = policy_target_workflows.LaunchInstance
95
-    template_name = "project/policytargets/add_vm.html"
96 93
 
97 94
     def get_initial(self):
98 95
         initial = super(LaunchVMView, self).get_initial()
@@ -101,7 +98,8 @@ class LaunchVMView(workflows.WorkflowView):
101 98
         return initial
102 99
 
103 100
 
104
-class UpdatePTGView(forms.ModalFormView):
101
+class UpdatePTGView(gbforms.HelpTextModalMixin,
102
+                    gbforms.ReversingModalFormView):
105 103
     form_class = policy_target_forms.UpdatePolicyTargetForm
106 104
     form_id = "update_policy_target_form"
107 105
     modal_header = _("Edit Group")
@@ -113,16 +111,10 @@ class UpdatePTGView(forms.ModalFormView):
113 111
     page_title = _("Edit Group")
114 112
     help_text = _("You may update group details here.")
115 113
 
116
-    def get_context_data(self, **kwargs):
117
-        context = super(UpdatePTGView, self).get_context_data(**kwargs)
118
-        obj_id = self.kwargs['policy_target_id']
119
-        context["policy_target_id"] = obj_id
120
-        obj = self._get_object()
121
-        if obj:
122
-            context['name'] = obj.name
123
-        context["submit_url"] = reverse(self.submit_url, args=(obj_id,))
124
-        context["help_text"] = self.help_text
125
-        return context
114
+    def get_submit_url_params(self, **kwargs):
115
+        return {
116
+            "policy_target_id": self.kwargs["policy_target_id"]
117
+        }
126 118
 
127 119
     @memoized.memoized_method
128 120
     def _get_object(self, *args, **kwargs):
@@ -141,7 +133,8 @@ class UpdatePTGView(forms.ModalFormView):
141 133
         return self.kwargs
142 134
 
143 135
 
144
-class UpdateExternalPTGView(forms.ModalFormView):
136
+class UpdateExternalPTGView(gbforms.HelpTextModalMixin,
137
+                            gbforms.ReversingModalFormView):
145 138
     form_class = policy_target_forms.UpdateExternalPolicyTargetForm
146 139
     form_id = "update_policy_target_form"
147 140
     modal_header = _("Edit Group")
@@ -153,16 +146,10 @@ class UpdateExternalPTGView(forms.ModalFormView):
153 146
     page_title = _("Edit Group")
154 147
     help_text = _("You may update external policy details here.")
155 148
 
156
-    def get_context_data(self, **kwargs):
157
-        context = super(UpdateExternalPTGView, self).get_context_data(**kwargs)
158
-        obj_id = self.kwargs['ext_policy_target_id']
159
-        context["ext_policy_target_id"] = obj_id
160
-        obj = self._get_object()
161
-        if obj:
162
-            context['name'] = obj.name
163
-        context["submit_url"] = reverse(self.submit_url, args=(obj_id,))
164
-        context["help_text"] = self.help_text
165
-        return context
149
+    def get_submit_url_params(self, **kwargs):
150
+        return {
151
+            "ext_policy_target_id": self.kwargs["ext_policy_target_id"]
152
+        }
166 153
 
167 154
     @memoized.memoized_method
168 155
     def _get_object(self, *args, **kwargs):
@@ -181,7 +168,8 @@ class UpdateExternalPTGView(forms.ModalFormView):
181 168
         return self.kwargs
182 169
 
183 170
 
184
-class ExtAddProvidedPRSView(gbforms.ReversingModalFormView):
171
+class ExtAddProvidedPRSView(gbforms.HelpTextModalMixin,
172
+                            gbforms.ReversingModalFormView):
185 173
     form_class = policy_target_forms.ExtAddProvidedPRSForm
186 174
     form_id = "ext_add_provided_form"
187 175
     modal_header = _("Add Provided PRS")
@@ -202,7 +190,8 @@ class ExtAddProvidedPRSView(gbforms.ReversingModalFormView):
202 190
         return self.kwargs
203 191
 
204 192
 
205
-class ExtRemoveProvidedPRSView(gbforms.ReversingModalFormView):
193
+class ExtRemoveProvidedPRSView(gbforms.HelpTextModalMixin,
194
+                               gbforms.ReversingModalFormView):
206 195
     form_class = policy_target_forms.ExtRemoveProvidedPRSForm
207 196
     form_id = "ext_remove_provided_form"
208 197
     modal_header = _("Remove Provided PRS")
@@ -223,7 +212,8 @@ class ExtRemoveProvidedPRSView(gbforms.ReversingModalFormView):
223 212
         return self.kwargs
224 213
 
225 214
 
226
-class AddProvidedPRSView(gbforms.ReversingModalFormView):
215
+class AddProvidedPRSView(gbforms.HelpTextModalMixin,
216
+                         gbforms.ReversingModalFormView):
227 217
     form_class = policy_target_forms.AddProvidedPRSForm
228 218
     form_id = "add_provided_form"
229 219
     modal_header = _("Add Provided PRS")
@@ -244,7 +234,8 @@ class AddProvidedPRSView(gbforms.ReversingModalFormView):
244 234
         return self.kwargs
245 235
 
246 236
 
247
-class RemoveProvidedPRSView(gbforms.ReversingModalFormView):
237
+class RemoveProvidedPRSView(gbforms.HelpTextModalMixin,
238
+                            gbforms.ReversingModalFormView):
248 239
     form_class = policy_target_forms.RemoveProvidedPRSForm
249 240
     form_id = "remove_provided_form"
250 241
     modal_header = _("Remove Provided PRS")
@@ -265,7 +256,8 @@ class RemoveProvidedPRSView(gbforms.ReversingModalFormView):
265 256
         return self.kwargs
266 257
 
267 258
 
268
-class ExtAddConsumedPRSView(gbforms.ReversingModalFormView):
259
+class ExtAddConsumedPRSView(gbforms.HelpTextModalMixin,
260
+                            gbforms.ReversingModalFormView):
269 261
     form_class = policy_target_forms.ExtAddConsumedPRSForm
270 262
     form_id = "ext_add_consumed_form"
271 263
     modal_header = _("Add Policy Rule Set")
@@ -286,7 +278,8 @@ class ExtAddConsumedPRSView(gbforms.ReversingModalFormView):
286 278
         return self.kwargs
287 279
 
288 280
 
289
-class ExtRemoveConsumedPRSView(gbforms.ReversingModalFormView):
281
+class ExtRemoveConsumedPRSView(gbforms.HelpTextModalMixin,
282
+                               gbforms.ReversingModalFormView):
290 283
     form_class = policy_target_forms.ExtRemoveConsumedPRSForm
291 284
     form_id = "remove_contract_form"
292 285
     modal_header = _("Remove Policy Rule Set")
@@ -307,7 +300,8 @@ class ExtRemoveConsumedPRSView(gbforms.ReversingModalFormView):
307 300
         return self.kwargs
308 301
 
309 302
 
310
-class AddConsumedPRSView(gbforms.ReversingModalFormView):
303
+class AddConsumedPRSView(gbforms.HelpTextModalMixin,
304
+                         gbforms.ReversingModalFormView):
311 305
     form_class = policy_target_forms.AddConsumedPRSForm
312 306
     form_id = "add_consumed_form"
313 307
     modal_header = _("Add ")
@@ -328,7 +322,8 @@ class AddConsumedPRSView(gbforms.ReversingModalFormView):
328 322
         return self.kwargs
329 323
 
330 324
 
331
-class RemoveConsumedPRSView(gbforms.ReversingModalFormView):
325
+class RemoveConsumedPRSView(gbforms.HelpTextModalMixin,
326
+                            gbforms.ReversingModalFormView):
332 327
     form_class = policy_target_forms.RemoveConsumedPRSForm
333 328
     form_id = "remove_contract_form"
334 329
     modal_header = _("Remove Policy Rule Set")

gbpui/panels/policytargets/templates/policytargets/details_tabs.html → gbpui/templates/gbpui/details_tabs.html View File

@@ -1,6 +1,6 @@
1 1
 {% extends 'base.html' %}
2 2
 {% load i18n %}
3
-{% block title %}{% trans "Groups" %}{% endblock %}
3
+{% block title %}{{ page_title }}{% endblock %}
4 4
 
5 5
 {% block main %}
6 6
 <div class="row">

Loading…
Cancel
Save