CLOUDSTACK-4738: VM wizard: Add custom fields for compute offering
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f0a8aa7f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f0a8aa7f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f0a8aa7f Branch: refs/heads/rbac Commit: f0a8aa7f5e96f6ddf746bd27eb087386bccfb1a1 Parents: 3223fcf Author: Brian Federle <brian.fede...@citrix.com> Authored: Tue Oct 29 13:24:23 2013 -0700 Committer: Brian Federle <brian.fede...@citrix.com> Committed: Tue Oct 29 13:29:13 2013 -0700 ---------------------------------------------------------------------- ui/css/cloudstack3.css | 33 ++++++++++++++++++++++++++++- ui/index.jsp | 16 ++++++++++++++ ui/scripts/instanceWizard.js | 1 + ui/scripts/ui-custom/instanceWizard.js | 22 ++++++++++++++++++- 4 files changed, 70 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0a8aa7f/ui/css/cloudstack3.css ---------------------------------------------------------------------- diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index c4a5734..2da0d29 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -5910,7 +5910,7 @@ label.error { .multi-wizard.instance-wizard .section.custom-size { position: relative; - background: #FFFFFF; + background: #F4F4F4; padding: 7px; border-radius: 4px; } @@ -5932,6 +5932,37 @@ label.error { font-size: 10px; } +/*** Compute offering*/ +.instance-wizard .step.service-offering { +} + +.instance-wizard .step.service-offering.custom-size .select-container { + height: 235px; +} + +.instance-wizard .step.service-offering .custom-size { + display: none; +} + +.instance-wizard .step.service-offering.custom-size .custom-size { + display: block; +} + +.instance-wizard .step.service-offering .custom-size .field { + width: 30%; + float: left; + margin-bottom: 13px; +} + +.instance-wizard .step.service-offering .custom-size .field label { + text-indent: 20px; +} + +.instance-wizard .step.service-offering .custom-size .field input { + width: 88%; + margin-left: 26px; +} + /*** Network*/ .multi-wizard.instance-wizard .no-network { background: #FFFFFF; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0a8aa7f/ui/index.jsp ---------------------------------------------------------------------- diff --git a/ui/index.jsp b/ui/index.jsp index 7a1cfaa..eb8ad95 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1,3 +1,4 @@ + <%-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -210,6 +211,21 @@ <div class="content"> <div class="select-container"> </div> + <!-- Custom size slider --> + <div class="section custom-size"> + <div class="field"> + <label><fmt:message key="label.num.cpu.cores"/></label> + <input type="text" name="compute-cpu-cores" /> + </div> + <div class="field"> + <label><fmt:message key="label.cpu.mhz"/></label> + <input type="text" name="compute-cpu" /> + </div> + <div class="field"> + <label><fmt:message key="label.memory.mb"/></label> + <input type="text" name="compute-memory" /> + </div> + </div> </div> </div> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0a8aa7f/ui/scripts/instanceWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index 40832ae..484b18c 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -290,6 +290,7 @@ success: function(json) { serviceOfferingObjs = json.listserviceofferingsresponse.serviceoffering; args.response.success({ + customFlag: 'iscustomized', data: { serviceOfferings: serviceOfferingObjs } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0a8aa7f/ui/scripts/ui-custom/instanceWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index a246051..4368ec4 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -424,7 +424,27 @@ }, { 'wizard-field': 'service-offering' }) - ); + ); + + $step.find('input[type=radio]').bind('change', function() { + var $target = $(this); + var val = $target.val(); + var item = $.grep(args.data.serviceOfferings, function(elem) { + return elem.id == val; + })[0]; + + if (!item) return true; + + var custom = item[args.customFlag]; + + if (custom) { + $step.addClass('custom-size'); + } else { + $step.removeClass('custom-size'); + } + + return true; + }); originalValues(formData); }