Repository: cloudstack Updated Branches: refs/heads/master 03daae571 -> 6b4271b75
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/6b4271b7 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6b4271b7 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6b4271b7 Branch: refs/heads/master Commit: 6b4271b75c4da06e1b3ee1fe03a5ed256ffdf98d Parents: 03daae5 Author: Jessica Wang <[email protected]> Authored: Tue Dec 2 11:16:08 2014 -0800 Committer: Jessica Wang <[email protected]> Committed: Tue Dec 2 11:17:33 2014 -0800 ---------------------------------------------------------------------- ui/scripts/storage.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b4271b7/ui/scripts/storage.js ---------------------------------------------------------------------- diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index f1626da..3156266 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -1356,6 +1356,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'); @@ -1408,7 +1418,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) {
