Updated Branches: refs/heads/master 9375aa946 -> 530df8c84
CLOUDSTACK-4302: Instance wizard: Support readonly checkbox selection If 'selectedObjNonEditable' option is passed alongside 'selectedObj' on response, make checkbox selection readonly/disabled. Right now this is to support 'required' affinity group selections that shouldn't be unselected. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/530df8c8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/530df8c8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/530df8c8 Branch: refs/heads/master Commit: 530df8c84314a9e0bba5ec0c87c4a59c0a26856a Parents: 9375aa9 Author: Brian Federle <[email protected]> Authored: Tue Aug 13 14:26:41 2013 -0700 Committer: Brian Federle <[email protected]> Committed: Tue Aug 13 14:27:34 2013 -0700 ---------------------------------------------------------------------- ui/scripts/ui-custom/instanceWizard.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/530df8c8/ui/scripts/ui-custom/instanceWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index b9012ef..f4d4560 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -90,7 +90,7 @@ }); }; - var makeSelects = function(name, data, fields, options, selectedObj) { + var makeSelects = function(name, data, fields, options, selectedObj, selectedObjNonEditable) { var $selects = $('<div>'); options = options ? options : {}; @@ -163,6 +163,14 @@ if (selectedObj != null && selectedObj.id == item.id) { $select.find('input[type=checkbox]').attr('checked', 'checked'); + + if (selectedObjNonEditable) { + $select.find('input[type=checkbox]').attr('disabled', 'disabled'); + $select.find('input[type=checkbox]').clone().attr({ + type: 'hidden', + disabled: false + }).appendTo($selects); + } } $selects.append($select); @@ -521,7 +529,8 @@ type: 'checkbox', 'wizard-field': 'affinity-groups' }, - args.data.selectedObj + args.data.selectedObj, + args.data.selectedObjNonEditable ) ); } else {
