ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-ranger git commit: RNAGER-203: UI fixes to address the following: 1) drop-down in policy search page now incldues resource of the service-type 2) audit page fixed to show repository type and name correctly
Date Thu, 05 Feb 2015 19:16:27 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/stack 93e578d48 -> 145fe6d6e


RNAGER-203: UI fixes to address the following: 1) drop-down in policy search page now incldues
resource of the service-type 2) audit page fixed to show repository type and name correctly


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/145fe6d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/145fe6d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/145fe6d6

Branch: refs/heads/stack
Commit: 145fe6d6ef5b1e71498657031943aa1b728a1cb9
Parents: 93e578d
Author: Gautam Borad <gborad@gmail.com>
Authored: Thu Feb 5 11:13:52 2015 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Thu Feb 5 11:13:52 2015 -0800

----------------------------------------------------------------------
 .../src/main/webapp/scripts/utils/XAUtils.js    |  5 +-
 .../views/policies/RangerPolicyTableLayout.js   | 11 +++-
 .../webapp/scripts/views/reports/AuditLayout.js | 55 +++++++++++---------
 3 files changed, 43 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/145fe6d6/security-admin/src/main/webapp/scripts/utils/XAUtils.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index f90a3e6..2acef28 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -527,7 +527,7 @@ define(function(require) {
 	        						} 
 	        					});
 	        					//visualSearch.options.readOnly = searchOptTemp.length <= 0 ? true : false;
-	        					callback(searchOptTemp);
+	        					callback(searchOptTemp,{preserveOrder : false});
 	        				},
 	        removedFacet : function(removedFacet,searchCollection,indexObj){
 					        	//console.log(removedFacet);
@@ -735,6 +735,9 @@ define(function(require) {
 	XAUtils.capitaliseFirstLetter = function (string){
 	    return string.charAt(0).toUpperCase() + string.slice(1);
 	};
+	XAUtils.lowerCaseFirstLetter = function (string){
+	    return string.charAt(0).toLowerCase() + string.slice(1);
+	};
 	XAUtils.getServicePoliciesURL = function(serviceId) {
 		return "service/plugins/policies/service/"+serviceId;
 	};

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/145fe6d6/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
index a805e27..702d79f 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
@@ -308,12 +308,19 @@ define(function(require){
 		},
 		addVisualSearch : function(){
 			var that = this;
+			var resourceSearchOpt = _.map(this.rangerServiceDefModel.get('resources'), function(resource){
return XAUtil.capitaliseFirstLetter(resource.name) });
+	
 			var searchOpt = ['Policy Name','Group Name','User Name','Status'];//,'Start Date','End
Date','Today'];
+			searchOpt = _.union(searchOpt, resourceSearchOpt)
 			var serverAttrName  = [{text : "Policy Name", label :"policyName"},{text : "Group Name",
label :"group"},
 			                        {text : "User Name", label :"user"}, {text : "Status", label :"status"}];
 			                     // {text : 'Start Date',label :'startDate'},{text : 'End Date',label
:'endDate'},
 				                 //  {text : 'Today',label :'today'}];
-									
+			var serverRsrcAttrName = _.map(resourceSearchOpt,function(opt){ 
+				return { 'text': XAUtil.capitaliseFirstLetter(opt), 
+					'label': 'resource:'+XAUtil.lowerCaseFirstLetter(opt) }; 
+			});
+			serverAttrName = _.union(serverAttrName, serverRsrcAttrName)
 			var pluginAttr = {
 				      placeholder :localization.tt('h.searchForPolicy'),
 				      container : this.ui.visualSearch,
@@ -322,7 +329,7 @@ define(function(require){
 				    	  valueMatches :function(facet, searchTerm, callback) {
 								switch (facet) {
 									case 'Status':
-										callback(this.getActiveStatusNVList());
+										callback(that.getActiveStatusNVList());
 										break;
 								/*	case 'Audit Status':
 										callback(XAUtil.enumToSelectLabelValuePairs(XAEnums.AuthType));

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/145fe6d6/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
index 2c79ed2..e8496db 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -108,6 +108,7 @@ define(function(require) {
 			this.currentTab = '#'+this.tab;
 			var date = new Date().toString();
 			this.timezone = date.replace(/^.*GMT.*\(/, "").replace(/\)$/, "");
+			this.initializeServiceDefColl();
 		},
 
 		/** all events binding here */
@@ -132,6 +133,14 @@ define(function(require) {
 				//that.onSearch();
 			},XAGlobals.settings.AUDIT_REPORT_POLLING);
 		},
+		initializeServiceDefColl : function() {
+			this.serviceDefList 			= new RangerServiceDefList();
+			this.serviceDefList.fetch({ 
+				cache : false,
+				async:false
+			});
+			return this.serviceDefList;
+		},
 		/** on render callback */
 		onRender : function() {
 			this.initializePlugins();
@@ -260,8 +269,7 @@ define(function(require) {
 		},
 		addSearchForBigDataTab :function(){
 			var that = this;
-			var serviceDefList = this.getServiceDefList();
-			var serverListForRepoType =  serviceDefList.map(function(serviceDef){ return {'label'
: serviceDef.get('name').toUpperCase(), 'value' : serviceDef.get('id')}; })
+			var serverListForRepoType =  this.serviceDefList.map(function(serviceDef){ return {'label'
: serviceDef.get('name').toUpperCase(), 'value' : serviceDef.get('id')}; })
 			var serverAttrName = [{text : 'Start Date',label :'startDate'},{text : 'End Date',label
:'endDate'},
 			                      {text : 'Today',label :'today'},{text : 'User',label :'requestUser'},
 			                      {text : 'Resource Name',label :'resourcePath'},{text : 'Policy ID',label
:'policyId'},
@@ -299,7 +307,7 @@ define(function(require) {
 								});
 								break;
 							case 'Repository Type':
-								var serviceList =  serviceDefList.map(function(serviceDef){ return {'label' : serviceDef.get('name').toUpperCase(),
'value' : serviceDef.get('name').toUpperCase()}; })
+								var serviceList =  that.serviceDefList.map(function(serviceDef){ return {'label'
: serviceDef.get('name').toUpperCase(), 'value' : serviceDef.get('name').toUpperCase()}; })
 								callback(serviceList);
 								break;
 							case 'Result':
@@ -332,15 +340,6 @@ define(function(require) {
 			};
 			this.visualSearch = XAUtils.addVisualSearch(searchOpt,serverAttrName, this.accessAuditList,
pluginAttr);
 		},
-		getServiceDefList : function() {
-			var serviceList=[];
-			var serviceDefList 			= new RangerServiceDefList();
-			serviceDefList.fetch({ 
-				cache : false,
-				async:false
-			});
-			return serviceDefList;
-		},
 		addSearchForAdminTab : function(){
 			var that = this;
 			//var searchOpt = _.pluck(this.getAdminTableColumns(), 'label');
@@ -733,16 +732,22 @@ define(function(require) {
 			var that = this;
 			var cols = {
 					policyId : {
-						cell : "uri",
-						href: function(model){
-							var rangerService = new RangerService();
-							rangerService.urlRoot += '/name/'+model.get('repoName'); 
-							rangerService.fetch({
-							  cache : false,
-							  async : false
-							});
-							return '#!/service/'+rangerService.get('id')+'/policies/'+model.get('policyId')+'/edit';
-						},
+						cell : "html",
+						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+							fromRaw: function (rawValue, model) {
+								if(rawValue == -1){
+									return rawValue;
+								}	
+								var rangerService = new RangerService();
+								rangerService.urlRoot += '/name/'+model.get('repoName'); 
+								rangerService.fetch({
+								  cache : false,
+								  async : false
+								});
+								var href = '#!/service/'+rangerService.get('id')+'/policies/'+model.get('policyId')+'/edit';
+								return '<a href="'+href+'" title="'+rawValue+'">'+rawValue+'</a>';
+							}
+						}),
 						label	: localization.tt("lbl.policyId"),
 						editable: false,
 						sortable : false
@@ -780,10 +785,10 @@ define(function(require) {
 							fromRaw: function (rawValue, model) {
 								var html='';
 								var repoType = model.get('repoType');
-								_.each(_.toArray(XAEnums.AssetType),function(m){
-									if(parseInt(repoType) == m.value){
+								that.serviceDefList.each(function(m){
+									if(parseInt(repoType) == m.id){
 										html =  '<div title="'+rawValue+'">'+rawValue+'</div>\
-										<div title="'+rawValue+'" style="border-top: 1px solid #ddd;">'+m.label+'</div>';
+										<div title="'+rawValue+'" style="border-top: 1px solid #ddd;">'+m.get('name')+'</div>';
 										return ;
 									}	
 								});


Mime
View raw message