Updated Branches:
  refs/heads/master ea9166248 -> 3e1957933

cloudstack UI - advanced search - implement advanced search on VPC page.


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

Branch: refs/heads/master
Commit: 3e1957933e9e7491c659fc981f812c154a72a499
Parents: ea91662
Author: Jessica Wang <[email protected]>
Authored: Wed Oct 3 14:58:16 2012 -0700
Committer: Jessica Wang <[email protected]>
Committed: Wed Oct 3 15:03:05 2012 -0700

----------------------------------------------------------------------
 ui/scripts/network.js |   55 ++++++++++++++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e195793/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index c4306e5..881c002 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -339,7 +339,8 @@
                         $.ajax({
                           url: createURL('listVPCs'),
                           data: {
-                            listAll: true
+                            listAll: true,
+                                                                               
                                details: 'min'
                           },
                           success: function(json) {
                             var items = json.listvpcsresponse.vpc;
@@ -3619,23 +3620,43 @@
             cidr: { label: 'label.cidr' },
             state: {label: 'label.state', indicator: { 'Enabled': 'on', 
'Disabled': 'off'}}
           },
-          dataProvider: function(args) {            
-                                               var array1 = [];  
-                                               if(args.filterBy != null) {     
     
-                                                       if(args.filterBy.search 
!= null && args.filterBy.search.by != null && args.filterBy.search.value != 
null) {
-                                                               
switch(args.filterBy.search.by) {
-                                                               case "name":
-                                                                       
if(args.filterBy.search.value.length > 0)
-                                                                               
array1.push("&keyword=" + args.filterBy.search.value);
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                               
+                                                                               
+                                       advSearchFields: {
+                                         name: { label: 'Name' },
+                                               zoneid: { 
+                                                 label: 'Zone',                
                                        
+              select: function(args) {                                         
                                                
+                                                               $.ajax({
+                                                                       url: 
createURL('listZones'),
+                                                                       data: {
+                                                                         
listAll: true
+                                                                       },
+                                                                       
success: function(json) {                                                       
                  
+                                                                               
var zones = json.listzonesresponse.zone;
+
+                                                                               
args.response.success({
+                                                                               
        data: $.map(zones, function(zone) {
+                                                                               
                return {
+                                                                               
                        id: zone.id,
+                                                                               
                        description: zone.name
+                                                                               
                };
+                                                                               
        })
+                                                                               
});
+                                                                       }
+                                                               });
+                                                       }                       
                        
+                                               },                              
                                        
+                                               tagKey: { label: 'Tag Key' },
+                                               tagValue: { label: 'Tag Value' 
}                                                
+                                       },                                      
+                                       
+          dataProvider: function(args) {
+            var data = {};
+                                               listViewDataProvider(args, 
data);                       
+
             $.ajax({
-              url: createURL("listVPCs&listAll=true&page=" + args.page + 
"&pagesize=" + pageSize + array1.join("")),
-              dataType: "json",
-              async: true,
+              url: createURL('listVPCs'),
+              data: data,              
               success: function(json) {
                 var items = json.listvpcsresponse.vpc; 
                 args.response.success({data:items});

Reply via email to