You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2012/10/06 00:32:45 UTC

[31/49] git commit: cloudstack UI - add advanced search on Event page.

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

Branch: refs/heads/maven-to-rpm
Commit: 80b9f4a7a82d7b55315f43cc8321169e5ee05a32
Parents: 1828358
Author: Jessica Wang <je...@citrix.com>
Authored: Thu Oct 4 15:33:15 2012 -0700
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Sat Oct 6 00:30:27 2012 +0200

----------------------------------------------------------------------
 ui/scripts/events.js |   75 ++++++++++++++++++++++++++++++++++++--------
 1 files changed, 61 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/80b9f4a7/ui/scripts/events.js
----------------------------------------------------------------------
diff --git a/ui/scripts/events.js b/ui/scripts/events.js
index ab7a667..a8e7085 100644
--- a/ui/scripts/events.js
+++ b/ui/scripts/events.js
@@ -36,27 +36,74 @@
           label: 'label.menu.events',
           fields: {            
             description: { label: 'label.description' },
+						level: { label: 'label.level' },
             domain: { label: 'label.domain' },
 						account: { label: 'label.account' },
             created: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
           },
-          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: {	
+            level: {
+						  label: 'label.level',
+							select: function(args) {
+							  args.response.success({
+									data: [
+									  {id: '', description: ''}, 
+									  {id: 'INFO', description: 'INFO'}, 
+										{id: 'WARN', description: 'WARN'}, 
+										{id: 'ERROR', description: 'ERROR'}
+									]
+								});
 							}
-						}
+						},					
+						domainid: {					
+							label: 'Domain',					
+							select: function(args) {
+								$.ajax({
+									url: createURL('listDomains'),
+									data: { 
+										listAll: true,
+										details: 'min'
+									},
+									success: function(json) {
+										var array1 = [{id: '', description: ''}];
+										var domains = json.listdomainsresponse.domain;
+										if(domains != null && domains.length > 0) {
+											for(var i = 0; i < domains.length; i++) {
+												array1.push({id: domains[i].id, description: domains[i].path});
+											}
+										}
+										args.response.success({
+											data: array1
+										});
+									}
+								});
+							},
+							isHidden: function(args) {
+								if(isAdmin() || isDomainAdmin())
+									return false;
+								else
+									return true;
+							}
+						},		
+						account: { 
+							label: 'Account',
+							isHidden: function(args) {
+								if(isAdmin() || isDomainAdmin())
+									return false;
+								else
+									return true;
+							}			
+						}											
+					},						
+					
+          dataProvider: function(args) {					  
+						var data = {};
+						listViewDataProvider(args, data);						
 						
             $.ajax({
-              url: createURL("listEvents&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
-              dataType: "json",
-              async: true,
+              url: createURL('listEvents'),
+              data: data,              
               success: function(json) {
                 var items = json.listeventsresponse.event;
                 args.response.success({data:items});