mirror of https://github.com/apache/cloudstack.git
cloudstack 3.0 UI - infrastructure - zone detail - network service providers - VPC Virtual Router - Instances tab - detailView - add ChangeService action.
This commit is contained in:
parent
064198eef9
commit
5ec9cf3081
|
|
@ -2540,7 +2540,64 @@
|
|||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
changeService: {
|
||||
label: 'label.change.service.offering',
|
||||
createForm: {
|
||||
title: 'label.change.service.offering',
|
||||
desc: '',
|
||||
fields: {
|
||||
serviceOfferingId: {
|
||||
label: 'label.compute.offering',
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listServiceOfferings'),
|
||||
data: {
|
||||
issystem: true,
|
||||
systemvmtype: 'domainrouter'
|
||||
},
|
||||
success: function(json) {
|
||||
var serviceofferings = json.listserviceofferingsresponse.serviceoffering;
|
||||
var items = [];
|
||||
$(serviceofferings).each(function() {
|
||||
if(this.id != args.context.routers[0].serviceofferingid) {
|
||||
items.push({id: this.id, description: this.name}); //default one (i.e. "System Offering For Software Router") doesn't have displaytext property. So, got to use name property instead.
|
||||
}
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
notification: function(args) {
|
||||
return 'label.change.service.offering';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("changeServiceForRouter&id=" + args.context.routers[0].id + "&serviceofferingid=" + args.data.serviceOfferingId),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jsonObj = json.changeserviceforrouterresponse.domainrouter;
|
||||
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.destroy.router',
|
||||
messages: {
|
||||
|
|
@ -9512,7 +9569,10 @@
|
|||
if (jsonObj.state == 'Running') {
|
||||
allowedActions.push("stop");
|
||||
allowedActions.push("restart");
|
||||
//allowedActions.push("changeService");
|
||||
|
||||
if(jsonObj.vpcid != null)
|
||||
allowedActions.push("changeService");
|
||||
|
||||
allowedActions.push("viewConsole");
|
||||
if (isAdmin())
|
||||
allowedActions.push("migrate");
|
||||
|
|
@ -9520,7 +9580,9 @@
|
|||
else if (jsonObj.state == 'Stopped') {
|
||||
allowedActions.push("start");
|
||||
allowedActions.push("remove");
|
||||
//allowedActions.push("changeService");
|
||||
|
||||
if(jsonObj.vpcid != null)
|
||||
allowedActions.push("changeService");
|
||||
}
|
||||
return allowedActions;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue