Skip to content

Commit

Permalink
Improve extend volume form
Browse files Browse the repository at this point in the history
Add the current volume size to the extend volume form

Remove the progress bar when the volume status is error_extending

Change the success message to an info message when the extending
is in progress

Change-Id: Ic6bd00af393d1f74b2db1a9114b848aa5fe4bbc7
Closes-Bug: #1290544
Closes-Bug: #1318723
  • Loading branch information
santibaldassin committed Jun 4, 2014
1 parent c28c221 commit a9ec7a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
16 changes: 10 additions & 6 deletions openstack_dashboard/dashboards/project/volumes/volumes/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,19 @@ class ExtendForm(forms.SelfHandlingForm):
name = forms.CharField(label=_("Volume Name"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}
))
new_size = forms.IntegerField(min_value=1, label=_("Size (GB)"))
), required=False)
orig_size = forms.IntegerField(label=_("Current Size (GB)"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}
), required=False)
new_size = forms.IntegerField(label=_("New Size (GB)"))

def clean(self):
cleaned_data = super(ExtendForm, self).clean()
new_size = cleaned_data.get('new_size', 1)
new_size = cleaned_data.get('new_size')
if new_size <= self.initial['orig_size']:
raise ValidationError(
_("New size for extend must be greater than current size."))
_("New size must be greater than current size."))

return cleaned_data

Expand All @@ -512,8 +516,8 @@ def handle(self, request, data):
volume_id,
data['new_size'])

message = _('Successfully extended volume: "%s"') % data['name']
messages.success(request, message)
message = _('Extending volume: "%s"') % data['name']
messages.info(request, message)
return volume
except Exception:
redirect = reverse("horizon:project:volumes:index")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ class VolumesTableBase(tables.DataTable):
("available", True),
("creating", None),
("error", False),
("error_extending", False),
)
name = tables.Column("name",
verbose_name=_("Name"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,5 +1031,5 @@ def test_extend_volume_with_wrong_size(self):
args=[volume.id])
res = self.client.post(url, formData)
self.assertFormError(res, 'form', None,
"New size for extend must be greater than "
"New size must be greater than "
"current size.")

0 comments on commit a9ec7a7

Please sign in to comment.