Updated Branches: refs/heads/4.2 e9239b83a -> 1d2e0ed59
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/1d2e0ed5 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1d2e0ed5 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1d2e0ed5 Branch: refs/heads/4.2 Commit: 1d2e0ed590c4ef9365ba3d4484fda1141ed85ad0 Parents: e9239b8 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:10 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/1d2e0ed5/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 {
