Updated Branches:
  refs/heads/master 5dc1d468f -> 3605ee556

cloudstack UI - advanced search - implement advanced search on ISO 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/3605ee55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/3605ee55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/3605ee55

Branch: refs/heads/master
Commit: 3605ee5564af9fd6c69aa8a39fbc3d006a0108e8
Parents: 5dc1d46
Author: Jessica Wang <[email protected]>
Authored: Wed Oct 3 15:55:05 2012 -0700
Committer: Jessica Wang <[email protected]>
Committed: Wed Oct 3 15:56:42 2012 -0700

----------------------------------------------------------------------
 ui/scripts/templates.js |   68 ++++++++++++++++++++++++++++++------------
 1 files changed, 49 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3605ee55/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index efb1b6d..a9fb371 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -907,43 +907,73 @@
             }
           },
 
+                                       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 array1 = [];
+                                         var data = {};
+                                               listViewDataProvider(args, 
data);               
+                                                          
             var ignoreProject = false;
-            if(args.filterBy != null) {
+            if(args.filterBy != null) {        //filter dropdown
               if(args.filterBy.kind != null) {
                 switch(args.filterBy.kind) {
                 case "all":
                   ignoreProject = true;
-                  array1.push("&isofilter=all");
+                                                                       
$.extend(data, {
+                                                                         
isofilter: 'all'
+                                                                       });  
                   break;
                 case "mine":
-                  array1.push("&isofilter=self");
+                                                                 
$.extend(data, {
+                                                                         
isofilter: 'self'
+                                                                       });  
                   break;
                 case "featured":
                   ignoreProject = true;
-                  array1.push("&isofilter=featured");
+                                                                       
$.extend(data, {
+                                                                         
isofilter: 'featured'
+                                                                       });     
               
                   break;
                 case "community":
                   ignoreProject = true;
-                  array1.push("&isofilter=community");
-                  break;
-                }
-              }
-              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);
+                                                                       
$.extend(data, {
+                                                                         
isofilter: 'community'
+                                                                       });     
               
                   break;
                 }
-              }
-            }
+              }              
+            }          
 
             $.ajax({
-              url: createURL("listIsos&page=" + args.page + "&pagesize=" + 
pageSize + array1.join(""), { ignoreProject: ignoreProject }),
-              dataType: "json",
-              async: true,
+              url: createURL('listIsos', { ignoreProject: ignoreProject }),
+              data: data,      
               success: function(json) {
                 var items = json.listisosresponse.iso;
                 args.response.success({

Reply via email to