cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pran...@apache.org
Subject git commit: updated refs/heads/ui-vpc-redesign to 981b5dd
Date Mon, 20 May 2013 18:14:04 GMT
Updated Branches:
  refs/heads/ui-vpc-redesign 7167bf4e6 -> 981b5ddd1


ACL DENY RULES UI-API Integration


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/981b5ddd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/981b5ddd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/981b5ddd

Branch: refs/heads/ui-vpc-redesign
Commit: 981b5ddd1be845b3f73ce69325652cadabb72807
Parents: 7167bf4
Author: Pranav Saxena <pranav.saxena@citrix.com>
Authored: Mon May 20 23:42:55 2013 +0530
Committer: Pranav Saxena <pranav.saxena@citrix.com>
Committed: Mon May 20 23:42:55 2013 +0530

----------------------------------------------------------------------
 ui/css/cloudstack3.css        |    6 +-
 ui/scripts/sharedFunctions.js |    2 +-
 ui/scripts/vpc.js             |  176 +++++++++++++++++++++++++++++++-----
 3 files changed, 158 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/981b5ddd/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index 27841b0..549db37 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -11828,13 +11828,15 @@ div.ui-dialog div.autoscaler div.field-group div.form-container
form div.form-it
 
 .downloadVolume .icon,
 .downloadTemplate .icon,
-.downloadISO .icon {
+.downloadISO .icon,
+.replaceacllist .icon {
   background-position: -35px -125px;
 }
 
 .downloadVolume:hover .icon,
 .downloadTemplate:hover .icon,
-.downloadISO:hover .icon {
+.downloadISO:hover .icon,
+.replaceacllist:hover .icon {
   background-position: -35px -707px;
 }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/981b5ddd/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 0352990..d87f0dc 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -276,7 +276,7 @@ cloudStack.actionFilter = {
   guestNetwork: function(args) {    
     var jsonObj = args.context.item;
 		var allowedActions = [];
-    
+                allowedActions.push('replaceacllist');
 		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('restart');   

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/981b5ddd/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index df4664b..6ea41c9 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -189,8 +189,7 @@
         $.ajax({
           url: createURL('createNetworkACL'),
           data: $.extend(args.data, {
-            networkid: args.context.networks ?
-              args.context.networks[0].id : args.data.networkid
+            aclid: args.context.aclLists[0].id
           }),
           dataType: 'json',
           success: function(data) {
@@ -198,10 +197,11 @@
               _custom: {
                 jobId: data.createnetworkaclresponse.jobid,
                 getUpdatedItem: function(json) {
-                  var networkName = $multi.find('select[name=networkid] option[value=' +
args.data.networkid + ']').html();
-                  var data = $.extend(json.queryasyncjobresultresponse.jobresult.networkacl,
{
+                  //var networkName = $multi.find('select[name=networkid] option[value='
+ args.data.networkid + ']').html();
+                 /* var data = $.extend(json.queryasyncjobresultresponse.jobresult.networkacl,
{
                     networkid: networkName
-                  });
+                  });*/
+                  var data = json.queryasyncjobresultresponse.jobresult.networkacl; 
                   var aclRules = $multi.data('acl-rules');
                   
                   aclRules.push(data);
@@ -551,34 +551,88 @@
           id: 'aclLists',
           fields: {
             name: { label: 'label.name' },
-            total: { label: 'label.total' }
+            id: { label: 'id' }
           },
           dataProvider: function(args) {
-            args.response.success({
-              data: [
-                { name: 'ACL list 1', total: 3 },
-                { name: 'ACL list 2', total: 2 }
-              ]
-            });
+
+            $.ajax({
+
+            url:createURL('listNetworkACLLists&vpc_id=' + args.context.vpc[0].id),
+            success:function(json){  
+               var items = json.listnetworkacllistsresponse.networkacllist;
+ 
+               args.response.success({
+                 data:items
+                });
+             }
+           });
           },
+          
+         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: {
             isMaximized: true,
             tabs: {
-              details: {
+            /*  details: {
+              
                 title: 'label.details',
                 fields: [
                   {
-                    name: { label: 'label.name', isEditable: true }
+                    name: { label: 'label.name', isEditable: true },
+                    id: {label:'id'}
                   }
+ 
                 ],
                 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: {
-                title: 'label.acl.rules',
+                title: 'ACL List Rules',
                 custom: function(args) {
                   return $('<div>').multiEdit($.extend(true, {}, aclMultiEdit, {
                     context: args.context,
@@ -586,9 +640,14 @@
                       networkid: false
                     },
                     dataProvider: function(args) {
+                        $.ajax({
+                         url:createURL('listNetworkACLs&aclid=' + args.context.aclLists[0].id),
+                         success:function(json){
+                          var items = json.listnetworkaclsresponse.networkacl;
+
                       args.response.success({
-                        data: [
-                          {
+                        data:items
+                         /* {
                             cidrlist: '10.1.1.0/24',
                             protocol: 'TCP',
                             startport: 22, endport: 22,
@@ -602,9 +661,11 @@
                             networkid: 0,
                             trafficType: 'Ingress'
                           }
-                        ] 
+                        ]*/ 
                       });
-                    } 
+                    }
+                   });
+                  } 
                   }));
                 }
               }
@@ -2232,7 +2293,76 @@
             notification: {
               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';
+                    }
+                  }
+             } 
         },
 
         tabFilter: function(args) {


Mime
View raw message