mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
ACL DENY RULES UI-API Integration
This commit is contained in:
parent
7167bf4e67
commit
981b5ddd1b
@ -11828,13 +11828,15 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it
|
|||||||
|
|
||||||
.downloadVolume .icon,
|
.downloadVolume .icon,
|
||||||
.downloadTemplate .icon,
|
.downloadTemplate .icon,
|
||||||
.downloadISO .icon {
|
.downloadISO .icon,
|
||||||
|
.replaceacllist .icon {
|
||||||
background-position: -35px -125px;
|
background-position: -35px -125px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.downloadVolume:hover .icon,
|
.downloadVolume:hover .icon,
|
||||||
.downloadTemplate:hover .icon,
|
.downloadTemplate:hover .icon,
|
||||||
.downloadISO:hover .icon {
|
.downloadISO:hover .icon,
|
||||||
|
.replaceacllist:hover .icon {
|
||||||
background-position: -35px -707px;
|
background-position: -35px -707px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -276,7 +276,7 @@ cloudStack.actionFilter = {
|
|||||||
guestNetwork: function(args) {
|
guestNetwork: function(args) {
|
||||||
var jsonObj = args.context.item;
|
var jsonObj = args.context.item;
|
||||||
var allowedActions = [];
|
var allowedActions = [];
|
||||||
|
allowedActions.push('replaceacllist');
|
||||||
if(jsonObj.type == 'Isolated') {
|
if(jsonObj.type == 'Isolated') {
|
||||||
allowedActions.push('edit'); //only Isolated network is allowed to upgrade to a different network offering (Shared network is not allowed to)
|
allowedActions.push('edit'); //only Isolated network is allowed to upgrade to a different network offering (Shared network is not allowed to)
|
||||||
allowedActions.push('restart');
|
allowedActions.push('restart');
|
||||||
|
|||||||
@ -189,8 +189,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('createNetworkACL'),
|
url: createURL('createNetworkACL'),
|
||||||
data: $.extend(args.data, {
|
data: $.extend(args.data, {
|
||||||
networkid: args.context.networks ?
|
aclid: args.context.aclLists[0].id
|
||||||
args.context.networks[0].id : args.data.networkid
|
|
||||||
}),
|
}),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
@ -198,10 +197,11 @@
|
|||||||
_custom: {
|
_custom: {
|
||||||
jobId: data.createnetworkaclresponse.jobid,
|
jobId: data.createnetworkaclresponse.jobid,
|
||||||
getUpdatedItem: function(json) {
|
getUpdatedItem: function(json) {
|
||||||
var networkName = $multi.find('select[name=networkid] option[value=' + args.data.networkid + ']').html();
|
//var networkName = $multi.find('select[name=networkid] option[value=' + args.data.networkid + ']').html();
|
||||||
var data = $.extend(json.queryasyncjobresultresponse.jobresult.networkacl, {
|
/* var data = $.extend(json.queryasyncjobresultresponse.jobresult.networkacl, {
|
||||||
networkid: networkName
|
networkid: networkName
|
||||||
});
|
});*/
|
||||||
|
var data = json.queryasyncjobresultresponse.jobresult.networkacl;
|
||||||
var aclRules = $multi.data('acl-rules');
|
var aclRules = $multi.data('acl-rules');
|
||||||
|
|
||||||
aclRules.push(data);
|
aclRules.push(data);
|
||||||
@ -551,34 +551,88 @@
|
|||||||
id: 'aclLists',
|
id: 'aclLists',
|
||||||
fields: {
|
fields: {
|
||||||
name: { label: 'label.name' },
|
name: { label: 'label.name' },
|
||||||
total: { label: 'label.total' }
|
id: { label: 'id' }
|
||||||
},
|
},
|
||||||
dataProvider: function(args) {
|
dataProvider: function(args) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url:createURL('listNetworkACLLists&vpc_id=' + args.context.vpc[0].id),
|
||||||
|
success:function(json){
|
||||||
|
var items = json.listnetworkacllistsresponse.networkacllist;
|
||||||
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
data: [
|
data:items
|
||||||
{ name: 'ACL list 1', total: 3 },
|
|
||||||
{ name: 'ACL list 2', total: 2 }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
actions:{
|
||||||
|
add:{
|
||||||
|
label:'Add ACL List',
|
||||||
|
createForm:{
|
||||||
|
label: 'Add ACL List',
|
||||||
|
fields:{
|
||||||
|
name:{label:'ACL List Name',validation:{required:true}},
|
||||||
|
description:{label:'Description',validation:{required:true}}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
notification: function(args) {
|
||||||
|
return 'Add Network ACL List';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action:function(args){
|
||||||
|
var data = {
|
||||||
|
name:args.data.name,
|
||||||
|
description:args.data.description
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url:createURL('createNetworkACLList&vpcid='+ args.context.vpc[0].id),
|
||||||
|
data:data,
|
||||||
|
success:function(json){
|
||||||
|
var items = json.createnetworkacllistresponse;
|
||||||
|
args.response.success({
|
||||||
|
data:items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
detailView: {
|
detailView: {
|
||||||
isMaximized: true,
|
isMaximized: true,
|
||||||
tabs: {
|
tabs: {
|
||||||
details: {
|
/* details: {
|
||||||
|
|
||||||
title: 'label.details',
|
title: 'label.details',
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: { label: 'label.name', isEditable: true }
|
name: { label: 'label.name', isEditable: true },
|
||||||
|
id: {label:'id'}
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
dataProvider: function(args) {
|
dataProvider: function(args) {
|
||||||
args.response.success({ data: args.context.aclLists[0] });
|
$.ajax({
|
||||||
|
url:createURL('listNetworkACLs&aclid=' + args.context.aclLists[0].id),
|
||||||
|
success:function(json){
|
||||||
|
var items = json.listnetworkaclsresponse.networkacl;
|
||||||
|
args.response.success({
|
||||||
|
data:items
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
},*/
|
||||||
|
|
||||||
aclRules: {
|
aclRules: {
|
||||||
title: 'label.acl.rules',
|
title: 'ACL List Rules',
|
||||||
custom: function(args) {
|
custom: function(args) {
|
||||||
return $('<div>').multiEdit($.extend(true, {}, aclMultiEdit, {
|
return $('<div>').multiEdit($.extend(true, {}, aclMultiEdit, {
|
||||||
context: args.context,
|
context: args.context,
|
||||||
@ -586,9 +640,14 @@
|
|||||||
networkid: false
|
networkid: false
|
||||||
},
|
},
|
||||||
dataProvider: function(args) {
|
dataProvider: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url:createURL('listNetworkACLs&aclid=' + args.context.aclLists[0].id),
|
||||||
|
success:function(json){
|
||||||
|
var items = json.listnetworkaclsresponse.networkacl;
|
||||||
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
data: [
|
data:items
|
||||||
{
|
/* {
|
||||||
cidrlist: '10.1.1.0/24',
|
cidrlist: '10.1.1.0/24',
|
||||||
protocol: 'TCP',
|
protocol: 'TCP',
|
||||||
startport: 22, endport: 22,
|
startport: 22, endport: 22,
|
||||||
@ -602,7 +661,9 @@
|
|||||||
networkid: 0,
|
networkid: 0,
|
||||||
trafficType: 'Ingress'
|
trafficType: 'Ingress'
|
||||||
}
|
}
|
||||||
]
|
]*/
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@ -2232,6 +2293,75 @@
|
|||||||
notification: {
|
notification: {
|
||||||
poll: pollAsyncJobResult
|
poll: pollAsyncJobResult
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
replaceacllist:{
|
||||||
|
|
||||||
|
label:'Replace ACL List',
|
||||||
|
createForm:{
|
||||||
|
title:'Replace ACL List',
|
||||||
|
label:'Replace ACL List',
|
||||||
|
fields:{
|
||||||
|
aclid:{
|
||||||
|
label:'ACL',
|
||||||
|
select:function(args){
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listNetworkACLLists'),
|
||||||
|
dataType: 'json',
|
||||||
|
async: true,
|
||||||
|
success: function(json) {
|
||||||
|
var objs = json.listnetworkacllistsresponse.networkacllist;
|
||||||
|
var items = [];
|
||||||
|
$(objs).each(function() {
|
||||||
|
|
||||||
|
items.push({id: this.id, description: this.name});
|
||||||
|
});
|
||||||
|
args.response.success({data: items});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("replaceNetworkACLList&networkid=" + args.context.networks[0].id + "&aclid=" + args.data.aclid ),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
var jid = json.replacenetworkacllistresponse.jobid;
|
||||||
|
args.response.success(
|
||||||
|
|
||||||
|
{_custom:
|
||||||
|
{
|
||||||
|
jobId: jid,
|
||||||
|
getUpdatedItem: function(json) {
|
||||||
|
var item = json.queryasyncjobresultresponse.jobresult.aclid;
|
||||||
|
return {data:item};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
error:function(json){
|
||||||
|
|
||||||
|
args.response.error(parseXMLHttpResponse(json));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
notification: {
|
||||||
|
poll: pollAsyncJobResult
|
||||||
|
},
|
||||||
|
|
||||||
|
messages: {
|
||||||
|
confirm: function(args) {
|
||||||
|
return 'Do you want to replace the ACL with a new one ?';
|
||||||
|
},
|
||||||
|
notification: function(args) {
|
||||||
|
return 'ACL replaced';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user