diff --git a/horizon/horizon/api/nova.py b/horizon/horizon/api/nova.py index 1802d1a48d..d523efd40c 100644 --- a/horizon/horizon/api/nova.py +++ b/horizon/horizon/api/nova.py @@ -103,7 +103,7 @@ class ServerAttributes(APIDictWrapper): Preserves the request info so image name can later be retrieved """ - _attrs = ['description', 'disk_gb', 'host', 'image_ref', 'kernel_id', + _attrs = ['disk_gb', 'host', 'image_ref', 'kernel_id', 'key_name', 'launched_at', 'mac_address', 'memory_mb', 'name', 'os_type', 'tenant_id', 'ramdisk_id', 'scheduled_at', 'terminated_at', 'user_data', 'user_id', 'vcpus', 'hostname', @@ -231,12 +231,11 @@ def server_delete(request, instance): def server_get(request, instance_id): - return Server(extras_api(request).servers.get(instance_id), request) + return Server(novaclient(request).servers.get(instance_id), request) -@check_openstackx def server_list(request): - return [Server(s, request) for s in extras_api(request).servers.list()] + return [Server(s, request) for s in novaclient(request).servers.list()] @check_openstackx @@ -251,10 +250,8 @@ def server_reboot(request, server.reboot(hardness) -def server_update(request, instance_id, name, description): - return extras_api(request).servers.update(instance_id, - name=name, - description=description) +def server_update(request, instance_id, name): + return novaclient(request).servers.update(instance_id, name=name) def server_add_floating_ip(request, server, address): diff --git a/horizon/horizon/context_processors.py b/horizon/horizon/context_processors.py index eccb0452a8..6f3c8af684 100644 --- a/horizon/horizon/context_processors.py +++ b/horizon/horizon/context_processors.py @@ -46,8 +46,12 @@ def horizon(request): ``network_configured`` Boolean. Will be ``True`` if ``settings.QUANTUM_ENABLED`` is ``True``. + + Additionally, it sets the names ``True`` and ``False`` in the context + to their boolean equivalents for convenience. """ - context = {} + context = {"True": True, + "False": False} # Auth/Keystone context context.setdefault('authorized_tenants', []) diff --git a/horizon/horizon/dashboards/nova/images/forms.py b/horizon/horizon/dashboards/nova/images/forms.py index 806d06210b..14e07b559f 100644 --- a/horizon/horizon/dashboards/nova/images/forms.py +++ b/horizon/horizon/dashboards/nova/images/forms.py @@ -65,7 +65,7 @@ class UpdateImageForm(forms.SelfHandlingForm): LOG.exception(error_retrieving) messages.error(request, error_retrieving) - if image.owner == request.user.username: + if image.owner == request.user.tenant_id: try: meta = { 'is_public': True, diff --git a/horizon/horizon/dashboards/nova/images/views.py b/horizon/horizon/dashboards/nova/images/views.py index 12e3ef3b6b..c2b12b48c3 100644 --- a/horizon/horizon/dashboards/nova/images/views.py +++ b/horizon/horizon/dashboards/nova/images/views.py @@ -46,8 +46,6 @@ def index(request): unused, handled = f.maybe_handle(request) if handled: return handled - delete_form = DeleteImage() - all_images = [] try: all_images = api.image_list_detailed(request) @@ -67,9 +65,12 @@ def index(request): images = [im for im in all_images if im['container_format'] not in ['aki', 'ari']] + quotas = api.tenant_quota_get(request, request.user.tenant_id) + return shortcuts.render(request, 'nova/images/index.html', { - 'delete_form': delete_form, + 'delete_form': DeleteImage(), + 'quotas': quotas, 'images': images}) diff --git a/horizon/horizon/dashboards/nova/instances/forms.py b/horizon/horizon/dashboards/nova/instances/forms.py index 1296008e89..70d6fc3052 100644 --- a/horizon/horizon/dashboards/nova/instances/forms.py +++ b/horizon/horizon/dashboards/nova/instances/forms.py @@ -82,16 +82,13 @@ class UpdateInstance(forms.SelfHandlingForm): instance = forms.CharField(widget=forms.TextInput( attrs={'readonly': 'readonly'})) name = forms.CharField(required=True) - description = forms.CharField(required=False) def handle(self, request, data): tenant_id = data['tenant_id'] - description = data.get('description', '') try: api.server_update(request, data['instance'], - data['name'], - description) + data['name']) messages.success(request, _("Instance '%s' updated") % data['name']) except api_exceptions.ApiException, e: diff --git a/horizon/horizon/dashboards/nova/instances/views.py b/horizon/horizon/dashboards/nova/instances/views.py index 75b975e2ef..9674b97fbf 100644 --- a/horizon/horizon/dashboards/nova/instances/views.py +++ b/horizon/horizon/dashboards/nova/instances/views.py @@ -209,8 +209,7 @@ def update(request, instance_id): form, handled = UpdateInstance.maybe_handle(request, initial={ 'instance': instance_id, 'tenant_id': tenant_id, - 'name': instance.name, - 'description': instance.attrs['description']}) + 'name': instance.name}) if handled: return handled diff --git a/horizon/horizon/dashboards/nova/templates/nova/containers/_create.html b/horizon/horizon/dashboards/nova/templates/nova/containers/_create.html index c82d716cc8..1fd10b3862 100644 --- a/horizon/horizon/dashboards/nova/templates/nova/containers/_create.html +++ b/horizon/horizon/dashboards/nova/templates/nova/containers/_create.html @@ -1,11 +1,24 @@ -{% extends 'nova/keypairs/_form.html' %} +{% extends "horizon/common/_modal_form.html" %} {%load i18n%} -{% block form_url %}{% url horizon:nova:containers:create %}{% endblock %} +{% block form_id %}create_container_form{% endblock %} +{% block form_action %}{% url horizon:nova:containers:create %}{% endblock %} -{% block submit %} -
- {% block submit %} + {% block modal-footer %} {% endfor %} - {% block submit %} + {% block modal-footer %} {% endblock %} diff --git a/horizon/horizon/dashboards/nova/templates/nova/volumes/_create.html b/horizon/horizon/dashboards/nova/templates/nova/volumes/_create.html index 345723d890..8d8b789a98 100644 --- a/horizon/horizon/dashboards/nova/templates/nova/volumes/_create.html +++ b/horizon/horizon/dashboards/nova/templates/nova/volumes/_create.html @@ -1,9 +1,9 @@ {% extends 'nova/volumes/_form.html' %} {%load i18n%} -{% block form_url %}{% url horizon:nova:volumes:create %}{% endblock %} +{% block form_action %}{% url horizon:nova:volumes:create %}{% endblock %} -{% block submit %} +{% block modal-footer %} {% endfor %} - {% block submit %} + {% block modal-footer %} {% endblock %} diff --git a/horizon/horizon/dashboards/syspanel/templates/syspanel/flavors/_create.html b/horizon/horizon/dashboards/syspanel/templates/syspanel/flavors/_create.html index e8a6ee716e..ef453ba085 100644 --- a/horizon/horizon/dashboards/syspanel/templates/syspanel/flavors/_create.html +++ b/horizon/horizon/dashboards/syspanel/templates/syspanel/flavors/_create.html @@ -1,9 +1,9 @@ {% extends 'syspanel/flavors/_form.html' %} {%load i18n%} -{% block form_url %}{% url horizon:syspanel:users:create %}{% endblock %} +{% block form_action %}{% url horizon:syspanel:users:create %}{% endblock %} -{% block submit %} +{% block modal-footer %} {% endfor %} - {% block submit %} + {% block modal-footer %} {% endblock %} diff --git a/horizon/horizon/dashboards/syspanel/templates/syspanel/images/_form.html b/horizon/horizon/dashboards/syspanel/templates/syspanel/images/_form.html index 4811210c87..6657b13634 100644 --- a/horizon/horizon/dashboards/syspanel/templates/syspanel/images/_form.html +++ b/horizon/horizon/dashboards/syspanel/templates/syspanel/images/_form.html @@ -1,5 +1,5 @@ {%load i18n%} - diff --git a/horizon/horizon/dashboards/syspanel/templates/syspanel/tenants/_update.html b/horizon/horizon/dashboards/syspanel/templates/syspanel/tenants/_update.html index 6bb77ae8ed..0e7f6d197d 100644 --- a/horizon/horizon/dashboards/syspanel/templates/syspanel/tenants/_update.html +++ b/horizon/horizon/dashboards/syspanel/templates/syspanel/tenants/_update.html @@ -1,9 +1,9 @@ {% extends 'syspanel/images/_form.html' %} {%load i18n%} -{% block form_url %}{% url horizon:syspanel:tenants:update tenant_id %}{% endblock %} +{% block form_action %}{% url horizon:syspanel:tenants:update tenant_id %}{% endblock %} -{% block submit %} +{% block modal-footer %} {% endfor %} - {% block submit %} + {% block modal-footer %} {% endblock %} diff --git a/horizon/horizon/templates/horizon/common/_form_fields.html b/horizon/horizon/templates/horizon/common/_form_fields.html new file mode 100644 index 0000000000..73af73f8a8 --- /dev/null +++ b/horizon/horizon/templates/horizon/common/_form_fields.html @@ -0,0 +1,17 @@ +{% for hidden in form.hidden_fields %} + {{ hidden }} +{% endfor %} +{% for field in form.visible_fields %} +