From 530df8c84314a9e0bba5ec0c87c4a59c0a26856a Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 13 Aug 2013 14:26:41 -0700 Subject: [PATCH] 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. --- ui/scripts/ui-custom/instanceWizard.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index b9012ef2de4..f4d4560b60f 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 = $('
'); 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 {