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

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
Signed-off-by: Sanjay Tripathi <sanjay.tripathi@citrix.com>
This commit is contained in:
Mihaela Stoica 2014-04-11 16:01:27 +01:00 committed by Sanjay Tripathi
parent 3fbac14aa9
commit f3cf85bb62
4 changed files with 140 additions and 0 deletions

View File

@ -1488,6 +1488,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.

View File

@ -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;
}

View File

@ -1812,6 +1812,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" />',

View File

@ -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;
}
}
}
}