You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2012/10/04 01:07:34 UTC

git commit: cloudstack UI - advanced search - implement advanced search on project page.

Updated Branches:
  refs/heads/master d9f52a6db -> b8a3524d2


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

Branch: refs/heads/master
Commit: b8a3524d2e21c111fda35c25533a8d9c0fbb8f62
Parents: d9f52a6
Author: Jessica Wang <je...@citrix.com>
Authored: Wed Oct 3 16:06:03 2012 -0700
Committer: Jessica Wang <je...@citrix.com>
Committed: Wed Oct 3 16:07:16 2012 -0700

----------------------------------------------------------------------
 ui/scripts/projects.js |   55 +++++++++++++++++++++++++++++--------------
 1 files changed, 37 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b8a3524d/ui/scripts/projects.js
----------------------------------------------------------------------
diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js
index bb73ce1..8280cf0 100644
--- a/ui/scripts/projects.js
+++ b/ui/scripts/projects.js
@@ -622,29 +622,48 @@
             }
           },
 
+					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 = [];
-            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;
-                }
-              }
-            }
-
-            var apiCmd = "listProjects&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + '&listAll=true';
-
+            var data = {};
+						listViewDataProvider(args, data);						
+           
             if (isDomainAdmin()) {
-                apiCmd += '&domainid=' + args.context.users[0].domainid;
+						  $.extend(data, {
+							  domainid: args.context.users[0].domainid
+							});
             }
             
             $.ajax({
-              url: createURL(apiCmd, { ignoreProject: true }),
-              dataType: 'json',
-              async: true,
+              url: createURL('listProjects', { ignoreProject: true }),
+              data: data,          
               success: function(data) {
                 args.response.success({
                   data: data.listprojectsresponse.project,