mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
bug 14539: cloudstack 3.0 UI - system VM page - add "change service offering" action which shows when systemVM state is Stopped.
This commit is contained in:
parent
581640147c
commit
97d9862de7
@ -3699,6 +3699,66 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
changeService: {
|
||||||
|
label: 'label.change.service.offering',
|
||||||
|
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.displaytext});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
args.response.success({data: items});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
notification: function(args) {
|
||||||
|
return 'label.change.service.offering';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("changeServiceForSystemVm&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId),
|
||||||
|
dataType: "json",
|
||||||
|
async: true,
|
||||||
|
success: function(json) {
|
||||||
|
var jsonObj = json.changeserviceforsystemvmresponse.systemvm;
|
||||||
|
args.response.success({data: jsonObj});
|
||||||
|
},
|
||||||
|
error: function(XMLHttpResponse) {
|
||||||
|
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
|
||||||
|
args.response.error(errorMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
notification: {
|
||||||
|
poll: function(args) {
|
||||||
|
args.complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
remove: {
|
remove: {
|
||||||
label: 'label.action.destroy.systemvm',
|
label: 'label.action.destroy.systemvm',
|
||||||
messages: {
|
messages: {
|
||||||
@ -7455,6 +7515,7 @@
|
|||||||
}
|
}
|
||||||
else if (jsonObj.state == 'Stopped') {
|
else if (jsonObj.state == 'Stopped') {
|
||||||
allowedActions.push("start");
|
allowedActions.push("start");
|
||||||
|
allowedActions.push("changeService");
|
||||||
allowedActions.push("remove");
|
allowedActions.push("remove");
|
||||||
}
|
}
|
||||||
else if (jsonObj.state == 'Error') {
|
else if (jsonObj.state == 'Error') {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user