From d3dd5e0ff06a9c1e9fa7d7c1da6526f767479d4a Mon Sep 17 00:00:00 2001 From: LIU Yulong Date: Fri, 29 Aug 2014 16:16:15 +0800 Subject: [PATCH] Make no response notification(msg) level to INFO Some API calls just sent but the results were uncertain, Horizon should notify the user that your request is just accepted, not successfully. So this patch change some form message level to INFO, and some message expression. Change-Id: I241cd9cf3ad6b2bd747e3ea1c6040a140ba77b56 Closes-Bug: #1326301 Closes-Bug: #1286418 --- .../dashboards/admin/instances/forms.py | 2 +- .../dashboards/project/images/images/forms.py | 6 +++--- .../dashboards/project/instances/forms.py | 2 +- .../project/instances/workflows/create_instance.py | 3 ++- .../project/instances/workflows/resize_instance.py | 3 ++- .../dashboards/project/stacks/forms.py | 4 ++-- .../dashboards/project/volumes/backups/forms.py | 11 ++++++----- .../dashboards/project/volumes/backups/tests.py | 2 +- .../test/integration_tests/tests/test_images.py | 2 +- 9 files changed, 19 insertions(+), 16 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/instances/forms.py b/openstack_dashboard/dashboards/admin/instances/forms.py index efd2a10609..db76530139 100644 --- a/openstack_dashboard/dashboards/admin/instances/forms.py +++ b/openstack_dashboard/dashboards/admin/instances/forms.py @@ -69,7 +69,7 @@ class LiveMigrateForm(forms.SelfHandlingForm): disk_over_commit=disk_over_commit) msg = _('The instance is preparing the live migration ' 'to host "%s".') % data['host'] - messages.success(request, msg) + messages.info(request, msg) return True except Exception: msg = _('Failed to live migrate instance to ' diff --git a/openstack_dashboard/dashboards/project/images/images/forms.py b/openstack_dashboard/dashboards/project/images/images/forms.py index 9cd6e09d71..d302f9d3b3 100644 --- a/openstack_dashboard/dashboards/project/images/images/forms.py +++ b/openstack_dashboard/dashboards/project/images/images/forms.py @@ -265,9 +265,9 @@ class CreateImageForm(forms.SelfHandlingForm): try: image = api.glance.image_create(request, **meta) - messages.success(request, - _('Your image %s has been queued for creation.') % - meta['name']) + messages.info(request, + _('Your image %s has been queued for creation.') % + meta['name']) return image except Exception as e: msg = _('Unable to create new image') diff --git a/openstack_dashboard/dashboards/project/instances/forms.py b/openstack_dashboard/dashboards/project/instances/forms.py index a0b4f72eb9..e9a935a535 100644 --- a/openstack_dashboard/dashboards/project/instances/forms.py +++ b/openstack_dashboard/dashboards/project/instances/forms.py @@ -107,7 +107,7 @@ class RebuildInstanceForm(forms.SelfHandlingForm): try: api.nova.server_rebuild(request, instance, image, password, disk_config) - messages.success(request, _('Rebuilding instance %s.') % instance) + messages.info(request, _('Rebuilding instance %s.') % instance) except Exception: redirect = reverse('horizon:project:instances:index') exceptions.handle(request, _("Unable to rebuild instance."), diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py index 2f657b3178..a5af46c74d 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py @@ -869,7 +869,8 @@ class LaunchInstance(workflows.Workflow): slug = "launch_instance" name = _("Launch Instance") finalize_button_name = _("Launch") - success_message = _('Launched %(count)s named "%(name)s".') + success_message = _('Request for launching %(count)s named "%(name)s" ' + 'has been submitted.') failure_message = _('Unable to launch %(count)s named "%(name)s".') success_url = "horizon:project:instances:index" multipart = True diff --git a/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py index fe68e010fb..af1e9253c1 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py @@ -83,7 +83,8 @@ class ResizeInstance(workflows.Workflow): slug = "resize_instance" name = _("Resize Instance") finalize_button_name = _("Resize") - success_message = _('Scheduled resize of instance "%s".') + success_message = _('Request for resizing of instance "%s" ' + 'has been submitted.') failure_message = _('Unable to resize instance "%s".') success_url = "horizon:project:instances:index" default_steps = (SetFlavorChoice, create_instance.SetAdvanced) diff --git a/openstack_dashboard/dashboards/project/stacks/forms.py b/openstack_dashboard/dashboards/project/stacks/forms.py index a42f079a3d..d18921fc49 100644 --- a/openstack_dashboard/dashboards/project/stacks/forms.py +++ b/openstack_dashboard/dashboards/project/stacks/forms.py @@ -381,7 +381,7 @@ class CreateStackForm(forms.SelfHandlingForm): try: api.heat.stack_create(self.request, **fields) - messages.success(request, _("Stack creation started.")) + messages.info(request, _("Stack creation started.")) return True except Exception: exceptions.handle(request) @@ -430,7 +430,7 @@ class EditStackForm(CreateStackForm): try: api.heat.stack_update(self.request, stack_id=stack_id, **fields) - messages.success(request, _("Stack update started.")) + messages.info(request, _("Stack update started.")) return True except Exception: exceptions.handle(request) diff --git a/openstack_dashboard/dashboards/project/volumes/backups/forms.py b/openstack_dashboard/dashboards/project/volumes/backups/forms.py index e703dec1d5..d4728b66e4 100644 --- a/openstack_dashboard/dashboards/project/volumes/backups/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/backups/forms.py @@ -54,7 +54,7 @@ class CreateBackupForm(forms.SelfHandlingForm): data['description']) message = _('Creating volume backup "%s"') % data['name'] - messages.success(request, message) + messages.info(request, message) return backup except Exception: @@ -98,10 +98,11 @@ class RestoreBackupForm(forms.SelfHandlingForm): # Needed for cases when a new volume is created. volume_id = restore.volume_id - message = _('Successfully restored backup %(backup_name)s ' - 'to volume with id: %(volume_id)s') - messages.success(request, message % {'backup_name': backup_name, - 'volume_id': volume_id}) + message = _('Request for restoring backup %(backup_name)s ' + 'to volume with id: %(volume_id)s ' + 'has been submitted.') + messages.info(request, message % {'backup_name': backup_name, + 'volume_id': volume_id}) return restore except Exception: msg = _('Unable to restore backup.') diff --git a/openstack_dashboard/dashboards/project/volumes/backups/tests.py b/openstack_dashboard/dashboards/project/volumes/backups/tests.py index 4e5e3576c7..42430810c7 100644 --- a/openstack_dashboard/dashboards/project/volumes/backups/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/backups/tests.py @@ -164,5 +164,5 @@ class VolumeBackupsViewTests(test.TestCase): res = self.client.post(url, formData) self.assertNoFormErrors(res) - self.assertMessageCount(success=1) + self.assertMessageCount(info=1) self.assertRedirectsNoFollow(res, INDEX_URL) diff --git a/openstack_dashboard/test/integration_tests/tests/test_images.py b/openstack_dashboard/test/integration_tests/tests/test_images.py index e181c791aa..8ae489cde3 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_images.py +++ b/openstack_dashboard/test/integration_tests/tests/test_images.py @@ -30,7 +30,7 @@ class TestImagesBasic(helpers.TestCase): image_file=local_file) else: images_page.create_image(IMAGE_NAME) - self.assertTrue(images_page.find_message_and_dismiss(messages.SUCCESS)) + self.assertTrue(images_page.find_message_and_dismiss(messages.INFO)) self.assertFalse(images_page.find_message_and_dismiss(messages.ERROR)) self.assertTrue(images_page.is_image_present(IMAGE_NAME)) self.assertTrue(images_page.is_image_active(IMAGE_NAME))