CLOUDSTACK-3093: UI - Infrastructure menu - zone detail - physical network - network service providers - Internal LB VM - add migrate, view console action.

This commit is contained in:
Jessica Wang 2013-07-02 14:57:27 -07:00
parent 05f4680735
commit f9de646c28
1 changed files with 93 additions and 1 deletions

View File

@ -3060,7 +3060,95 @@
notification: {
poll: pollAsyncJobResult
}
}
},
migrate: {
label: 'Migrate LB VM',
createForm: {
title: 'Migrate LB VM',
fields: {
hostId: {
label: 'label.host',
validation: { required: true },
select: function(args) {
$.ajax({
url: createURL("listHosts&VirtualMachineId=" + args.context.internallbinstances[0].id),
dataType: "json",
async: true,
success: function(json) {
var hostObjs = json.listhostsresponse.host;
var items = [];
$(hostObjs).each(function() {
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")")});
});
args.response.success({data: items});
}
});
},
error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
args.response.error(errorMsg);
}
}
}
},
messages: {
notification: function(args) {
return 'Migrate LB VM';
}
},
action: function(args) {
$.ajax({
url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.internallbinstances[0].id),
dataType: "json",
async: true,
success: function(json) {
var jid = json.migratesystemvmresponse.jobid;
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
//return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance
$.ajax({
url: createURL("listInternalLoadBalancerVMs&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id),
dataType: "json",
async: false,
success: function(json) {
var items = json.listinternallbvmssresponse.internalloadbalancervm;
if(items != null && items.length > 0) {
return items[0];
}
}
});
},
getActionFilter: function() {
return internallbinstanceActionfilter;
}
}
});
}
});
},
notification: {
poll: pollAsyncJobResult
}
},
viewConsole: {
label: 'label.view.console',
action: {
externalLink: {
url: function(args) {
return clientConsoleUrl + '?cmd=access&vm=' + args.context.internallbinstances[0].id;
},
title: function(args) {
return args.context.internallbinstances[0].id.substr(0,8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error.
},
width: 820,
height: 640
}
}
}
},
tabs: {
details: {
@ -14752,6 +14840,10 @@
if (jsonObj.state == 'Running') {
allowedActions.push("stop");
allowedActions.push("viewConsole");
if (isAdmin())
allowedActions.push("migrate");
}
else if (jsonObj.state == 'Stopped') {
allowedActions.push("start");