CLOUDSTACK-3093: UI - Infrastructure menu - zone detail - physical network - network service providers - Internal LB VM - add migrate, view console action.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f9de646c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f9de646c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f9de646c Branch: refs/heads/vmsync Commit: f9de646c284bc5593497de2c3952fbc736812ab4 Parents: 05f4680 Author: Jessica Wang <jessicaw...@apache.org> Authored: Tue Jul 2 14:57:27 2013 -0700 Committer: Jessica Wang <jessicaw...@apache.org> Committed: Tue Jul 2 14:59:14 2013 -0700 ---------------------------------------------------------------------- ui/scripts/system.js | 94 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f9de646c/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 0c776e2..496f585 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -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");