Skip to content

Commit 215621d

Browse files
committed
CPU&RAM overcommit ratio uI integration code
1 parent 2beb66f commit 215621d

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7440,6 +7440,18 @@
74407440
validation: { required: true }
74417441
},
74427442

7443+
cpuovercommit:{
7444+
label: 'CPU overcommit ratio',
7445+
defaultValue:'1'
7446+
7447+
},
7448+
7449+
ramovercommit:{
7450+
label: 'RAM overcommit ratio',
7451+
defaultValue:'1'
7452+
7453+
},
7454+
74437455
//hypervisor==VMWare begins here
74447456
vCenterHost: {
74457457
label: 'label.vcenter.host',
@@ -7497,6 +7509,13 @@
74977509
array1.push("&podId=" + args.data.podId);
74987510

74997511
var clusterName = args.data.name;
7512+
7513+
if(args.data.cpuovercommit != "")
7514+
array1.push("&cpuovercommitratio=" + todb(args.data.cpuovercommit));
7515+
7516+
if(args.data.ramovercommit != "")
7517+
array1.push("&ramovercommitratio=" + todb(args.data.ramovercommit));
7518+
75007519
if(args.data.hypervisor == "VMware") {
75017520
array1.push("&username=" + todb(args.data.vCenterUsername));
75027521
array1.push("&password=" + todb(args.data.vCenterPassword));
@@ -7572,6 +7591,38 @@
75727591
},
75737592

75747593
actions: {
7594+
7595+
edit: {
7596+
label: 'label.edit',
7597+
action: function(args) {
7598+
var array1 = [];
7599+
7600+
if (args.data.cpuovercommitratio != "" && args.data.cpuovercommitratio > 0)
7601+
array1.push("&cpuovercommitratio=" + args.data.cpuovercommitratio);
7602+
7603+
if (args.data.ramovercommitratio != "" && args.data.ramovercommitratio > 0)
7604+
array1.push("&ramovercommitratio=" + args.data.ramovercommitratio);
7605+
7606+
$.ajax({
7607+
7608+
url: createURL("updateCluster&id=" + args.context.clusters[0].id + array1.join("")),
7609+
dataType: "json",
7610+
async: true,
7611+
success: function(json) {
7612+
var item = json.updateclusterresponse.cluster;
7613+
args.context.clusters[0].cpuovercommitratio = item.cpuovercommitratio;
7614+
args.context.clusters[0].ramovercommitratio = item.ramovercommitratio;
7615+
addExtraPropertiesToClusterObject(item);
7616+
args.response.success({
7617+
actionFilter: clusterActionfilter,
7618+
data:item
7619+
});
7620+
7621+
}
7622+
});
7623+
}
7624+
},
7625+
75757626
enable: {
75767627
label: 'label.action.enable.cluster',
75777628
messages: {
@@ -7741,6 +7792,8 @@
77417792
podname: { label: 'label.pod' },
77427793
hypervisortype: { label: 'label.hypervisor' },
77437794
clustertype: { label: 'label.cluster.type' },
7795+
cpuovercommitratio:{ label: 'CPU overcommit Ratio', isEditable:true},
7796+
ramovercommitratio:{ label: 'RAM overcommit Ratio', isEditable:true},
77447797
//allocationstate: { label: 'label.allocation.state' },
77457798
//managedstate: { label: 'Managed State' },
77467799
state: { label: 'label.state' }
@@ -10407,10 +10460,14 @@
1040710460
if(jsonObj.state == "Enabled") {//managed, allocation enabled
1040810461
allowedActions.push("unmanage");
1040910462
allowedActions.push("disable");
10463+
allowedActions.push("edit");
10464+
1041010465
}
1041110466
else if(jsonObj.state == "Disabled") { //managed, allocation disabled
1041210467
allowedActions.push("unmanage");
1041310468
allowedActions.push("enable");
10469+
allowedActions.push("edit");
10470+
1041410471
}
1041510472
else { //Unmanaged, PrepareUnmanaged , PrepareUnmanagedError
1041610473
allowedActions.push("manage");

0 commit comments

Comments
 (0)