From 1c65757f600bc2b17d0bfb31bb85844cfd5f3785 Mon Sep 17 00:00:00 2001 From: Rob Cresswell Date: Fri, 20 Feb 2015 17:06:13 +0000 Subject: [PATCH] Refactor modal forms for Volumes Refactor of Volumes modals Based on merged patch: https://review.openstack.org/#/c/123472/ Change-Id: Ie448522ed881a541b0a65fd1a6af901393947ba8 Partially-Implements: blueprint form-template-to-view --- .../admin/volumes/snapshots/views.py | 6 ++ .../volumes/snapshots/_update_status.html | 21 +------ .../volume_types/_associate_qos_spec.html | 35 ++---------- .../volume_types/_create_qos_spec.html | 24 +------- .../volume_types/_create_volume_type.html | 21 +------ .../_create_volume_type_encryption.html | 21 +------ .../volume_types/_edit_qos_spec_consumer.html | 21 +------ .../volumes/volume_types/extras/_create.html | 27 +-------- .../volumes/volume_types/extras/_edit.html | 27 +-------- .../volume_types/qos_specs/_create.html | 27 +-------- .../volumes/volume_types/qos_specs/_edit.html | 26 +-------- .../volumes/volumes/_update_status.html | 21 +------ .../volumes/volume_types/extras/views.py | 23 ++++++++ .../volumes/volume_types/qos_specs/views.py | 23 ++++++++ .../admin/volumes/volume_types/views.py | 29 ++++++++++ .../dashboards/admin/volumes/volumes/views.py | 6 ++ .../project/volumes/backups/views.py | 10 ++++ .../project/volumes/snapshots/views.py | 6 ++ .../volumes/backups/_create_backup.html | 25 +-------- .../volumes/backups/_restore_backup.html | 25 +-------- .../templates/volumes/snapshots/_update.html | 25 +-------- .../templates/volumes/volumes/_attach.html | 11 +--- .../templates/volumes/volumes/_create.html | 22 +------- .../volumes/volumes/_create_snapshot.html | 15 +---- .../templates/volumes/volumes/_extend.html | 22 +------- .../templates/volumes/volumes/_retype.html | 55 ++++++------------- .../volumes/volumes/_show_transfer.html | 4 -- .../templates/volumes/volumes/_update.html | 29 ++-------- .../volumes/volumes/_upload_to_image.html | 51 ++++++----------- .../project/volumes/volumes/views.py | 37 ++++++++++++- 30 files changed, 217 insertions(+), 478 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/volumes/snapshots/views.py b/openstack_dashboard/dashboards/admin/volumes/snapshots/views.py index 057f7577ec..65ed50b067 100644 --- a/openstack_dashboard/dashboards/admin/volumes/snapshots/views.py +++ b/openstack_dashboard/dashboards/admin/volumes/snapshots/views.py @@ -30,7 +30,11 @@ from openstack_dashboard.dashboards.project.volumes.snapshots \ class UpdateStatusView(forms.ModalFormView): form_class = vol_snapshot_forms.UpdateStatus + modal_header = _("Update Volume Snapshot Status") + modal_id = "update_volume_snapshot_status" template_name = 'admin/volumes/snapshots/update_status.html' + submit_label = _("Update Status") + submit_url = "horizon:admin:volumes:snapshots:update_status" success_url = reverse_lazy("horizon:admin:volumes:snapshots_tab") page_title = _("Update Volume Snapshot Status") @@ -49,6 +53,8 @@ class UpdateStatusView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(UpdateStatusView, self).get_context_data(**kwargs) context['snapshot_id'] = self.kwargs["snapshot_id"] + args = (self.kwargs['snapshot_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self): diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_update_status.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_update_status.html index c1554fcc10..d9bc7c684b 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_update_status.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/snapshots/_update_status.html @@ -1,30 +1,11 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:snapshots:update_status' snapshot_id %}{% endblock %} - -{% block modal_id %}update_volume_snapshot_status_modal{% endblock %} -{% block modal-header %}{% trans "Update Volume Snapshot Status" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
+{% block modal-body-right %}

{% trans "Description:" %}

{% blocktrans %} The status of a volume snapshot is normally managed automatically. In some circumstances an administrator may need to explicitly update the status value. This is equivalent to the cinder snapshot-reset-state command. {% endblocktrans %}

-
{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} -{% endblock %} \ No newline at end of file diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_associate_qos_spec.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_associate_qos_spec.html index b31c62046e..570b3afa6d 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_associate_qos_spec.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_associate_qos_spec.html @@ -1,36 +1,9 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:manage_qos_spec_association' type_id %}{% endblock %} - -{% block modal_id %}associate_qos_spec_modal{% endblock %} -{% block modal-header %}{% trans "Associate QoS Spec with Volume Type"%}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
+{% block modal-body-right %}

{% trans "Description:" %}

-

{% blocktrans %} - Add, modify or remove the QoS Spec associated with this volume type. -
-
- "None" indicates that no QoS Spec is currently associated. Conversely, setting - the QoS Spec to "None" will remove the current association. -
-
- This is equivalent to the cinder qos-associate and cinder qos-disassociate - commands. - {% endblocktrans %}

-
+

{% trans "Add, modify or remove the QoS Spec associated with this volume type." %}

+

{% blocktrans %}"None" indicates that no QoS Spec is currently associated. Conversely, setting the QoS Spec to "None" will remove the current association.{% endblocktrans %}

+

{% blocktrans %}This is equivalent to the cinder qos-associate and cinder qos-disassociate commands.{% endblocktrans %}

{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} -{% endblock %} \ No newline at end of file diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_qos_spec.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_qos_spec.html index c3e8f363e3..1fb95b566c 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_qos_spec.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_qos_spec.html @@ -1,20 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:create_qos_spec' %}{% endblock %} - -{% block modal_id %}create_volume_type_modal{% endblock %} -{% block modal-header %}{% trans "Create QoS Spec" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
+{% block modal-body-right %}

{% trans "Description:" %}

{% blocktrans %} QoS Specs can be associated with volume types. @@ -27,12 +14,5 @@ Each QoS Specs entity will have a "Consumer" value which indicates where the administrator would like the QoS policy to be enforced. This value can be "front-end" (Nova Compute), "back-end" (Cinder back-end), or "both". - {% endblocktrans %} -

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} + {% endblocktrans %}

{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_volume_type.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_volume_type.html index 37e97ec911..51dadc18d8 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_volume_type.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_volume_type.html @@ -1,20 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:create_type' %}{% endblock %} - -{% block modal_id %}create_volume_type_modal{% endblock %} -{% block modal-header %}{% trans "Create Volume Type" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
+{% block modal-body-right %}

{% trans "Description:" %}

{% blocktrans %} Volume type is a type or label that can be selected at volume creation @@ -26,10 +13,4 @@ pair(s) for that volume type. {% endblocktrans %}

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_volume_type_encryption.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_volume_type_encryption.html index f514953a2e..fe384c67e3 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_volume_type_encryption.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_create_volume_type_encryption.html @@ -1,20 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}create_volume_form{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:create_type_encryption' volume_type_id %}{% endblock %} - -{% block modal_id %}create_volume_type_modal{% endblock %} -{% block modal-header %}{% trans "Create Volume Type Encryption" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
+{% block modal-body-right %}

{% trans "Description:" %}

{% trans "Creating encryption for a volume type causes all volumes with that volume type to be encrypted. Encryption information cannot be added to a volume type if volumes are currently in use with that volume type." %} @@ -31,10 +18,4 @@

{% blocktrans %}The Key Size is the size of the encryption key, in bits (e.g., 128, 256). If the field is left empty, the provider default will be used.{% endblocktrans %}

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_edit_qos_spec_consumer.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_edit_qos_spec_consumer.html index 2da07c8478..8d4dda9def 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_edit_qos_spec_consumer.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/_edit_qos_spec_consumer.html @@ -1,30 +1,11 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:edit_qos_spec_consumer' qos_spec_id %}{% endblock %} - -{% block modal_id %}associate_qos_spec_modal{% endblock %} -{% block modal-header %}{% trans "Edit Consumer of QoS Spec" %} {% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
+{% block modal-body-right %}

{% trans "Description:" %}

{% blocktrans %} Each QoS Specs entity will have a "Consumer" value which indicates where the administrator would like the QoS policy to be enforced. This value can be "front-end" (Nova Compute), "back-end" (Cinder back-end), or "both". {% endblocktrans %}

-
{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} -{% endblock %} \ No newline at end of file diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/extras/_create.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/extras/_create.html index 007574e500..e876fa07d8 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/extras/_create.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/extras/_create.html @@ -1,28 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}extra_spec_create_form{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:extras:create' vol_type.id %}{% endblock %} - - -{% block modal_id %}extra_spec_create_modal{% endblock %} -{% block modal-header %}{% trans "Create Volume Type Extra Spec" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

{% trans 'Create a new "extra spec" key-value pair for a volume type.' %}

-
+{% block modal-body-right %} +

{% trans "Description:" %}

+

{% trans 'Create a new "extra spec" key-value pair for a volume type.' %}

{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} -{% endblock %} - diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/extras/_edit.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/extras/_edit.html index 40ee98921d..ac27d86cb0 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/extras/_edit.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/extras/_edit.html @@ -1,28 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}extra_spec_edit_form{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:extras:edit' vol_type.id key %}{% endblock %} - - -{% block modal_id %}extra_spec_edit_modal{% endblock %} -{% block modal-header %}{% blocktrans %}Edit Extra Spec Value: {{ key }}{% endblocktrans %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

{% blocktrans with key=key %}Update the "extra spec" value for "{{ key }}"{% endblocktrans %}

-
+{% block modal-body-right %} +

{% trans "Description:" %}

+

{% blocktrans with key=key %}Update the "extra spec" value for "{{ key }}"{% endblocktrans %}

{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} -{% endblock %} - diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/_create.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/_create.html index 47ae74718a..d372d115ab 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/_create.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/_create.html @@ -1,28 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}extra_spec_create_form{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:qos_specs:create' qos_spec_id %}{% endblock %} - - -{% block modal_id %}qos_spec_create_modal{% endblock %} -{% block modal-header %}{% trans "Create Spec" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

{% blocktrans with key=qos_spec_name %}Create a new "spec" key-value pair for QoS Spec "{{ qos_spec_name }}"{% endblocktrans %}

-
+{% block modal-body-right %} +

{% trans "Description:" %}

+

{% blocktrans with key=qos_spec_name %}Create a new "spec" key-value pair for QoS Spec "{{ qos_spec_name }}"{% endblocktrans %}

{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} -{% endblock %} - diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/_edit.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/_edit.html index 55bfeb831a..52f21f7599 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/_edit.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/_edit.html @@ -1,27 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}qos_spec_edit_form{% endblock %} -{% block form_action %}{% url 'horizon:admin:volumes:volume_types:qos_specs:edit' qos_spec_id key %}{% endblock %} - - -{% block modal_id %}qos_spec_edit_modal{% endblock %} -{% block modal-header %}{% trans "Edit Spec Value: " %} {{ key }}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

{% blocktrans with key=key %}Update the spec value for "{{ key }}"{% endblocktrans %}

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} +{% block modal-body-right %} +

{% trans "Description:" %}

+

{% blocktrans with key=key %}Update the spec value for "{{ key }}"{% endblocktrans %}

{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volumes/_update_status.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volumes/_update_status.html index c83bd5fa0f..717b0a0be2 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volumes/_update_status.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volumes/_update_status.html @@ -1,30 +1,11 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %} {% url 'horizon:admin:volumes:volumes:update_status' volume_id %}{% endblock %} - -{% block modal_id %}update_volume_status_modal{% endblock %} -{% block modal-header %}{% trans "Update Volume Status" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
+{% block modal-body-right %}

{% trans "Description:" %}

{% blocktrans %} The status of a volume is normally managed automatically. In some circumstances an administrator may need to explicitly update the status value. This is equivalent to the cinder reset-state command. {% endblocktrans %}

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/volumes/volume_types/extras/views.py b/openstack_dashboard/dashboards/admin/volumes/volume_types/extras/views.py index 37deac1d18..261c3b499d 100644 --- a/openstack_dashboard/dashboards/admin/volumes/volume_types/extras/views.py +++ b/openstack_dashboard/dashboards/admin/volumes/volume_types/extras/views.py @@ -58,6 +58,11 @@ class IndexView(ExtraSpecMixin, forms.ModalFormMixin, tables.DataTableView): class CreateView(ExtraSpecMixin, forms.ModalFormView): form_class = project_forms.CreateExtraSpec + form_id = "extra_spec_create_form" + modal_header = _("Create Volume Type Extra Spec") + modal_id = "extra_spec_create_modal" + submit_label = _("Create") + submit_url = "horizon:admin:volumes:volume_types:extras:create" template_name = 'admin/volumes/volume_types/extras/create.html' success_url = 'horizon:admin:volumes:volume_types:extras:index' @@ -68,9 +73,20 @@ class CreateView(ExtraSpecMixin, forms.ModalFormView): return reverse(self.success_url, args=(self.kwargs['type_id'],)) + def get_context_data(self, **kwargs): + context = super(CreateView, self).get_context_data(**kwargs) + args = (self.kwargs['type_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) + return context + class EditView(ExtraSpecMixin, forms.ModalFormView): form_class = project_forms.EditExtraSpec + form_id = "extra_spec_edit_form" + modal_header = _('Edit Extra Spec Value: %s') + modal_id = "extra_spec_edit_modal" + submit_label = _("Save") + submit_url = "horizon:admin:volumes:volume_types:extras:edit" template_name = 'admin/volumes/volume_types/extras/edit.html' success_url = 'horizon:admin:volumes:volume_types:extras:index' @@ -93,3 +109,10 @@ class EditView(ExtraSpecMixin, forms.ModalFormView): return {'type_id': type_id, 'key': key, 'value': extra_specs.get(key, '')} + + def get_context_data(self, **kwargs): + context = super(EditView, self).get_context_data(**kwargs) + args = (self.kwargs['type_id'], self.kwargs['key'],) + context['submit_url'] = reverse(self.submit_url, args=args) + context['modal_header'] = self.modal_header % self.kwargs['key'] + return context diff --git a/openstack_dashboard/dashboards/admin/volumes/volume_types/qos_specs/views.py b/openstack_dashboard/dashboards/admin/volumes/volume_types/qos_specs/views.py index e93e6e1276..b028b50e9e 100644 --- a/openstack_dashboard/dashboards/admin/volumes/volume_types/qos_specs/views.py +++ b/openstack_dashboard/dashboards/admin/volumes/volume_types/qos_specs/views.py @@ -68,7 +68,12 @@ class IndexView(QosSpecMixin, forms.ModalFormMixin, tables.DataTableView): class CreateKeyValuePairView(QosSpecMixin, forms.ModalFormView): # this for creating a spec key-value pair for an existing QOS Spec form_class = project_forms.CreateKeyValuePair + form_id = "extra_spec_create_form" + modal_header = _("Create Spec") + modal_id = "qos_spec_create_modal" template_name = 'admin/volumes/volume_types/qos_specs/create.html' + submit_label = _("Create") + submit_url = "horizon:admin:volumes:volume_types:qos_specs:create" success_url = 'horizon:admin:volumes:volume_types:qos_specs:index' def get_initial(self): @@ -79,10 +84,22 @@ class CreateKeyValuePairView(QosSpecMixin, forms.ModalFormView): return reverse(self.success_url, args=(self.kwargs['qos_spec_id'],)) + def get_context_data(self, **kwargs): + context = super(CreateKeyValuePairView, self).\ + get_context_data(**kwargs) + args = (self.kwargs['qos_spec_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) + return context + class EditKeyValuePairView(QosSpecMixin, forms.ModalFormView): form_class = project_forms.EditKeyValuePair + form_id = "qos_spec_edit_form" + modal_header = _("Edit Spec Value") + modal_id = "qos_spec_edit_modal" template_name = 'admin/volumes/volume_types/qos_specs/edit.html' + submit_label = _("Save") + submit_url = "horizon:admin:volumes:volume_types:qos_specs_edit" success_url = 'horizon:admin:volumes:volume_types:qos_specs:index' def get_success_url(self): @@ -102,3 +119,9 @@ class EditKeyValuePairView(QosSpecMixin, forms.ModalFormView): return {'qos_spec_id': qos_spec_id, 'key': key, 'value': qos_specs.specs.get(key, '')} + + def get_context_data(self, **kwargs): + context = super(EditKeyValuePairView, self).get_context_data(**kwargs) + args = (self.kwargs['qos_spec_id'], self.kwargs['key'],) + context['submit_url'] = reverse(self.submit_url, args=args) + return context diff --git a/openstack_dashboard/dashboards/admin/volumes/volume_types/views.py b/openstack_dashboard/dashboards/admin/volumes/volume_types/views.py index b929e62656..b760b3bad3 100644 --- a/openstack_dashboard/dashboards/admin/volumes/volume_types/views.py +++ b/openstack_dashboard/dashboards/admin/volumes/volume_types/views.py @@ -32,7 +32,11 @@ from openstack_dashboard.dashboards.admin.volumes.volumes \ class CreateVolumeTypeView(forms.ModalFormView): form_class = volumes_forms.CreateVolumeType + modal_header = _("Create Volume Type") + modal_id = "create_volume_type_modal" template_name = 'admin/volumes/volume_types/create_volume_type.html' + submit_label = _("Create Volume Type") + submit_url = reverse_lazy("horizon:admin:volumes:volume_types:create_type") success_url = 'horizon:admin:volumes:volume_types_tab' page_title = _("Create a Volume Type") @@ -75,8 +79,13 @@ class VolumeTypeEncryptionDetailView(generic.TemplateView): class CreateVolumeTypeEncryptionView(forms.ModalFormView): form_class = volume_types_forms.CreateVolumeTypeEncryption + form_id = "create_volume_form" + modal_header = _("Create Volume Type Encryption") + modal_id = "create_volume_type_modal" template_name = ("admin/volumes/volume_types/" "create_volume_type_encryption.html") + submit_label = _("Create Volume Type Encryption") + submit_url = "horizon:admin:volumes:volume_types:create_type_encryption" success_url = reverse_lazy('horizon:admin:volumes:index') page_title = _("Create an Encrypted Volume Type") @@ -97,6 +106,8 @@ class CreateVolumeTypeEncryptionView(forms.ModalFormView): context = super(CreateVolumeTypeEncryptionView, self).\ get_context_data(**kwargs) context['volume_type_id'] = self.kwargs['volume_type_id'] + args = (self.kwargs['volume_type_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self): @@ -107,9 +118,14 @@ class CreateVolumeTypeEncryptionView(forms.ModalFormView): class CreateQosSpecView(forms.ModalFormView): form_class = volumes_forms.CreateQosSpec + modal_header = _("Create QoS Spec") + modal_id = "create_volume_type_modal" template_name = 'admin/volumes/volume_types/create_qos_spec.html' success_url = 'horizon:admin:volumes:volume_types_tab' page_title = _("Create a QoS Spec") + submit_label = _("Create") + submit_url = reverse_lazy( + "horizon:admin:volumes:volume_types:create_qos_spec") def get_success_url(self): return reverse(self.success_url) @@ -117,7 +133,11 @@ class CreateQosSpecView(forms.ModalFormView): class EditQosSpecConsumerView(forms.ModalFormView): form_class = volume_types_forms.EditQosSpecConsumer + modal_header = _("Edit Consumer of QoS Spec") + modal_id = "edit_qos_spec_modal" template_name = 'admin/volumes/volume_types/edit_qos_spec_consumer.html' + submit_label = _("Modify Consumer") + submit_url = "horizon:admin:volumes:volume_types:edit_qos_spec_consumer" success_url = 'horizon:admin:volumes:volume_types_tab' page_title = _("Edit QoS Spec Consumer") @@ -128,6 +148,8 @@ class EditQosSpecConsumerView(forms.ModalFormView): context = super(EditQosSpecConsumerView, self).\ get_context_data(**kwargs) context['qos_spec_id'] = self.kwargs["qos_spec_id"] + args = (self.kwargs['qos_spec_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context @memoized.memoized_method @@ -150,7 +172,12 @@ class EditQosSpecConsumerView(forms.ModalFormView): class ManageQosSpecAssociationView(forms.ModalFormView): form_class = volume_types_forms.ManageQosSpecAssociation + modal_header = _("Associate QoS Spec with Volume Type") + modal_id = "associate_qos_spec_modal" template_name = 'admin/volumes/volume_types/associate_qos_spec.html' + submit_label = _("Associate") + submit_url = "horizon:admin:volumes:volume_types:"\ + "manage_qos_spec_association" success_url = 'horizon:admin:volumes:volume_types_tab' page_title = _("Associate QoS Spec with Volume Type") @@ -161,6 +188,8 @@ class ManageQosSpecAssociationView(forms.ModalFormView): context = super(ManageQosSpecAssociationView, self).\ get_context_data(**kwargs) context['type_id'] = self.kwargs["type_id"] + args = (self.kwargs['type_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context @memoized.memoized_method diff --git a/openstack_dashboard/dashboards/admin/volumes/volumes/views.py b/openstack_dashboard/dashboards/admin/volumes/volumes/views.py index 73df6c7e31..7bfbc530d8 100644 --- a/openstack_dashboard/dashboards/admin/volumes/volumes/views.py +++ b/openstack_dashboard/dashboards/admin/volumes/volumes/views.py @@ -92,13 +92,19 @@ class CreateVolumeTypeView(forms.ModalFormView): class UpdateStatusView(forms.ModalFormView): form_class = volumes_forms.UpdateStatus + modal_header = _("Update Volume Status") + modal_id = "update_volume_status_modal" template_name = 'admin/volumes/volumes/update_status.html' + submit_label = _("Update Status") + submit_url = "horizon:admin:volumes:volumes:update_status" success_url = reverse_lazy('horizon:admin:volumes:index') page_title = _("Update Volume Status") def get_context_data(self, **kwargs): context = super(UpdateStatusView, self).get_context_data(**kwargs) context["volume_id"] = self.kwargs['volume_id'] + args = (self.kwargs['volume_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context @memoized.memoized_method diff --git a/openstack_dashboard/dashboards/project/volumes/backups/views.py b/openstack_dashboard/dashboards/project/volumes/backups/views.py index c33d39905e..d9eed58fb7 100644 --- a/openstack_dashboard/dashboards/project/volumes/backups/views.py +++ b/openstack_dashboard/dashboards/project/volumes/backups/views.py @@ -30,12 +30,17 @@ from openstack_dashboard.dashboards.project.volumes.backups \ class CreateBackupView(forms.ModalFormView): form_class = backup_forms.CreateBackupForm + modal_header = _("Create Volume Backup") template_name = 'project/volumes/backups/create_backup.html' + submit_label = _("Create Volume Backup") + submit_url = "horizon:project:volumes:volumes:create_backup" success_url = reverse_lazy("horizon:project:volumes:backups_tab") def get_context_data(self, **kwargs): context = super(CreateBackupView, self).get_context_data(**kwargs) context['volume_id'] = self.kwargs['volume_id'] + args = (self.kwargs['volume_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self): @@ -79,12 +84,17 @@ class BackupDetailView(tabs.TabView): class RestoreBackupView(forms.ModalFormView): form_class = backup_forms.RestoreBackupForm + modal_header = _("Restore Volume Backup") template_name = 'project/volumes/backups/restore_backup.html' + submit_label = _("Restore Backup to Volume") + submit_url = "horizon:project:volumes:volumes:create_backup" success_url = reverse_lazy('horizon:project:volumes:index') def get_context_data(self, **kwargs): context = super(RestoreBackupView, self).get_context_data(**kwargs) context['backup_id'] = self.kwargs['backup_id'] + args = (self.kwargs['backup_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self): diff --git a/openstack_dashboard/dashboards/project/volumes/snapshots/views.py b/openstack_dashboard/dashboards/project/volumes/snapshots/views.py index db7a5f2d73..c03c9088d5 100644 --- a/openstack_dashboard/dashboards/project/volumes/snapshots/views.py +++ b/openstack_dashboard/dashboards/project/volumes/snapshots/views.py @@ -31,7 +31,11 @@ from openstack_dashboard.dashboards.project.volumes \ class UpdateView(forms.ModalFormView): form_class = vol_snapshot_forms.UpdateForm + form_id = "update_snapshot_form" + modal_header = _("Edit Snapshot") template_name = 'project/volumes/snapshots/update.html' + submit_label = _("Save Changes") + submit_url = "horizon:project:volumes:snapshots:update" success_url = reverse_lazy("horizon:project:volumes:index") @memoized.memoized_method @@ -49,6 +53,8 @@ class UpdateView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) context['snapshot'] = self.get_object() + args = (self.kwargs['snapshot_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self): diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/backups/_create_backup.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/backups/_create_backup.html index 2b865dde90..364ba3e62f 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/backups/_create_backup.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/backups/_create_backup.html @@ -1,26 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:volumes:create_backup' volume_id %}{% endblock %} - -{% block modal_id %}create_volume_backup_modal{% endblock %} -{% block modal-header %}{% trans "Create Volume Backup" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Volume Backup:" %} {% trans "Volume Backups are stored using the Object Storage service. You must have this service activated in order to create a backup." %}

-

{% trans "If no container name is provided, a default container named volumebackups will be provisioned for you. Backups will be the same size as the volume they originate from." %}

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} +{% block modal-body-right %} +

{% trans "Volume Backup:" %} {% trans "Volume Backups are stored using the Object Storage service. You must have this service activated in order to create a backup." %}

+

{% trans "If no container name is provided, a default container named volumebackups will be provisioned for you. Backups will be the same size as the volume they originate from." %}

{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/backups/_restore_backup.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/backups/_restore_backup.html index 5704d24329..21c3498e06 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/backups/_restore_backup.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/backups/_restore_backup.html @@ -1,26 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:backups:restore' backup_id %}{% endblock %} - -{% block modal_id %}restore_volume_backup_modal{% endblock %} -{% block modal-header %}{% trans "Restore Volume Backup" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Restore Backup:" %} {% trans "Select a volume to restore to." %}

-

{% trans "Optionally, you may choose to create a new volume." %}

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} +{% block modal-body-right %} +

{% trans "Restore Backup:" %} {% trans "Select a volume to restore to." %}

+

{% trans "Optionally, you may choose to create a new volume." %}

{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_update.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_update.html index b8af2bdc33..8e45646980 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_update.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/snapshots/_update.html @@ -1,26 +1,7 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}update_snapshot_form{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:snapshots:update' snapshot.id %}{% endblock %} - -{% block modal_id %}update_snapshot_modal{% endblock %} -{% block modal-header %}{% trans "Edit Snapshot" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

{% trans "Modify the name and description of a snapshot." %}

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} +{% block modal-body-right %} +

{% trans "Description:" %}

+

{% trans "Modify the name and description of a snapshot." %}

{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_attach.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_attach.html index d2638f4a95..972ac3cb77 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_attach.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_attach.html @@ -2,20 +2,15 @@ {% load i18n %} {% load url from future %} -{% block form_id %}attach_volume_form{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:volumes:attach' volume.id %}{% endblock %} {% block form_class %}{{ block.super }} horizontal {% if show_attach %}split_half{% else %} no_split{% endif %}{% endblock %} -{% block modal_id %}attach_volume_modal{% endblock %} -{% block modal-header %}{% trans "Manage Volume Attachments" %}{% endblock %} - {% block modal-body %} - {% if show_attach %} + {% if show_attach %}

{% trans "Attach To Instance" %}

- {% include "horizon/common/_form_fields.html" %} + {% include "horizon/common/_form_fields.html" %}
- {% endif %} + {% endif %} {% endblock %} {% block modal-footer %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_create.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_create.html index 6c34e82400..3d08c83b5f 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_create.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_create.html @@ -1,26 +1,8 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:volumes:create' %}?{{ request.GET.urlencode }}{% endblock %} - -{% block modal_id %}create_volume_modal{% endblock %} -{% block modal-header %}{% trans "Create Volume" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
- -
+{% block modal-body-right %} +
{% include "project/volumes/volumes/_limits.html" with usages=usages %}
{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_create_snapshot.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_create_snapshot.html index fe5c8b07e9..3852909868 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_create_snapshot.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_create_snapshot.html @@ -2,19 +2,8 @@ {% load i18n %} {% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:volumes:create_snapshot' volume_id %}{% endblock %} - -{% block modal_id %}create_volume_snapshot_modal{% endblock %} -{% block modal-header %}{% trans "Create Volume Snapshot" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
+{% block modal-body-right %} +
{% include "project/volumes/volumes/_snapshot_limits.html" with usages=usages snapshot_quota=True %}
{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend.html index 20fd6e4986..6a1eeb599f 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_extend.html @@ -1,26 +1,8 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:volumes:extend' volume.id %}{% endblock %} - -{% block modal_id %}extend_volume_modal{% endblock %} -{% block modal-header %}{% trans "Extend Volume" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
- -
+{% block modal-body-right %} +
{% include "project/volumes/volumes/_extend_limits.html" with usages=usages %}
{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_retype.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_retype.html index 334c702d78..8a92ad4b3f 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_retype.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_retype.html @@ -1,41 +1,22 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:volumes:retype' volume.id %}{% endblock %} - -{% block modal_id %}retype_volume_modal{% endblock %} -{% block modal-header %}{% trans "Change Volume Type" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

{% blocktrans %} - Change the volume type of a volume after its creation. - This is equivalent to the cinder retype command. - {% endblocktrans %} -

-

{% blocktrans %} - The "Volume Type" selected must be different from the current volume type. - {% endblocktrans %} -

-

{% blocktrans %} - The "Migration Policy" is only used if the volume retype cannot be - completed. If the "Migration Policy" is "On Demand", the back end will - perform volume migration. Note that migration may take a significant - amount of time to complete, in some cases hours. - {% endblocktrans %} -

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} +{% block modal-body-right %} +

{% trans "Description:" %}

+

{% blocktrans %} + Change the volume type of a volume after its creation. + This is equivalent to the cinder retype command. + {% endblocktrans %} +

+

{% blocktrans %} + The "Volume Type" selected must be different from the current volume type. + {% endblocktrans %} +

+

{% blocktrans %} + The "Migration Policy" is only used if the volume retype cannot be + completed. If the "Migration Policy" is "On Demand", the back end will + perform volume migration. Note that migration may take a significant + amount of time to complete, in some cases hours. + {% endblocktrans %} +

{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_show_transfer.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_show_transfer.html index 55f46a6f44..c776c560ec 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_show_transfer.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_show_transfer.html @@ -6,7 +6,3 @@

{% trans "The Transfer ID and the Authorization Key are needed by the recipient in order to accept the transfer. Please capture both the Transfer ID and the Authorization Key and provide them to your transfer recipient." %}

{% trans "The Authorization Key will not be available after closing this page, so you must capture it now, or else you will be unable to use the transfer." %}

{% endblock %} - -{% block modal-footer %} - {% trans "Close" %} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_update.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_update.html index 42230444c1..2c5bc87f8d 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_update.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_update.html @@ -1,29 +1,8 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:volumes:update' volume.id %}{% endblock %} - -{% block modal_id %}update_volume_modal{% endblock %} -{% block modal-header %}{% trans "Edit Volume" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

-

{% trans "Modify name and description of a volume." %} -

-

{% trans 'The "Bootable" flag specifies that this volume can be used to launch an instance.' %} -

-
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} +{% block modal-body-right %} +

{% trans "Description:" %}

+

{% trans "Modify name and description of a volume." %}

+

{% trans 'The "Bootable" flag specifies that this volume can be used to launch an instance.' %}

{% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_upload_to_image.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_upload_to_image.html index ba56327b64..4480b117d0 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_upload_to_image.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_upload_to_image.html @@ -1,42 +1,23 @@ {% extends "horizon/common/_modal_form.html" %} {% load i18n %} -{% load url from future %} -{% block form_id %}{% endblock %} -{% block form_action %}{% url 'horizon:project:volumes:volumes:upload_to_image' volume.id %}{% endblock %} - -{% block modal_id %}update_volume_modal{% endblock %} -{% block modal-header %}{% trans "Upload Volume to Image" %}{% endblock %} - -{% block modal-body %} -
-
- {% include "horizon/common/_form_fields.html" %} -
-
-
-

{% trans "Description:" %}

+{% block modal-body-right %} +

{% trans "Description:" %}

+

{% blocktrans %} + Upload the volume to the Image Service as an image. + This is equivalent to the cinder upload-to-image command. + {% endblocktrans %} +

+

{% blocktrans %} + Choose "Disk Format" for the image. The volume images are created with + the QEMU disk image utility. + {% endblocktrans %} +

+ {% if volume.status == 'in-use' %}

{% blocktrans %} - Upload the volume to the Image Service as an image. - This is equivalent to the cinder upload-to-image command. + When the volume status is "in-use", you can use "Force" to upload the + volume to an image. {% endblocktrans %}

-

{% blocktrans %} - Choose "Disk Format" for the image. The volume images are created with - the QEMU disk image utility. - {% endblocktrans %} -

- {% if volume.status == 'in-use' %} -

{% blocktrans %} - When the volume status is "in-use", you can use "Force" to upload the - volume to an image. - {% endblocktrans %} -

- {% endif %} -
-{% endblock %} - -{% block modal-footer %} - - {% trans "Cancel" %} + {% endif %} {% endblock %} diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/views.py b/openstack_dashboard/dashboards/project/volumes/volumes/views.py index 03d622951e..2238835ecb 100644 --- a/openstack_dashboard/dashboards/project/volumes/volumes/views.py +++ b/openstack_dashboard/dashboards/project/volumes/volumes/views.py @@ -79,7 +79,10 @@ class DetailView(tabs.TabView): class CreateView(forms.ModalFormView): form_class = project_forms.CreateForm + modal_header = _("Create Volume") template_name = 'project/volumes/volumes/create.html' + submit_label = _("Create Volume") + submit_url = reverse_lazy("horizon:project:volumes:volumes:create") success_url = reverse_lazy('horizon:project:volumes:volumes_tab') def get_context_data(self, **kwargs): @@ -93,7 +96,10 @@ class CreateView(forms.ModalFormView): class ExtendView(forms.ModalFormView): form_class = project_forms.ExtendForm + modal_header = _("Extend Volume") template_name = 'project/volumes/volumes/extend.html' + submit_label = _("Extend Volume") + submit_url = "horizon:project:volumes:volumes:extend" success_url = reverse_lazy("horizon:project:volumes:index") def get_object(self): @@ -110,6 +116,8 @@ class ExtendView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(ExtendView, self).get_context_data(**kwargs) context['volume'] = self.get_object() + args = (self.kwargs['volume_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) try: usages = quotas.tenant_limit_usages(self.request) usages['gigabytesUsed'] = (usages['gigabytesUsed'] @@ -128,12 +136,16 @@ class ExtendView(forms.ModalFormView): class CreateSnapshotView(forms.ModalFormView): form_class = project_forms.CreateSnapshotForm + modal_header = _("Create Volume Snapshot") template_name = 'project/volumes/volumes/create_snapshot.html' + submit_url = "horizon:project:volumes:volumes:create_snapshot" success_url = reverse_lazy('horizon:project:volumes:snapshots_tab') def get_context_data(self, **kwargs): context = super(CreateSnapshotView, self).get_context_data(**kwargs) context['volume_id'] = self.kwargs['volume_id'] + args = (self.kwargs['volume_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) try: volume = cinder.volume_get(self.request, context['volume_id']) if (volume.status == 'in-use'): @@ -156,7 +168,10 @@ class CreateSnapshotView(forms.ModalFormView): class UploadToImageView(forms.ModalFormView): form_class = project_forms.UploadToImageForm + modal_header = _("Upload Volume to Image") template_name = 'project/volumes/volumes/upload_to_image.html' + submit_label = _("Upload") + submit_url = "horizon:project:volumes:volumes:upload_to_image" success_url = reverse_lazy("horizon:project:volumes:index") @memoized.memoized_method @@ -177,7 +192,8 @@ class UploadToImageView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(UploadToImageView, self).get_context_data(**kwargs) context['volume'] = self.get_data() - + args = (self.kwargs['volume_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self): @@ -256,7 +272,11 @@ class ShowTransferView(forms.ModalFormView): class UpdateView(forms.ModalFormView): form_class = project_forms.UpdateForm + modal_header = _("Edit Volume") + modal_id = "update_volume_modal" template_name = 'project/volumes/volumes/update.html' + submit_label = _("Save") + submit_url = "horizon:project:volumes:volumes:update" success_url = reverse_lazy("horizon:project:volumes:index") def get_object(self): @@ -273,6 +293,8 @@ class UpdateView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) context['volume'] = self.get_object() + args = (self.kwargs['volume_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self): @@ -286,7 +308,11 @@ class UpdateView(forms.ModalFormView): class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): table_class = project_tables.AttachmentsTable form_class = project_forms.AttachForm + form_id = "attach_volume_form" + modal_header = _("Manage Volume Attachments") + modal_id = "attach_volume_modal" template_name = 'project/volumes/volumes/attach.html' + submit_url = "horizon:project:volumes:volumes:attach" success_url = reverse_lazy("horizon:project:volumes:index") @memoized.memoized_method @@ -327,6 +353,8 @@ class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): context = super(EditAttachmentsView, self).get_context_data(**kwargs) context['form'] = self.get_form() volume = self.get_object() + args = (self.kwargs['volume_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) if volume and volume.status == 'available': context['show_attach'] = True else: @@ -353,7 +381,11 @@ class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): class RetypeView(forms.ModalFormView): form_class = project_forms.RetypeForm + modal_id = "retype_volume_modal" + modal_header = _("Change Volume Type") template_name = 'project/volumes/volumes/retype.html' + submit_label = _("Change Volume Type") + submit_url = "horizon:project:volumes:volumes:retype" success_url = reverse_lazy("horizon:project:volumes:index") @memoized.memoized_method @@ -374,7 +406,8 @@ class RetypeView(forms.ModalFormView): def get_context_data(self, **kwargs): context = super(RetypeView, self).get_context_data(**kwargs) context['volume'] = self.get_data() - + args = (self.kwargs['volume_id'],) + context['submit_url'] = reverse(self.submit_url, args=args) return context def get_initial(self):