Skip to content

Commit fbf007e

Browse files
committed
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
2 parents d5377b0 + 97d9862 commit fbf007e

1 file changed

Lines changed: 63 additions & 2 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3698,7 +3698,67 @@
36983698
poll: pollAsyncJobResult
36993699
}
37003700
},
3701-
3701+
3702+
changeService: {
3703+
label: 'label.change.service.offering',
3704+
createForm: {
3705+
title: 'label.change.service.offering',
3706+
desc: '',
3707+
fields: {
3708+
serviceOfferingId: {
3709+
label: 'label.compute.offering',
3710+
select: function(args) {
3711+
var apiCmd = "listServiceOfferings&issystem=true";
3712+
if(args.context.systemVMs[0].systemvmtype == "secondarystoragevm")
3713+
apiCmd += "&systemvmtype=secondarystoragevm";
3714+
else if(args.context.systemVMs[0].systemvmtype == "consoleproxy")
3715+
apiCmd += "&systemvmtype=consoleproxy";
3716+
$.ajax({
3717+
url: createURL(apiCmd),
3718+
dataType: "json",
3719+
async: true,
3720+
success: function(json) {
3721+
var serviceofferings = json.listserviceofferingsresponse.serviceoffering;
3722+
var items = [];
3723+
$(serviceofferings).each(function() {
3724+
if(this.id != args.context.systemVMs[0].serviceofferingid) {
3725+
items.push({id: this.id, description: this.displaytext});
3726+
}
3727+
});
3728+
args.response.success({data: items});
3729+
}
3730+
});
3731+
}
3732+
}
3733+
}
3734+
},
3735+
messages: {
3736+
notification: function(args) {
3737+
return 'label.change.service.offering';
3738+
}
3739+
},
3740+
action: function(args) {
3741+
$.ajax({
3742+
url: createURL("changeServiceForSystemVm&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId),
3743+
dataType: "json",
3744+
async: true,
3745+
success: function(json) {
3746+
var jsonObj = json.changeserviceforsystemvmresponse.systemvm;
3747+
args.response.success({data: jsonObj});
3748+
},
3749+
error: function(XMLHttpResponse) {
3750+
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
3751+
args.response.error(errorMsg);
3752+
}
3753+
});
3754+
},
3755+
notification: {
3756+
poll: function(args) {
3757+
args.complete();
3758+
}
3759+
}
3760+
},
3761+
37023762
remove: {
37033763
label: 'label.action.destroy.systemvm',
37043764
messages: {
@@ -7448,13 +7508,14 @@
74487508
if (jsonObj.state == 'Running') {
74497509
allowedActions.push("stop");
74507510
allowedActions.push("restart");
7451-
allowedActions.push("remove");
7511+
allowedActions.push("remove");
74527512
allowedActions.push("viewConsole");
74537513
if (isAdmin())
74547514
allowedActions.push("migrate");
74557515
}
74567516
else if (jsonObj.state == 'Stopped') {
74577517
allowedActions.push("start");
7518+
allowedActions.push("changeService");
74587519
allowedActions.push("remove");
74597520
}
74607521
else if (jsonObj.state == 'Error') {

0 commit comments

Comments
 (0)