Repository: cloudstack
Updated Branches:
  refs/heads/4.4 2cf4db535 -> eee8a04da


CLOUDSTACK-6394: Add gpu details in "Add Compute Offering”

Signed-off-by: Mihaela Stoica <mihaela.sto...@citrix.com>
Signed-off-by: Sanjay Tripathi <sanjay.tripa...@citrix.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7e5757ed
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7e5757ed
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7e5757ed

Branch: refs/heads/4.4
Commit: 7e5757ed3878c5991959526be3d54d4c54205c95
Parents: 2cf4db5
Author: Mihaela Stoica <mihaela.sto...@citrix.com>
Authored: Sat Apr 12 11:11:21 2014 +0100
Committer: Sanjay Tripathi <sanjay.tripa...@citrix.com>
Committed: Wed Apr 16 15:29:23 2014 +0530

----------------------------------------------------------------------
 ui/scripts/configuration.js | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e5757ed/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index ba6bdce..dd7f75b 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -362,7 +362,7 @@
                                     },
 
                                     pciDevice: {
-                                        label: 'GPU Type',
+                                        label: 'GPU',
                                         select: function(args) {
                                             var items = [];
                                             items.push({
@@ -380,11 +380,43 @@
                                             args.response.success({
                                                 data: items
                                             });
+
+                                            var vGpuMap = {};
+                                            vGpuMap['Group of NVIDIA 
Corporation GK107GL [GRID K1] GPUs'] = ['passthrough', 'GRID K100', 'GRID 
K140Q'];
+                                            vGpuMap['Group of NVIDIA 
Corporation GK104GL [GRID K2] GPUs'] = ['passthrough', 'GRID K200', 'GRID 
K240Q', 'GRID K260Q'];
+
+                                            args.$select.change(function() {
+                                                var gpu = $(this).val();
+
+                                                if (gpu == '') {
+                                                    
$(this).closest('form').find('.form-item[rel=\"vgpuType\"]').hide();
+                                                }
+                                                else {
+                                                    
$(this).closest('form').find('.form-item[rel=\"vgpuType\"]').css('display', 
'inline-block');
+
+                                                    // enable/disable vGPU 
type options, depending on selected GPU
+                                                    var $vGpuTypeSelect = 
$(this).closest('form').find('select[name=vgpuType]');
+                                                    var $vGpuTypeOptions = 
$vGpuTypeSelect.find('option');
+                                                    
$vGpuTypeOptions.each(function(index) {
+                                                        var vGpuTypeOption = 
$(this).val();
+                                                        if (vGpuTypeOption == 
'' || (gpu in vGpuMap && $.inArray(vGpuTypeOption, vGpuMap[gpu]) > -1))
+                                                            
$(this).attr('disabled', false);
+                                                        else
+                                                            
$(this).attr('disabled', true);
+                                                    });
+
+                                                    //if selected option is 
disabled, select the first enabled option instead
+                                                    if 
($vGpuTypeSelect.find('option:selected:disabled').length > 0) {
+                                                        
$vGpuTypeSelect.val($vGpuTypeSelect.find('option:enabled:first').val());
+                                                    }
+                                                }
+                                            });
                                         }
                                     },
 
                                     vgpuType: {
-                                        label: 'VGPU Type',
+                                        label: 'vGPU Type',
+                                        isHidden: true,
                                         select: function(args) {
                                             var items = [];
                                             items.push({

Reply via email to