Browse Source

Update templates in policytargets section.

Templates used throughout GBP UI were not properly updated
for several OpenStack releases. This update removes unused templates
and reduces unnecessary complexity. Additionally, this fixes problems
with missing non-ajax version of templates, that breaks standalone
rendering of forms and workflows (e. g. when opened in new tab or after
re-login when session expires during while working with forms).

This commit fixes ony policytargets section.

Partial-Bug: #1710852
Co-Authored-By: Marek Lycka <marek.lycka@ultimum.io>
Change-Id: I4f8f6cef04fd514eccb428e8a89cc030ae99cb2a
Aleš Křivák 1 year ago
parent
commit
268ae1259a
31 changed files with 101 additions and 601 deletions
  1. 0
    0
      gbpui/common/__init__.py
  2. 33
    0
      gbpui/common/forms.py
  3. 1
    1
      gbpui/panels/policytargets/tabs.py
  4. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_add_consumed.html
  5. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_add_consumed_prs.html
  6. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_add_contract.html
  7. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_add_l3policy.html
  8. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_add_policy_rule_set.html
  9. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_add_provided_prs.html
  10. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_add_vm.html
  11. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_del_vm.html
  12. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_ext_add_consumed_prs.html
  13. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_ext_add_provided_prs.html
  14. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_ext_remove_consumed_prs.html
  15. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_ext_remove_provided_prs.html
  16. 0
    17
      gbpui/panels/policytargets/templates/policytargets/_l3_policy_details.html
  17. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_remove_consumed.html
  18. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_remove_consumed_prs.html
  19. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_remove_contract.html
  20. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_remove_provided_prs.html
  21. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_update_external_policy_target.html
  22. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_update_l3policy.html
  23. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_update_policy_target.html
  24. 0
    25
      gbpui/panels/policytargets/templates/policytargets/_updateepg.html
  25. 0
    11
      gbpui/panels/policytargets/templates/policytargets/addepg.html
  26. 0
    4
      gbpui/panels/policytargets/templates/policytargets/details_tabs.html
  27. 0
    4
      gbpui/panels/policytargets/templates/policytargets/group_details.html
  28. 0
    11
      gbpui/panels/policytargets/templates/policytargets/updateepg.html
  29. 53
    53
      gbpui/panels/policytargets/views.py
  30. 7
    0
      gbpui/templates/gbpui/_form_with_description.html
  31. 7
    0
      gbpui/templates/gbpui/form_with_description.html

+ 0
- 0
gbpui/common/__init__.py View File


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

@@ -0,0 +1,33 @@
1
+# Copyright 2012 Nebula, Inc.
2
+#
3
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+#    not use this file except in compliance with the License. You may obtain
5
+#    a copy of the License at
6
+#
7
+#         http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+#    Unless required by applicable law or agreed to in writing, software
10
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+#    License for the specific language governing permissions and limitations
13
+#    under the License.
14
+
15
+from horizon import forms
16
+
17
+from django.core.urlresolvers import reverse
18
+
19
+
20
+class ReversingModalFormView(forms.ModalFormView):
21
+    def get_context_data(self, **kwargs):
22
+        context = super(ReversingModalFormView, self).get_context_data(
23
+            **kwargs)
24
+        context['submit_url'] = self.get_submit_url(**kwargs)
25
+        return context
26
+
27
+    def get_submit_url_params(self, **kwargs):
28
+        return {}
29
+
30
+    def get_submit_url(self, **kwargs):
31
+        submit_params = self.get_submit_url_params(**kwargs)
32
+        submit_url = reverse(self.submit_url, kwargs=submit_params)
33
+        return submit_url

+ 1
- 1
gbpui/panels/policytargets/tabs.py View File

@@ -84,7 +84,7 @@ class PTGDetailsTab(tabs.Tab):
84 84
     name = _("Group Details")
85 85
     slug = "policy_targetdetails"
86 86
     template_name = "project/policytargets/_policy_target_details.html"
87
-    failure_url = reverse_lazy('horizon:project:policy_target_group:index')
87
+    failure_url = reverse_lazy('horizon:project:policytargets:index')
88 88
 
89 89
     def get_context_data(self, request):
90 90
         policy_targetid = self.tab_group.kwargs['policy_target_id']

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_add_consumed.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_consumed_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:add_consumed' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add " %}{% 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 Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_add_consumed_prs.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_consumed_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:add_consumed_prs' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add " %}{% 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 Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_add_contract.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_contract_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:add_contract' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add Policy Rule Set" %}{% 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 Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_add_l3policy.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_l3policy_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets: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
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
24
-  <a href="{% url 'horizon:project:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}   

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_add_policy_rule_set.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_contract_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:add_policy_rule_set' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add Policy Rule Set" %}{% 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 Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_add_provided_prs.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_consumed_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:add_provided_prs' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add Provided PRS" %}{% 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 Provided Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_add_vm.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_vm_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:addvm' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Launch 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 "Launch instance here." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Launch" %}" />
24
-  <a href="{% url 'horizon:project:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_del_vm.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_vm_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:addvm' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Launch 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 "Launch instance here." %}</p>
19
-</div>
20
-{% endblock %}
21
-
22
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Launch" %}" />
24
-  <a href="{% url 'horizon:project:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_ext_add_consumed_prs.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_consumed_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:ext_add_consumed_prs' ext_policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add " %}{% 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 Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_ext_add_provided_prs.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 %}ext_add_provider_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:ext_add_provided_prs' ext_policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Add Provided PRS" %}{% 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 Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_ext_remove_consumed_prs.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 %}remove_contract_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:ext_remove_consumed_prs' ext_policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Remove Policy Rule Set" %}{% 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 "Remove Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_ext_remove_provided_prs.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_consumed_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:ext_remove_provided_prs' ext_policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Remove Provided PRS" %}{% 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 "Remove Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 17
gbpui/panels/policytargets/templates/policytargets/_l3_policy_details.html View File

@@ -1,17 +0,0 @@
1
-{% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3
-
4
-<div class="info row detail">
5
-	<hr class="header_rule">
6
-	<dl>
7
-		<dt>{% trans "Name" %}</dt>
8
-		<dd>{{ l3policy.name|default:_("-") }}</dd>
9
-
10
-		<dt>{% trans "Description" %}</dt>
11
-		<dd>{{ l3policy.description|default:_("-") }}</dd>
12
-
13
-		<dt>{% trans "ID" %}</dt>
14
-		<dd>{{ l3policy.id }} </dd>
15
-	</dl>
16
-</div>
17
- 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_remove_consumed.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 %}remove_contract_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:remove_consumed' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Remove Policy Rule Set" %}{% 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 "Remove Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_remove_consumed_prs.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 %}remove_contract_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:remove_consumed_prs' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Remove Policy Rule Set" %}{% 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 "Remove Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_remove_contract.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 %}remove_contract_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:remove_contract' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Remove Policy Rule Set" %}{% 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 "Remove Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_remove_provided_prs.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_consumed_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:remove_provided_prs' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Remove Provided PRS" %}{% 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 "Remove Consumed Policy Rule Set.  Press Ctrl to select multiple items." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %} 

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_update_external_policy_target.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_policy_target_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:update_ext_policy_target' ext_policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Edit Group" %}{% 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 "You may update external group details here." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_update_l3policy.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_l3policy_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets: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
-{% block modal-footer %}
23
-  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
24
-  <a href="{% url 'horizon:project:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}  

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_update_policy_target.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_target_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:updatepolicy_target' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Edit Group" %}{% 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 "You may update group details here." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

+ 0
- 25
gbpui/panels/policytargets/templates/policytargets/_updateepg.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_target_form{% endblock %}
6
-{% block form_action %}{% url 'horizon:project:policytargets:updatepolicy_target' policy_target_id %}{% endblock %}
7
-
8
-{% block modal-header %}{% trans "Edit Group" %}{% 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 "You may update policy_target details here." %}</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:policytargets:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
25
-{% endblock %}

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

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

+ 0
- 4
gbpui/panels/policytargets/templates/policytargets/details_tabs.html View File

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

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

@@ -2,10 +2,6 @@
2 2
 {% load i18n %}
3 3
 {% block title %}{% trans "Groups Details" %}{% endblock %}
4 4
 
5
-{% block page_header %}
6
-{% include "horizon/common/_page_header.html" with title=_("Group : ")|add:policy_target.name %}
7
-{% endblock page_header %}
8
-
9 5
 {% block main %}
10 6
 <div class="row">
11 7
   <div class="col-sm-12">

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

@@ -1,11 +0,0 @@
1
-{% extends 'base.html' %}
2
-{% load i18n %}
3
-{% block title %}{% trans "Edit Endpoint Group" %}{% endblock %}
4
-
5
-{% block page_header %}
6
-  {% include "horizon/common/_page_header.html" with title=_("Edit Group ")|add:name %}
7
-{% endblock page_header %}
8
-
9
-{% block main %}
10
-  {% include 'project/policy_target_groups/_updatepolicy_target.html' %}
11
-{% endblock %}

+ 53
- 53
gbpui/panels/policytargets/views.py View File

@@ -24,6 +24,8 @@ from horizon.utils import memoized
24 24
 from horizon import workflows
25 25
 
26 26
 from gbpui import client
27
+from gbpui.common import forms as gbforms
28
+
27 29
 
28 30
 import forms as policy_target_forms
29 31
 import tabs as policy_target_tabs
@@ -103,13 +105,13 @@ class UpdatePTGView(forms.ModalFormView):
103 105
     form_class = policy_target_forms.UpdatePolicyTargetForm
104 106
     form_id = "update_policy_target_form"
105 107
     modal_header = _("Edit Group")
106
-    template_name = "project/policytargets/update_policy_target.html"
108
+    template_name = "gbpui/form_with_description.html"
107 109
     context_object_name = 'policy_target'
108 110
     submit_label = _("Save Changes")
109 111
     submit_url = "horizon:project:policytargets:updatepolicy_target"
110 112
     success_url = reverse_lazy("horizon:project:policytargets:index")
111 113
     page_title = _("Edit Group")
112
-    help_text = _("You may update policy details here.")
114
+    help_text = _("You may update group details here.")
113 115
 
114 116
     def get_context_data(self, **kwargs):
115 117
         context = super(UpdatePTGView, self).get_context_data(**kwargs)
@@ -143,7 +145,7 @@ class UpdateExternalPTGView(forms.ModalFormView):
143 145
     form_class = policy_target_forms.UpdateExternalPolicyTargetForm
144 146
     form_id = "update_policy_target_form"
145 147
     modal_header = _("Edit Group")
146
-    template_name = "project/policytargets/update_external_policy_target.html"
148
+    template_name = "gbpui/form_with_description.html"
147 149
     context_object_name = 'external_policy_target'
148 150
     submit_label = _("Save Changes")
149 151
     submit_url = "horizon:project:policytargets:update_ext_policy_target"
@@ -179,11 +181,11 @@ class UpdateExternalPTGView(forms.ModalFormView):
179 181
         return self.kwargs
180 182
 
181 183
 
182
-class ExtAddProvidedPRSView(forms.ModalFormView):
184
+class ExtAddProvidedPRSView(gbforms.ReversingModalFormView):
183 185
     form_class = policy_target_forms.ExtAddProvidedPRSForm
184 186
     form_id = "ext_add_provided_form"
185 187
     modal_header = _("Add Provided PRS")
186
-    template_name = "project/policytargets/ext_add_provided_prs.html"
188
+    template_name = "gbpui/form_with_description.html"
187 189
     submit_label = _("Save Changes")
188 190
     submit_url = "horizon:project:policytargets:ext_add_provided_prs"
189 191
     page_title = _("Add Provided PRS")
@@ -191,20 +193,20 @@ class ExtAddProvidedPRSView(forms.ModalFormView):
191 193
         "Add provided policy rule set. Press Ctrl to select multiple items."
192 194
     )
193 195
 
194
-    def get_context_data(self, **kwargs):
195
-        context = super(ExtAddProvidedPRSView, self).get_context_data(**kwargs)
196
-        context["ext_policy_target_id"] = self.kwargs['ext_policy_target_id']
197
-        return context
196
+    def get_submit_url_params(self, **kwargs):
197
+        return {
198
+            'ext_policy_target_id': self.kwargs['ext_policy_target_id']
199
+        }
198 200
 
199 201
     def get_initial(self):
200 202
         return self.kwargs
201 203
 
202 204
 
203
-class ExtRemoveProvidedPRSView(forms.ModalFormView):
205
+class ExtRemoveProvidedPRSView(gbforms.ReversingModalFormView):
204 206
     form_class = policy_target_forms.ExtRemoveProvidedPRSForm
205 207
     form_id = "ext_remove_provided_form"
206 208
     modal_header = _("Remove Provided PRS")
207
-    template_name = "project/policytargets/ext_remove_provided_prs.html"
209
+    template_name = "gbpui/form_with_description.html"
208 210
     submit_label = _("Save Changes")
209 211
     submit_url = "horizon:project:policytargets:ext_remove_provided_prs"
210 212
     page_title = _("Remove Provided PRS")
@@ -212,21 +214,20 @@ class ExtRemoveProvidedPRSView(forms.ModalFormView):
212 214
         "Remove provided policy rule set. Press Ctrl to select multiple items."
213 215
     )
214 216
 
215
-    def get_context_data(self, **kwargs):
216
-        context = super(ExtRemoveProvidedPRSView, self).get_context_data(
217
-            **kwargs)
218
-        context["ext_policy_target_id"] = self.kwargs['ext_policy_target_id']
219
-        return context
217
+    def get_submit_url_params(self, **kwargs):
218
+        return {
219
+            "ext_policy_target_id": self.kwargs['ext_policy_target_id']
220
+        }
220 221
 
221 222
     def get_initial(self):
222 223
         return self.kwargs
223 224
 
224 225
 
225
-class AddProvidedPRSView(forms.ModalFormView):
226
+class AddProvidedPRSView(gbforms.ReversingModalFormView):
226 227
     form_class = policy_target_forms.AddProvidedPRSForm
227 228
     form_id = "add_provided_form"
228 229
     modal_header = _("Add Provided PRS")
229
-    template_name = "project/policytargets/add_provided_prs.html"
230
+    template_name = "gbpui/form_with_description.html"
230 231
     submit_label = _("Save Changes")
231 232
     submit_url = "horizon:project:policytargets:add_provided_prs"
232 233
     page_title = _("Add Provided PRS")
@@ -234,20 +235,20 @@ class AddProvidedPRSView(forms.ModalFormView):
234 235
         "Add provided policy rule set. Press Ctrl to select multiple items."
235 236
     )
236 237
 
237
-    def get_context_data(self, **kwargs):
238
-        context = super(AddProvidedPRSView, self).get_context_data(**kwargs)
239
-        context["policy_target_id"] = self.kwargs['policy_target_id']
240
-        return context
238
+    def get_submit_url_params(self, **kwargs):
239
+        return {
240
+            "policy_target_id": self.kwargs['policy_target_id']
241
+        }
241 242
 
242 243
     def get_initial(self):
243 244
         return self.kwargs
244 245
 
245 246
 
246
-class RemoveProvidedPRSView(forms.ModalFormView):
247
+class RemoveProvidedPRSView(gbforms.ReversingModalFormView):
247 248
     form_class = policy_target_forms.RemoveProvidedPRSForm
248 249
     form_id = "remove_provided_form"
249 250
     modal_header = _("Remove Provided PRS")
250
-    template_name = "project/policytargets/remove_provided_prs.html"
251
+    template_name = "gbpui/form_with_description.html"
251 252
     submit_label = _("Save Changes")
252 253
     submit_url = "horizon:project:policytargets:remove_provided_prs"
253 254
     page_title = _("Remove Provided PRS")
@@ -255,20 +256,20 @@ class RemoveProvidedPRSView(forms.ModalFormView):
255 256
         "Remove provided policy rule set. Press Ctrl to select multiple items."
256 257
     )
257 258
 
258
-    def get_context_data(self, **kwargs):
259
-        context = super(RemoveProvidedPRSView, self).get_context_data(**kwargs)
260
-        context["policy_target_id"] = self.kwargs['policy_target_id']
261
-        return context
259
+    def get_submit_url_params(self, **kwargs):
260
+        return {
261
+            "policy_target_id": self.kwargs['policy_target_id']
262
+        }
262 263
 
263 264
     def get_initial(self):
264 265
         return self.kwargs
265 266
 
266 267
 
267
-class ExtAddConsumedPRSView(forms.ModalFormView):
268
+class ExtAddConsumedPRSView(gbforms.ReversingModalFormView):
268 269
     form_class = policy_target_forms.ExtAddConsumedPRSForm
269 270
     form_id = "ext_add_consumed_form"
270 271
     modal_header = _("Add Policy Rule Set")
271
-    template_name = "project/policytargets/ext_add_consumed_prs.html"
272
+    template_name = "gbpui/form_with_description.html"
272 273
     submit_label = _("Save Changes")
273 274
     submit_url = "horizon:project:policytargets:ext_add_consumed_prs"
274 275
     page_title = _("Add Policy Rule Set")
@@ -276,20 +277,20 @@ class ExtAddConsumedPRSView(forms.ModalFormView):
276 277
         "Add consumed policy rule set. Press Ctrl to select multiple items."
277 278
     )
278 279
 
279
-    def get_context_data(self, **kwargs):
280
-        context = super(ExtAddConsumedPRSView, self).get_context_data(**kwargs)
281
-        context["ext_policy_target_id"] = self.kwargs['ext_policy_target_id']
282
-        return context
280
+    def get_submit_url_params(self, **kwargs):
281
+        return {
282
+            "ext_policy_target_id": self.kwargs['ext_policy_target_id']
283
+        }
283 284
 
284 285
     def get_initial(self):
285 286
         return self.kwargs
286 287
 
287 288
 
288
-class ExtRemoveConsumedPRSView(forms.ModalFormView):
289
+class ExtRemoveConsumedPRSView(gbforms.ReversingModalFormView):
289 290
     form_class = policy_target_forms.ExtRemoveConsumedPRSForm
290 291
     form_id = "remove_contract_form"
291 292
     modal_header = _("Remove Policy Rule Set")
292
-    template_name = "project/policytargets/ext_remove_consumed_prs.html"
293
+    template_name = "gbpui/form_with_description.html"
293 294
     submit_label = _("Save Changes")
294 295
     submit_url = "horizon:project:policytargets:ext_remove_consumed_prs"
295 296
     page_title = _("Remove Policy Rule Set")
@@ -297,21 +298,20 @@ class ExtRemoveConsumedPRSView(forms.ModalFormView):
297 298
         "Remove consumed policy rule set. Press Ctrl to select multiple items."
298 299
     )
299 300
 
300
-    def get_context_data(self, **kwargs):
301
-        context = super(ExtRemoveConsumedPRSView, self).get_context_data(
302
-            **kwargs)
303
-        context["ext_policy_target_id"] = self.kwargs['ext_policy_target_id']
304
-        return context
301
+    def get_submit_url_params(self, **kwargs):
302
+        return {
303
+            "ext_policy_target_id": self.kwargs['ext_policy_target_id']
304
+        }
305 305
 
306 306
     def get_initial(self):
307 307
         return self.kwargs
308 308
 
309 309
 
310
-class AddConsumedPRSView(forms.ModalFormView):
310
+class AddConsumedPRSView(gbforms.ReversingModalFormView):
311 311
     form_class = policy_target_forms.AddConsumedPRSForm
312 312
     form_id = "add_consumed_form"
313 313
     modal_header = _("Add ")
314
-    template_name = "project/policytargets/add_consumed_prs.html"
314
+    template_name = "gbpui/form_with_description.html"
315 315
     submit_label = _("Save Changes")
316 316
     submit_url = "horizon:project:policytargets:add_consumed_prs"
317 317
     page_title = _("Add ")
@@ -319,20 +319,20 @@ class AddConsumedPRSView(forms.ModalFormView):
319 319
         "Add consumed policy rule set. Press Ctrl to select multiple items."
320 320
     )
321 321
 
322
-    def get_context_data(self, **kwargs):
323
-        context = super(AddConsumedPRSView, self).get_context_data(**kwargs)
324
-        context["policy_target_id"] = self.kwargs['policy_target_id']
325
-        return context
322
+    def get_submit_url_params(self, **kwargs):
323
+        return {
324
+            "policy_target_id": self.kwargs['policy_target_id']
325
+        }
326 326
 
327 327
     def get_initial(self):
328 328
         return self.kwargs
329 329
 
330 330
 
331
-class RemoveConsumedPRSView(forms.ModalFormView):
331
+class RemoveConsumedPRSView(gbforms.ReversingModalFormView):
332 332
     form_class = policy_target_forms.RemoveConsumedPRSForm
333 333
     form_id = "remove_contract_form"
334 334
     modal_header = _("Remove Policy Rule Set")
335
-    template_name = "project/policytargets/remove_consumed_prs.html"
335
+    template_name = "gbpui/form_with_description.html"
336 336
     submit_label = _("Save Changes")
337 337
     submit_url = "horizon:project:policytargets:remove_consumed_prs"
338 338
     page_title = _("Remove Policy Rule Set")
@@ -340,10 +340,10 @@ class RemoveConsumedPRSView(forms.ModalFormView):
340 340
         "Remove consumed policy rule set. Press Ctrl to select multiple items."
341 341
     )
342 342
 
343
-    def get_context_data(self, **kwargs):
344
-        context = super(RemoveConsumedPRSView, self).get_context_data(**kwargs)
345
-        context["policy_target_id"] = self.kwargs['policy_target_id']
346
-        return context
343
+    def get_submit_url_params(self, **kwargs):
344
+        return {
345
+            "policy_target_id": self.kwargs['policy_target_id']
346
+        }
347 347
 
348 348
     def get_initial(self):
349 349
         return self.kwargs

+ 7
- 0
gbpui/templates/gbpui/_form_with_description.html View File

@@ -0,0 +1,7 @@
1
+{% extends "horizon/common/_modal_form.html" %}
2
+{% load i18n %}
3
+
4
+{% block modal-body-right %}
5
+    <h3>{% trans "Description:" %}</h3>
6
+    <p>{{ help_text }}</p>
7
+{% endblock %}

+ 7
- 0
gbpui/templates/gbpui/form_with_description.html View File

@@ -0,0 +1,7 @@
1
+{% extends 'base.html' %}
2
+{% load i18n %}
3
+{% block title %}{% if base_form_title %}{{ base_form_title }}{% else %}{{ page_title }}{% endif %}{% endblock %}
4
+
5
+{% block main %}
6
+  {% include 'gbpui/_form_with_description.html' %}
7
+{% endblock %}

Loading…
Cancel
Save