mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-2113:System VM scaleUp UI support
This commit is contained in:
parent
b633353fff
commit
6bf67c9f68
|
|
@ -5424,6 +5424,83 @@
|
|||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
scaleUp:{
|
||||
label:'scaleUp System VM',
|
||||
createForm: {
|
||||
title: 'label.change.service.offering',
|
||||
desc: '',
|
||||
fields: {
|
||||
serviceOfferingId: {
|
||||
label: 'label.compute.offering',
|
||||
select: function(args) {
|
||||
var apiCmd = "listServiceOfferings&issystem=true";
|
||||
if(args.context.systemVMs[0].systemvmtype == "secondarystoragevm")
|
||||
apiCmd += "&systemvmtype=secondarystoragevm";
|
||||
else if(args.context.systemVMs[0].systemvmtype == "consoleproxy")
|
||||
apiCmd += "&systemvmtype=consoleproxy";
|
||||
$.ajax({
|
||||
url: createURL(apiCmd),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var serviceofferings = json.listserviceofferingsresponse.serviceoffering;
|
||||
var items = [];
|
||||
$(serviceofferings).each(function() {
|
||||
if(this.id != args.context.systemVMs[0].serviceofferingid) {
|
||||
items.push({id: this.id, description: this.name});
|
||||
}
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("scaleVirtualMachine&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.scalevirtualmachineresponse.jobid;
|
||||
args.response.success(
|
||||
{_custom:
|
||||
{jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
},
|
||||
getActionFilter: function() {
|
||||
return vmActionfilter;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
error:function(json){
|
||||
args.response.error(parseXMLHttpResponse(json));
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Do you really want to scale up the system VM ?';
|
||||
},
|
||||
notification: function(args) {
|
||||
|
||||
return 'System VM Scaled Up';
|
||||
}
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
viewConsole: {
|
||||
label: 'label.view.console',
|
||||
|
|
@ -6658,6 +6735,83 @@
|
|||
}
|
||||
},
|
||||
|
||||
scaleUp:{
|
||||
label:'scaleUp System VM',
|
||||
createForm: {
|
||||
title: 'label.change.service.offering',
|
||||
desc: '',
|
||||
fields: {
|
||||
serviceOfferingId: {
|
||||
label: 'label.compute.offering',
|
||||
select: function(args) {
|
||||
var apiCmd = "listServiceOfferings&issystem=true";
|
||||
if(args.context.systemVMs[0].systemvmtype == "secondarystoragevm")
|
||||
apiCmd += "&systemvmtype=secondarystoragevm";
|
||||
else if(args.context.systemVMs[0].systemvmtype == "consoleproxy")
|
||||
apiCmd += "&systemvmtype=consoleproxy";
|
||||
$.ajax({
|
||||
url: createURL(apiCmd),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var serviceofferings = json.listserviceofferingsresponse.serviceoffering;
|
||||
var items = [];
|
||||
$(serviceofferings).each(function() {
|
||||
if(this.id != args.context.systemVMs[0].serviceofferingid) {
|
||||
items.push({id: this.id, description: this.name});
|
||||
}
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("scaleVirtualMachine&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.scalevirtualmachineresponse.jobid;
|
||||
args.response.success(
|
||||
{_custom:
|
||||
{jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
},
|
||||
getActionFilter: function() {
|
||||
return vmActionfilter;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
error:function(json){
|
||||
args.response.error(parseXMLHttpResponse(json));
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Do you really want to scale up the system VM ?';
|
||||
},
|
||||
notification: function(args) {
|
||||
|
||||
return 'System VM Scaled Up';
|
||||
}
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
viewConsole: {
|
||||
label: 'label.view.console',
|
||||
action: {
|
||||
|
|
@ -11687,14 +11841,16 @@
|
|||
if (jsonObj.state == 'Running') {
|
||||
allowedActions.push("stop");
|
||||
allowedActions.push("restart");
|
||||
allowedActions.push("remove");
|
||||
allowedActions.push("remove");
|
||||
allowedActions.push("scaleUp");
|
||||
allowedActions.push("viewConsole");
|
||||
if (isAdmin())
|
||||
allowedActions.push("migrate");
|
||||
}
|
||||
else if (jsonObj.state == 'Stopped') {
|
||||
allowedActions.push("start");
|
||||
allowedActions.push("changeService");
|
||||
allowedActions.push("scaleUp");
|
||||
allowedActions.push("changeService");
|
||||
allowedActions.push("remove");
|
||||
}
|
||||
else if (jsonObj.state == 'Error') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue