Repository: cloudstack Updated Branches: refs/heads/4.5 98d75b025 -> 54f4240e0
CLOUDSTACK-8005: UI > storage > volume > Resize Volume action > hide "Shrink OK" checkbox when selected disk offering's disksize is bigger than the volume's disksize. Show it otherwise. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/54f4240e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/54f4240e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/54f4240e Branch: refs/heads/4.5 Commit: 54f4240e0e38dd06eca4e4f759d0ada7b517ca98 Parents: 98d75b0 Author: Jessica Wang <jessicaw...@apache.org> Authored: Tue Dec 2 11:16:08 2014 -0800 Committer: Jessica Wang <jessicaw...@apache.org> Committed: Tue Dec 2 11:16:08 2014 -0800 ---------------------------------------------------------------------- ui/scripts/storage.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54f4240e/ui/scripts/storage.js ---------------------------------------------------------------------- diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index 24dc267..11fde94 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -1350,6 +1350,16 @@ return; var $form = $(this).closest('form'); + + var $shrinkok = $form.find('.form-item[rel=shrinkok]'); + //unit of args.context.volumes[0].size is "byte" + //unit of selectedDiskOfferingObj.disksize is "gigabyte" ("GB"), so transfer it into "byte" by multiply (1024 * 1024 * 1024) + if (args.context.volumes[0].size > selectedDiskOfferingObj.disksize * (1024 * 1024 * 1024)) { //if original disk size > new disk size + $shrinkok.css('display', 'inline-block'); + } else { + $shrinkok.hide(); + } + var $newsize = $form.find('.form-item[rel=newsize]'); if (selectedDiskOfferingObj.iscustomized == true) { $newsize.css('display', 'inline-block'); @@ -1402,7 +1412,11 @@ }, action: function(args) { var array1 = []; - array1.push("&shrinkok=" + (args.data.shrinkok == "on")); + + if(args.$form.find('.form-item[rel=shrinkok]').css("display") != "none") { + array1.push("&shrinkok=" + (args.data.shrinkok == "on")); + } + var newDiskOffering = args.data.newdiskoffering; var newSize; if (selectedDiskOfferingObj.iscustomized == true) {