mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +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
@ -3698,7 +3698,67 @@
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
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: {
|
||||
label: 'label.action.destroy.systemvm',
|
||||
messages: {
|
||||
@ -7448,13 +7508,14 @@
|
||||
if (jsonObj.state == 'Running') {
|
||||
allowedActions.push("stop");
|
||||
allowedActions.push("restart");
|
||||
allowedActions.push("remove");
|
||||
allowedActions.push("remove");
|
||||
allowedActions.push("viewConsole");
|
||||
if (isAdmin())
|
||||
allowedActions.push("migrate");
|
||||
}
|
||||
else if (jsonObj.state == 'Stopped') {
|
||||
allowedActions.push("start");
|
||||
allowedActions.push("changeService");
|
||||
allowedActions.push("remove");
|
||||
}
|
||||
else if (jsonObj.state == 'Error') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user