CLOUDSTACK-6233: Add new tab "GPU" in Host detailView for gpu enabled hosts

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/eee8a04d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eee8a04d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eee8a04d

Branch: refs/heads/4.4
Commit: eee8a04dabe5eb19fd7fc6be4b33b39ed27ffde6
Parents: a0e6eff
Author: Mihaela Stoica <mihaela.sto...@citrix.com>
Authored: Fri Apr 11 16:01:27 2014 +0100
Committer: Sanjay Tripathi <sanjay.tripa...@citrix.com>
Committed: Wed Apr 16 15:36:52 2014 +0530

----------------------------------------------------------------------
 .../classes/resources/messages.properties       |  6 ++
 ui/css/cloudstack3.css                          | 46 +++++++++++
 ui/dictionary.jsp                               |  6 ++
 ui/scripts/system.js                            | 82 ++++++++++++++++++++
 4 files changed, 140 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eee8a04d/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties 
b/client/WEB-INF/classes/resources/messages.properties
index bfa9600..9f2baa1 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1487,6 +1487,12 @@ label.allow=Allow
 label.deny=Deny
 label.default.egress.policy=Default egress policy
 label.xenserver.tools.version.61.plus=XenServer Tools Version 6.1\+
+label.gpu=GPU
+label.vgpu.type=vGPU type
+label.vgpu.video.ram=Video RAM
+label.vgpu.max.resolution=Max resolution
+label.vgpu.max.vgpu.per.gpu=vGPUs per GPU
+label.vgpu.remaining.capacity=Remaining capacity
 managed.state=Managed State
 message.acquire.new.ip.vpc=Please confirm that you would like to acquire a new 
IP for this VPC.
 message.acquire.new.ip=Please confirm that you would like to acquire a new IP 
for this network.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eee8a04d/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index c0f7c00..06351d7 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -12908,3 +12908,49 @@ div.ui-dialog div.autoscaler div.field-group 
div.form-container form div.form-it
   display: inline-block;
 }
 
+
+/*GPU*/
+div.gpugroups div.list-view div.fixed-header {
+    position: relative;
+    left: 12px !important;
+    top: 0px !important;
+}
+
+div.gpugroups div.list-view div.fixed-header table {
+    width: auto;
+}
+
+div.gpugroups div.list-view div.data-table table {
+    margin-top: 0;
+}
+
+div.gpugroups div.list-view {
+  position: relative;
+  height: auto !important;
+  margin-top: 0 !important;
+  border: none !important;
+}
+
+.gpugroups {
+    float: left;
+    height: 100%;
+    width: 100%;
+    overflow-x: hidden;
+    overflow-y: auto;
+}
+.gpugroups .gpugroup-container {
+    border: 1px solid #C8C2C2;
+    border-radius: 3px;
+    height: auto !important;
+    margin: 12px;
+    padding: 0;
+    position: relative;
+    float: left;
+    width: auto;
+}
+
+.gpugroups .gpugroup-container .title {
+    font-size: 13px;
+    font-weight: 100;
+    padding: 12px 12px 5px;
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eee8a04d/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index f4d380c..50832ef 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -1811,6 +1811,12 @@ dictionary = {
 'label.deny': '<fmt:message key="label.deny" />',
 'label.default.egress.policy': '<fmt:message key="label.default.egress.policy" 
/>',
 'label.xenserver.tools.version.61.plus': '<fmt:message 
key="label.xenserver.tools.version.61.plus" />',
+'label.gpu': '<fmt:message key="label.gpu" />',
+'label.vgpu.type': '<fmt:message key="label.vgpu.type" />',
+'label.vgpu.video.ram': '<fmt:message key="label.vgpu.video.ram" />',
+'label.vgpu.max.resolution': '<fmt:message key="label.vgpu.max.resolution" />',
+'label.vgpu.max.vgpu.per.gpu': '<fmt:message key="label.vgpu.max.vgpu.per.gpu" 
/>',
+'label.vgpu.remaining.capacity': '<fmt:message 
key="label.vgpu.remaining.capacity" />',
 'message.confirm.delete.ciscovnmc.resource': '<fmt:message 
key="message.confirm.delete.ciscovnmc.resource" />',
 'message.confirm.add.vnmc.provider': '<fmt:message 
key="message.confirm.add.vnmc.provider" />',
 'message.confirm.enable.vnmc.provider': '<fmt:message 
key="message.confirm.enable.vnmc.provider" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eee8a04d/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index ce62936..67e01f1 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -14879,6 +14879,13 @@
                                 }
                             }
                         },
+                        tabFilter: function (args) {
+                            var hiddenTabs =[];
+                            if (args.context.hosts[0].gpugroup == null) {
+                                hiddenTabs.push("gpu");
+                            }
+                            return hiddenTabs;
+                        },
                         tabs: {
                             details: {
                                 title: 'label.details',
@@ -15072,6 +15079,81 @@
                                         }
                                     });
                                 }
+                            },
+                            gpu: {
+                                title: 'label.gpu',
+                                custom: function (args) {
+                                    var gpugroups = null;
+                                    $.ajax({
+                                        url: createURL("listHosts&id=" + 
args.context.hosts[0].id),
+                                        dataType: "json",
+                                        async: false,
+                                        success: function (json) {
+                                            var item = 
json.listhostsresponse.host[0];
+                                            if (item != null && item.gpugroup 
!= null)
+                                                gpugroups = item.gpugroup;
+                                        }
+                                    });
+
+                                    var $tabcontent = 
$('<div>').addClass('gpugroups');
+
+                                    $(gpugroups).each(function() {
+                                        var gpugroupObj = this;
+
+                                        var $groupcontainer = 
$('<div>').addClass('gpugroup-container');
+
+                                        //group name
+                                        
$groupcontainer.append($('<div>').addClass('title')
+                                                            
.append($('<span>').html(gpugroupObj.gpugroupname)));
+                                        //vgpu details
+                                        var $groupdetails = 
$('<div>').listView({
+                                            context: args.context,
+                                            listView: {
+                                                id: 'gputypes',
+                                                hideToolbar: true,
+                                                fields: {
+                                                    vgputype: {
+                                                        label: 
'label.vgpu.type'
+                                                    },
+                                                    maxvgpuperpgpu: {
+                                                        label: 
'label.vgpu.max.vgpu.per.gpu',
+                                                        converter: function 
(args) {
+                                                            return (args == 
null || args == 0) ? "" : args;
+                                                        }
+                                                    },
+                                                    videoram: {
+                                                        label: 
'label.vgpu.video.ram',
+                                                        converter: function 
(args) {
+                                                            return (args == 
null || args == 0) ? "" : cloudStack.converters.convertBytes(args);
+                                                        }
+                                                    },
+                                                    maxresolution: {
+                                                        label: 
'label.vgpu.max.resolution'
+                                                    },
+                                                    remainingcapacity: {
+                                                        label: 
'label.vgpu.remaining.capacity'
+                                                    }
+                                                },
+                                                dataProvider: function (args) {
+                                                    var items = 
gpugroupObj.vgpu.sort(function(a, b) {
+                                                        return 
a.maxvgpuperpgpu >= b.maxvgpuperpgpu;
+                                                    });
+                                                    $(items).each(function () {
+                                                        this.maxresolution = 
(this.maxresolutionx == null || this.maxresolutionx == 0
+                                                                || 
this.maxresolutiony == null || this.maxresolutiony == 0)
+                                                                ? "" : 
this.maxresolutionx + " x " + this.maxresolutiony;
+                                                    });
+                                                    args.response.success({
+                                                        data: items
+                                                    });
+                                                }
+                                            }
+                                        });
+                                        $groupcontainer.append($groupdetails);
+                                        $tabcontent.append($groupcontainer);
+                                    });
+                                    return $tabcontent;
+                                }
                             }
                         }
                     }

Reply via email to