mirror of https://github.com/apache/cloudstack.git
bug 12249
Correctly filter VM list for port forwarding and load balancing, to only allow for stopped/running VMs, and only VMs within the specified network
This commit is contained in:
parent
a01f6b4981
commit
f8f1e538f8
|
|
@ -942,7 +942,32 @@
|
|||
|
||||
// Load balancing rules
|
||||
loadBalancing: {
|
||||
listView: cloudStack.sections.instances,
|
||||
listView: $.extend(true, {}, cloudStack.sections.instances, {
|
||||
listView: {
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listVirtualMachines'),
|
||||
data: {
|
||||
physicalnetworkid: args.context.ipAddresses[0].physicalnetworkid
|
||||
},
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(data) {
|
||||
args.response.success({
|
||||
data: $.grep(
|
||||
data.listvirtualmachinesresponse.virtualmachine,
|
||||
function(instance) {
|
||||
return $.inArray(instance.state, [
|
||||
'Destroyed'
|
||||
]) == -1;
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
multipleAdd: true,
|
||||
fields: {
|
||||
'name': { edit: true, label: 'Name' },
|
||||
|
|
@ -1080,7 +1105,32 @@
|
|||
|
||||
// Port forwarding rules
|
||||
portForwarding: {
|
||||
listView: cloudStack.sections.instances,
|
||||
listView: $.extend(true, {}, cloudStack.sections.instances, {
|
||||
listView: {
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listVirtualMachines'),
|
||||
data: {
|
||||
physicalnetworkid: args.context.ipAddresses[0].physicalnetworkid
|
||||
},
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(data) {
|
||||
args.response.success({
|
||||
data: $.grep(
|
||||
data.listvirtualmachinesresponse.virtualmachine,
|
||||
function(instance) {
|
||||
return $.inArray(instance.state, [
|
||||
'Destroyed'
|
||||
]) == -1;
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
fields: {
|
||||
'private-ports': {
|
||||
edit: true,
|
||||
|
|
|
|||
|
|
@ -430,6 +430,7 @@
|
|||
// from main instances list view
|
||||
var $listView;
|
||||
var instances = $.extend(true, {}, args.listView, {
|
||||
context: context,
|
||||
uiCustom: true
|
||||
});
|
||||
|
||||
|
|
@ -512,6 +513,7 @@
|
|||
complete: function(completeArgs) {
|
||||
complete(args);
|
||||
$loading.remove();
|
||||
$(window).trigger('cloudStack.fullRefresh');
|
||||
},
|
||||
|
||||
error: function(args) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue