Merge "Clean modal forms for Images panel"
This commit is contained in:
commit
dc3a5ea101
@ -1,25 +1,12 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block form_id %}create_image_form{% endblock %}
|
||||
{% block ng_controller %}ImageFormCtrl{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:admin:images:create' %}{% endblock %}
|
||||
{% block form_attrs %}enctype="multipart/form-data"{% endblock %}
|
||||
|
||||
{% block modal-header %}{% trans "Create An Image" %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
{% block modal-body-right %}
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>
|
||||
{% trans "Specify an image to upload to the Image Service." %}
|
||||
</p>
|
||||
<p>{% trans "Specify an image to upload to the Image Service." %}</p>
|
||||
<p>
|
||||
{% trans "Currently only images available via an HTTP URL are supported. The image location must be accessible to the Image Service. Compressed image binaries are supported (.zip and .tar.gz.)" %}
|
||||
</p>
|
||||
@ -27,10 +14,4 @@
|
||||
<strong>{% trans "Please note: " %}</strong>
|
||||
{% trans "The Image Location field MUST be a valid and direct URL to the image binary. URLs that redirect or serve error pages will result in unusable images." %}
|
||||
</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Image" %}" />
|
||||
<a href="{% url 'horizon:admin:images:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
|
||||
{% endblock %}
|
||||
|
@ -1,26 +1,7 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block form_id %}update_image_form{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:admin:images:update' image.id %}{% endblock %}
|
||||
|
||||
{% block modal_id %}update_image_modal{% endblock %}
|
||||
{% block modal-header %}{% trans "Update Image" %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
{% block modal-body-right %}
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>{% trans "Edit the image details." %}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Image" %}" />
|
||||
<a href="{% url 'horizon:admin:images:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
|
||||
{% endblock %}
|
||||
|
@ -1,11 +1 @@
|
||||
{% extends 'horizon/common/_modal_form_update_metadata.html' %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
{% block title %}{% trans "Update Image Metadata" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Update Image Metadata") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block form_action %}{% url 'horizon:admin:images:update_metadata' id %}{% endblock %}
|
||||
{% block modal-header %}{% trans "Update Metadata" %}{% endblock %}
|
||||
|
@ -110,6 +110,7 @@ class IndexView(tables.DataTableView):
|
||||
class CreateView(views.CreateView):
|
||||
template_name = 'admin/images/create.html'
|
||||
form_class = project_forms.AdminCreateImageForm
|
||||
submit_url = reverse_lazy('horizon:admin:images:create')
|
||||
success_url = reverse_lazy('horizon:admin:images:index')
|
||||
page_title = _("Create An Image")
|
||||
|
||||
@ -117,6 +118,7 @@ class CreateView(views.CreateView):
|
||||
class UpdateView(views.UpdateView):
|
||||
template_name = 'admin/images/update.html'
|
||||
form_class = project_forms.AdminUpdateImageForm
|
||||
submit_url = "horizon:admin:images:update"
|
||||
success_url = reverse_lazy('horizon:admin:images:index')
|
||||
page_title = _("Update Image")
|
||||
|
||||
@ -133,7 +135,10 @@ class DetailView(views.DetailView):
|
||||
|
||||
class UpdateMetadataView(forms.ModalFormView):
|
||||
template_name = "admin/images/update_metadata.html"
|
||||
modal_header = _("Update Image")
|
||||
form_id = "update_image_form"
|
||||
form_class = project_forms.UpdateMetadataForm
|
||||
submit_url = "horizon:admin:images:update_metadata"
|
||||
success_url = reverse_lazy('horizon:admin:images:index')
|
||||
page_title = _("Update Image Metadata")
|
||||
|
||||
@ -151,6 +156,8 @@ class UpdateMetadataView(forms.ModalFormView):
|
||||
for (k, v) in image.properties.iteritems()
|
||||
if k not in reserved_props)
|
||||
context['existing_metadata'] = json.dumps(image.properties)
|
||||
args = (self.kwargs['id'],)
|
||||
context['submit_url'] = reverse(self.submit_url, args=args)
|
||||
|
||||
resource_type = 'OS::Glance::Image'
|
||||
namespaces = []
|
||||
|
@ -40,6 +40,10 @@ from openstack_dashboard.dashboards.project.images.images \
|
||||
|
||||
class CreateView(forms.ModalFormView):
|
||||
form_class = project_forms.CreateImageForm
|
||||
form_id = "create_image_form"
|
||||
modal_header = _("Create An Image")
|
||||
submit_label = _("Create Image")
|
||||
submit_url = reverse_lazy('horizon:project:images:images:create')
|
||||
template_name = 'project/images/images/create.html'
|
||||
context_object_name = 'image'
|
||||
success_url = reverse_lazy("horizon:project:images:index")
|
||||
@ -48,6 +52,10 @@ class CreateView(forms.ModalFormView):
|
||||
|
||||
class UpdateView(forms.ModalFormView):
|
||||
form_class = project_forms.UpdateImageForm
|
||||
form_id = "update_image_form"
|
||||
modal_header = _("Update Image")
|
||||
submit_label = _("Update Image")
|
||||
submit_url = "horizon:project:images:images:update"
|
||||
template_name = 'project/images/images/update.html'
|
||||
success_url = reverse_lazy("horizon:project:images:index")
|
||||
page_title = _("Update Image")
|
||||
@ -64,6 +72,8 @@ class UpdateView(forms.ModalFormView):
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(UpdateView, self).get_context_data(**kwargs)
|
||||
context['image'] = self.get_object()
|
||||
args = (self.kwargs['image_id'],)
|
||||
context['submit_url'] = reverse(self.submit_url, args=args)
|
||||
return context
|
||||
|
||||
def get_initial(self):
|
||||
|
@ -35,6 +35,11 @@ from openstack_dashboard.dashboards.project.images.snapshots \
|
||||
|
||||
class CreateView(forms.ModalFormView):
|
||||
form_class = project_forms.CreateSnapshot
|
||||
form_id = "create_snapshot_form"
|
||||
modal_id = "create_snapshot_modal"
|
||||
modal_header = _("Create Snapshot")
|
||||
submit_label = _("Create Snapshot")
|
||||
submit_url = "horizon:project:images:snapshots:create"
|
||||
template_name = 'project/images/snapshots/create.html'
|
||||
success_url = reverse_lazy("horizon:project:images:index")
|
||||
page_title = _("Create a Snapshot")
|
||||
@ -56,4 +61,6 @@ class CreateView(forms.ModalFormView):
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(CreateView, self).get_context_data(**kwargs)
|
||||
context['instance'] = self.get_object()
|
||||
args = (self.kwargs['instance_id'],)
|
||||
context['submit_url'] = reverse(self.submit_url, args=args)
|
||||
return context
|
||||
|
@ -1,13 +1,9 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block form_id %}create_image_form{% endblock %}
|
||||
{% block ng_controller %}ImageFormCtrl{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:project:images:images:create' %}{% endblock %}
|
||||
{% block form_attrs %}enctype="multipart/form-data"{% endblock %}
|
||||
|
||||
{% block modal-header %}{% trans "Create An Image" %}{% endblock %}
|
||||
|
||||
{% block modal-body-right %}
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
@ -27,8 +23,3 @@
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans 'Create Image' %}" />
|
||||
<a href="{% url 'horizon:project:images:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
|
||||
{% endblock %}
|
||||
|
@ -1,18 +1,7 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block form_id %}update_image_form{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:project:images:images:update' image.id %}{% endblock %}
|
||||
|
||||
{% block modal-header %}{% trans "Update Image" %}{% endblock %}
|
||||
|
||||
{% block modal-body-right %}
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>{% trans "Edit the image details." %}</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Image" %}" />
|
||||
<a href="{% url 'horizon:project:images:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
|
||||
{% endblock %}
|
||||
|
@ -1,26 +1,7 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block form_id %}create_snapshot_form{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:project:images:snapshots:create' instance.id %}{% endblock %}
|
||||
|
||||
{% block modal_id %}create_snapshot_modal{% endblock %}
|
||||
{% block modal-header %}{% trans "Create Snapshot" %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
{% block modal-body-right %}
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>{% trans "A snapshot is an image which preserves the disk state of a running instance." %}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Snapshot" %}" />
|
||||
<a href="{% url 'horizon:project:images:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user