From cd2a7907be0f2762ea5dca4a13171d66429519c0 Mon Sep 17 00:00:00 2001 From: Ying Zuo Date: Fri, 2 Sep 2016 14:49:41 -0700 Subject: [PATCH] The minimum volume size should be pre-populated On the create volume modal, the minimum volume size should be pre-populated when user selects a different image. Closes-bug: #1615114 Change-Id: I6a0feb376250aacb00270aa5db879dd4a98d6977 --- horizon/static/horizon/js/horizon.forms.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/horizon/static/horizon/js/horizon.forms.js b/horizon/static/horizon/js/horizon.forms.js index 8b2565edf9..5df59025a9 100644 --- a/horizon/static/horizon/js/horizon.forms.js +++ b/horizon/static/horizon/js/horizon.forms.js @@ -43,16 +43,9 @@ horizon.forms = { $volName.val($option.data("name")); } var $volSize = $form.find('input#id_size'); - var volSize = parseInt($volSize.val(), 10) || -1; var dataSize = parseInt($option.data("size"), 10) || -1; - var minDiskSize = parseInt($option.data("min_disk"), 10) || -1; - var defaultVolSize = dataSize; - if (minDiskSize > defaultVolSize) { - defaultVolSize = minDiskSize; - } - if (volSize < defaultVolSize) { - $volSize.val(defaultVolSize); - } + var minDiskSize = parseInt($option.data("min_disk"), 10) || 1; + $volSize.val(Math.max(minDiskSize, dataSize)); }); },