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
This commit is contained in:
LIU Yulong 2014-08-29 16:16:15 +08:00 committed by LIU Yulong
parent 5621fc7e56
commit d3dd5e0ff0
9 changed files with 19 additions and 16 deletions

View File

@ -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 '

View File

@ -265,7 +265,7 @@ class CreateImageForm(forms.SelfHandlingForm):
try:
image = api.glance.image_create(request, **meta)
messages.success(request,
messages.info(request,
_('Your image %s has been queued for creation.') %
meta['name'])
return image

View File

@ -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."),

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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,9 +98,10 @@ 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,
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:

View File

@ -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)

View File

@ -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))