Updated Branches: refs/heads/master 5e9320faa -> e0c0282d3
CLOUDSTACK-4758: UI > Create Compute Offering > add new field "Custom" checkbox > when it's checked, Number of CPU Cores/CPU/Memory field become non-required and hidden. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e0c0282d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e0c0282d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e0c0282d Branch: refs/heads/master Commit: e0c0282d3ba3792c23996bd7ae9714dc70a5099c Parents: 5e9320f Author: Jessica Wang <jessicaw...@apache.org> Authored: Tue Oct 29 15:52:04 2013 -0700 Committer: Jessica Wang <jessicaw...@apache.org> Committed: Tue Oct 29 15:54:52 2013 -0700 ---------------------------------------------------------------------- ui/scripts/configuration.js | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e0c0282d/ui/scripts/configuration.js ---------------------------------------------------------------------- diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index e76caaf..4280597 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -95,8 +95,15 @@ }); } }, + isCustomized: { + label: 'Custom', + isBoolean: true, + isReverse: true, + isChecked: false + }, cpuNumber: { label: 'label.num.cpu.cores', + dependsOn: 'isCustomized', docID: 'helpComputeOfferingCPUCores', validation: { required: true, @@ -105,6 +112,7 @@ }, cpuSpeed: { label: 'label.cpu.mhz', + dependsOn: 'isCustomized', docID: 'helpComputeOfferingCPUMHz', validation: { required: true, @@ -113,6 +121,7 @@ }, memory: { label: 'label.memory.mb', + dependsOn: 'isCustomized', docID: 'helpComputeOfferingMemory', validation: { required: true, @@ -280,11 +289,27 @@ name: args.data.name, displaytext: args.data.description, storageType: args.data.storageType, - cpuNumber: args.data.cpuNumber, - cpuSpeed: args.data.cpuSpeed, - memory: args.data.memory + customized: (args.data.isCustomized == "on") }; - + + //custom fields (begin) + if (args.$form.find('.form-item[rel=cpuNumber]').css("display") != "none") { + $.extend(data, { + cpuNumber: args.data.cpuNumber + }); + } + if (args.$form.find('.form-item[rel=cpuSpeed]').css("display") != "none") { + $.extend(data, { + cpuSpeed: args.data.cpuSpeed + }); + } + if (args.$form.find('.form-item[rel=memory]').css("display") != "none") { + $.extend(data, { + memory: args.data.memory + }); + } + //custom fields (end) + if (args.data.deploymentPlanner != null && args.data.deploymentPlanner.length > 0) { $.extend(data, { deploymentplanner: args.data.deploymentPlanner