Skip to content

Commit 39e6e7f

Browse files
author
Jessica Wang
committed
CLOUDSTACK-3093: UI - Infrastructure menu - zone detail - physical network - network service providers - Internal LB VM - add migrate, view console action.
1 parent c6961ef commit 39e6e7f

1 file changed

Lines changed: 93 additions & 1 deletion

File tree

‎ui/scripts/system.js‎

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3060,7 +3060,95 @@
30603060
notification: {
30613061
poll: pollAsyncJobResult
30623062
}
3063-
}
3063+
},
3064+
3065+
migrate: {
3066+
label: 'Migrate LB VM',
3067+
createForm: {
3068+
title: 'Migrate LB VM',
3069+
fields: {
3070+
hostId: {
3071+
label: 'label.host',
3072+
validation: { required: true },
3073+
select: function(args) {
3074+
$.ajax({
3075+
url: createURL("listHosts&VirtualMachineId=" + args.context.internallbinstances[0].id),
3076+
dataType: "json",
3077+
async: true,
3078+
success: function(json) {
3079+
var hostObjs = json.listhostsresponse.host;
3080+
var items = [];
3081+
$(hostObjs).each(function() {
3082+
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")")});
3083+
});
3084+
args.response.success({data: items});
3085+
}
3086+
});
3087+
},
3088+
error: function(XMLHttpResponse) {
3089+
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
3090+
args.response.error(errorMsg);
3091+
}
3092+
}
3093+
}
3094+
},
3095+
messages: {
3096+
notification: function(args) {
3097+
return 'Migrate LB VM';
3098+
}
3099+
},
3100+
action: function(args) {
3101+
$.ajax({
3102+
url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.internallbinstances[0].id),
3103+
dataType: "json",
3104+
async: true,
3105+
success: function(json) {
3106+
var jid = json.migratesystemvmresponse.jobid;
3107+
args.response.success({
3108+
_custom: {
3109+
jobId: jid,
3110+
getUpdatedItem: function(json) {
3111+
//return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance
3112+
$.ajax({
3113+
url: createURL("listInternalLoadBalancerVMs&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id),
3114+
dataType: "json",
3115+
async: false,
3116+
success: function(json) {
3117+
var items = json.listinternallbvmssresponse.internalloadbalancervm;
3118+
if(items != null && items.length > 0) {
3119+
return items[0];
3120+
}
3121+
}
3122+
});
3123+
},
3124+
getActionFilter: function() {
3125+
return internallbinstanceActionfilter;
3126+
}
3127+
}
3128+
});
3129+
}
3130+
});
3131+
},
3132+
notification: {
3133+
poll: pollAsyncJobResult
3134+
}
3135+
},
3136+
3137+
viewConsole: {
3138+
label: 'label.view.console',
3139+
action: {
3140+
externalLink: {
3141+
url: function(args) {
3142+
return clientConsoleUrl + '?cmd=access&vm=' + args.context.internallbinstances[0].id;
3143+
},
3144+
title: function(args) {
3145+
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.
3146+
},
3147+
width: 820,
3148+
height: 640
3149+
}
3150+
}
3151+
}
30643152
},
30653153
tabs: {
30663154
details: {
@@ -14797,6 +14885,10 @@
1479714885

1479814886
if (jsonObj.state == 'Running') {
1479914887
allowedActions.push("stop");
14888+
14889+
allowedActions.push("viewConsole");
14890+
if (isAdmin())
14891+
allowedActions.push("migrate");
1480014892
}
1480114893
else if (jsonObj.state == 'Stopped') {
1480214894
allowedActions.push("start");

0 commit comments

Comments
 (0)