ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From v..@apache.org
Subject [1/2] incubator-ranger git commit: RANGER-200: Pagination on Analytics Page (Gautam Borad via Velmurugan Periasamy)
Date Fri, 20 Mar 2015 08:19:20 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master 4bf8a3fae -> 85d5658fc


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/85d5658f/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js b/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
index de713d9..9e689c0 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
@@ -28,7 +28,9 @@ define(function(require) {'use strict';
 	var XATableLayout		= require('views/common/XATableLayout');
 	var localization		= require('utils/XALangSupport');
 	
-	var VXResourceList 		= require('collections/VXResourceList');
+	var RangerService		= require('models/RangerService');
+	var RangerServiceDefList= require('collections/RangerServiceDefList');
+	var RangerPolicyList	= require('collections/RangerPolicyList');
 	var UseraccesslayoutTmpl= require('hbs!tmpl/reports/UserAccessLayout_tmpl');
 
 	var UserAccessLayout 	= Backbone.Marionette.Layout.extend(
@@ -39,22 +41,21 @@ define(function(require) {'use strict';
 		template : UseraccesslayoutTmpl,
 		breadCrumbs : [XALinks.get('UserAccessReport')],
 		templateHelpers :function(){
-			return {groupList : this.groupList};
+			return {
+				groupList : this.groupList,
+				policyHeaderList : this.policyCollList
+			};
 		},
 
 		/** Layout sub regions */
-		regions : {
-			'rHdfsTableList'	: 'div[data-id="r_hdfsTable"]',
-			'rHiveTableList'	: 'div[data-id="r_hiveTable"]',
-			'rHbaseTableList'	: 'div[data-id="r_hbaseTable"]',
-			'rKnoxTableList'	: 'div[data-id="r_knoxTable"]',
-			'rStormTableList'	: 'div[data-id="r_stormTable"]',
-			'rHdfsTableSpinner' : '[data-id="r_hdfsTableSpinner"]',
-			'rHiveTableSpinner' : '[data-id="r_hiveTableSpinner"]',
-			'rHbaseTableSpinner': '[data-id="r_hbaseTableSpinner"]',
-			'rKnoxTableSpinner' : '[data-id="r_knoxTableSpinner"]',
-			'rStormTableSpinner': '[data-id="r_stormTableSpinner"]'
+		regions :function(){
+			var regions = {};
+			this.initializeRequiredData();
+			_.each(this.policyCollList, function(obj) {
+				regions[obj.collName+'Table'] =  'div[data-id="'+obj.collName+'"]';
+			},this)
 			
+			return regions;
 		},
 
 		/** ui selector cache */
@@ -99,24 +100,169 @@ define(function(require) {'use strict';
 		initialize : function(options) {
 			console.log("initialized a UserAccessLayout Layout");
 			_.extend(this, _.pick(options, 'groupList','userList'));
-			
-			var params = [];
-			this.hdfsResourceList = new VXResourceList();
-			this.hiveResourceList = new VXResourceList();
-			this.hbaseResourceList = new VXResourceList();
-			this.knoxResourceList = new VXResourceList();
-			this.stormResourceList = new VXResourceList();
 			this.bindEvents();
 			
-		},		   
+		},
+		initializeRequiredData : function() {
+			this.policyCollList = [];
+			this.initializeServiceDef();
+			this.serviceDefList.each(function(servDef) {
+				var serviceDefName = servDef.get('name')
+				var collName = serviceDefName +'PolicyList';
+				this[collName] = new RangerPolicyList();
+				this.defaultPageState = this[collName].state;
+				this.policyCollList.push({ 'collName' : collName, 'serviceDefName' : serviceDefName})
+			},this);
+		},
+		initializeServiceDef : function() {
+			   this.serviceDefList = new RangerServiceDefList();
+//			   this.serviceDefList.queryParams.sortBy = 'id';
+			   this.serviceDefList.fetch({
+				   cache : false,
+				   async:false
+			   });
+		},	   
 
 		/** all events binding here */
 		bindEvents : function() {
 			/*this.listenTo(this.model, "change:foo", this.modelChanged, this);*/
 			/*this.listenTo(communicator.vent,'someView:someEvent', this.someEventHandler, this)'*/
-			this.listenTo(this.hiveResourceList, "change:foo", function(){alert();}, this);
+//			this.listenTo(this.hiveResourceList, "change:foo", function(){alert();}, this);
 		},
 
+		onRender : function() {
+			this.initializePlugins();
+			this.setupGroupAutoComplete();
+			//Show policies listing for each service and GET policies for each service
+			_.each(this.policyCollList, function(obj,i){
+				this.renderTable(obj.collName, obj.serviceDefName);
+				this.getResourceLists(obj.collName,obj.serviceDefName);
+			},this);
+		},
+		
+		getResourceLists: function(collName, serviceDefName){
+			var that = this, coll = this[collName];
+			coll.queryParams.serviceType = serviceDefName;
+		/*	if(!_.isUndefined(params)){
+				_.each(params,function(val, attr){ 
+					if(!_.isUndefined(val) && !_.isEmpty(val)) 
+						coll.queryParams[attr] = val;
+				});
+			}*/
+			coll.fetch({
+				cache : false,
+				reset: true,
+				async:false,
+			}).done(function(){
+//				console.log(coll);
+				coll.trigger('sync')
+//				if(coll.queryParams.assetType == XAEnums.AssetType.ASSET_STORM.value){
+//					var totalRecords=0; 
+//					_.each(that.resourceList, function( list ){ totalRecords += list.state.totalRecords; });
+					/*that.$('[data-js="searchResult"]').html('Total '+totalRecords+' records found.');
+					that.$('[data-js="hdfsSearchResult"]').html(that.hdfsResourceList.state.totalRecords +' records found.');
+					that.$('[data-js="hiveSearchResult"]').html(that.hiveResourceList.state.totalRecords  +' records found.');
+					that.$('[data-js="hbaseSearchResult"]').html(that.hbaseResourceList.state.totalRecords +' records found.');
+					that.$('[data-js="knoxSearchResult"]').html(that.knoxResourceList.state.totalRecords +' records found.');
+					that.$('[data-js="stormSearchResult"]').html(that.stormResourceList.state.totalRecords +' records found.');*/
+//				}
+				XAUtil.blockUI('unblock');
+				
+			});
+		},
+		renderTable : function(collName){
+			var that = this, tableRegion  = this[collName+'Table'];
+			tableRegion.show(new XATableLayout({
+				columns: this.getColumns(this[collName]),
+				collection: this[collName],
+				includeFilter : false,
+				scrollToTop : false,
+				paginationCache : false,
+				gridOpts : {
+					row : 	Backgrid.Row.extend({}),
+					emptyText : 'No Policies found!'
+				}
+			}));
+		
+		},
+		getColumns : function(coll){
+			var that = this;
+			var cols = {
+				name : {
+					cell : "uri",
+					href: function(model){
+						var rangerService = new RangerService();
+						rangerService.urlRoot += '/name/'+model.get('service'); 
+						rangerService.fetch({
+						  cache : true,
+						  async : false
+						});
+						return '#!/service/'+rangerService.get('id')+'/policies/'+model.id+'/edit';
+					},
+					label	: localization.tt("lbl.policyName"),
+					editable: false,
+					sortable : false
+				},	
+				isEnabled:{
+					label:localization.tt('lbl.status'),
+					cell :"html",
+					editable:false,
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue) {
+							return rawValue ? '<label class="label label-success">Enabled</label>' : '<label class="label label-important">Disabled</label>';
+						}
+					}),
+					click : false,
+					drag : false,
+					sortable : false
+				},
+				isAuditEnabled:{
+					label:localization.tt('lbl.auditLogging'),
+					cell :"html",
+					editable:false,
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue) {
+							return rawValue ? '<label class="label label-success">Enabled</label>' : '<label class="label label-important">Disabled</label>';
+						}
+					}),
+					click : false,
+					drag : false,
+					sortable : false
+				},
+				policyItems : {
+					reName : 'groupName',
+					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
+					label : localization.tt("lbl.group"),
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue, model) {
+							if(!_.isUndefined(rawValue))
+								return XAUtil.showGroupsOrUsersForPolicy(rawValue, model);
+							else 
+								return '--';
+						}
+					}),
+					editable : false,
+					sortable : false
+				},
+				//Hack for backgrid plugin doesn't allow to have same column name 
+				guid : {
+					reName : 'userName',
+					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
+					label : localization.tt("lbl.users"),
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue, model) {
+							if(!_.isUndefined(rawValue))
+								return XAUtil.showGroupsOrUsersForPolicy(model.get('policyItems'), model, false);
+							else 
+								return '--';
+						}
+					}),
+					editable : false,
+					sortable : false
+				},
+			};
+			return coll.constructor.getTableCols(cols, coll);
+		},
 		/** on render callback */
 		setupGroupAutoComplete : function(){
 			//tags : true,
@@ -128,7 +274,7 @@ define(function(require) {'use strict';
 				return {id : m.id,text : m.get('name')};
 			}),*/
 			this.groupArr = this.groupList.map(function(m){
-				return { id : m.id , text : m.get('name')};
+				return { id : m.get('name') , text : m.get('name')};
 			});
 			var that = this, arr = [];
 			this.ui.userGroup.select2({
@@ -137,14 +283,14 @@ define(function(require) {'use strict';
 			//	maximumSelectionSize : 1,
 				width :'220px',
 				tokenSeparators: [",", " "],
-				tags : this.groupArr,
+				// tags : this.groupArr,
 				initSelection : function (element, callback) {
 					var data = [];
 					console.log(that.groupList);
 					
 					$(element.val().split(",")).each(function () {
 						var obj = _.findWhere(that.groupArr,{id:this});	
-						data.push({id: this, text: obj.text});
+						data.push({id: obj.text, text: obj.text});
 					});
 					callback(data);
 				},
@@ -159,10 +305,10 @@ define(function(require) {'use strict';
 						if(!_.isEmpty(that.ui.userGroup.val()))
 							selectedVals = that.ui.userGroup.val().split(',');
 						if(data.resultSize != "0"){
-								results = data.vXGroups.map(function(m, i){	return {id : (m.id).toString(), text: m.name};	});
-								if(!_.isEmpty(selectedVals))
-									results = XAUtil.filterResultByIds(results, selectedVals);
-								return {results : results};
+							results = data.vXGroups.map(function(m, i){	return {id : m.name, text: m.name};	});
+							if(!_.isEmpty(selectedVals))
+								results = XAUtil.filterResultByIds(results, selectedVals);
+							return {results : results};
 						}
 						return {results : results};
 					}
@@ -189,10 +335,10 @@ define(function(require) {'use strict';
 //				minimumInputLength: 1,
 				closeOnSelect : true,
 				placeholder : 'Select User',
-		//		maximumSelectionSize : 1,
+//				maximumSelectionSize : 1,
 				width :'220px',
 				tokenSeparators: [",", " "],
-				tags : this.userArr, 
+				// tags : this.userArr, 
 				initSelection : function (element, callback) {
 					var data = [];
 					$(element.val().split(",")).each(function () {
@@ -212,10 +358,10 @@ define(function(require) {'use strict';
 						if(!_.isEmpty(that.ui.userName.select2('val')))
 							selectedVals = that.ui.userName.select2('val');
 						if(data.resultSize != "0"){
-								results = data.vXUsers.map(function(m, i){	return {id : m.id+"", text: m.name};	});
-								if(!_.isEmpty(selectedVals))
-									results = XAUtil.filterResultByIds(results, selectedVals);
-								return {results : results};
+							results = data.vXUsers.map(function(m, i){	return {id : m.id+"", text: m.name};	});
+							if(!_.isEmpty(selectedVals))
+								results = XAUtil.filterResultByIds(results, selectedVals);
+							return {results : results};
 						}
 						return {results : results};
 					}
@@ -229,896 +375,8 @@ define(function(require) {'use strict';
 				formatNoMatches: function(result){
 					return 'No user found.';
 				}
-					
-			}).on('select2-focus', XAUtil.select2Focus);
-		},
-		getResourceLists: function(params){
-			var that = this;
-			
-			var resourceList = new VXResourceList();
-			if(!_.isUndefined(params)){
-				XAUtil.blockUI();
-				resourceList.setPageSize(200, {fetch : false});
-				resourceList.fetch({
-					data : params,
-					cache : false,
-					success : function(){
-						XAUtil.blockUI('unblock');
-					},
-					error : function(){XAUtil.blockUI('unblock');}
-				}).done(function(){
-					//console.log(resourceList);
-					XAUtil.blockUI('unblock');
-				//console.log(resourceList);
-				XAUtil.blockUI('unblock');
-				var obj = resourceList.groupBy('assetType');
-					var hdfsList = !_.isUndefined(obj[XAEnums.AssetType.ASSET_HDFS.value]) ? obj[XAEnums.AssetType.ASSET_HDFS.value] : [];
-					that.hdfsResourceList.reset(hdfsList);
-					var hiveList = !_.isUndefined(obj[XAEnums.AssetType.ASSET_HIVE.value]) ? obj[XAEnums.AssetType.ASSET_HIVE.value] :  [];
-					that.hiveResourceList.reset(hiveList);
-					var hbaseList= !_.isUndefined(obj[XAEnums.AssetType.ASSET_HBASE.value]) ? obj[XAEnums.AssetType.ASSET_HBASE.value] : [];
-					that.hbaseResourceList.reset(hbaseList);
-					var knoxList= !_.isUndefined(obj[XAEnums.AssetType.ASSET_KNOX.value]) ? obj[XAEnums.AssetType.ASSET_KNOX.value] : [];
-					that.knoxResourceList.reset(knoxList);
-					var stormList= !_.isUndefined(obj[XAEnums.AssetType.ASSET_STORM.value]) ? obj[XAEnums.AssetType.ASSET_STORM.value] : [];
-					that.stormResourceList.reset(stormList);
-					
-					
-					if(!_.isEmpty(params)){
-						var totalRecords = hdfsList.length + hiveList.length + hbaseList.length + knoxList.length + stormList.length;
-						that.$('[data-js="searchResult"]').html('Total '+totalRecords+' records found.');
-						that.$('[data-js="hdfsSearchResult"]').html(hdfsList.length +' records found.');
-						that.$('[data-js="hiveSearchResult"]').html(hiveList.length  +' records found.');
-						that.$('[data-js="hbaseSearchResult"]').html(hbaseList.length +' records found.');
-						that.$('[data-js="knoxSearchResult"]').html(knoxList.length +' records found.');
-						that.$('[data-js="stormSearchResult"]').html(stormList.length +' records found.');
-					}
-				});			
-			}else{
-				var obj = this.collection.groupBy('assetType');
-				var hdfsList = !_.isUndefined(obj[XAEnums.AssetType.ASSET_HDFS.value]) ? obj[XAEnums.AssetType.ASSET_HDFS.value] : [];
-				that.hdfsResourceList.reset(hdfsList);
-				var hiveList = !_.isUndefined(obj[XAEnums.AssetType.ASSET_HIVE.value]) ? obj[XAEnums.AssetType.ASSET_HIVE.value] :  [];
-				that.hiveResourceList.reset(hiveList);
-				var hbaseList= !_.isUndefined(obj[XAEnums.AssetType.ASSET_HBASE.value]) ? obj[XAEnums.AssetType.ASSET_HBASE.value] : [];
-				that.hbaseResourceList.reset(hbaseList);
-				var knoxList= !_.isUndefined(obj[XAEnums.AssetType.ASSET_KNOX.value]) ? obj[XAEnums.AssetType.ASSET_KNOX.value] : [];
-				that.knoxResourceList.reset(knoxList);
-				var stormList= !_.isUndefined(obj[XAEnums.AssetType.ASSET_STORM.value]) ? obj[XAEnums.AssetType.ASSET_STORM.value] : [];
-				that.stormResourceList.reset(stormList);
-			}
-				
-		},
-		onRender : function() {
-			this.initializePlugins();
-			this.setupGroupAutoComplete();
-			this.getResourceLists();
-			this.renderHdfsTable();
-			this.renderHiveTable();
-			this.renderHbaseTable();
-			this.renderKnoxTable();
-			this.renderStormTable();
-			//this.listenTo(this.hiveResourceList, "reset", function(){alert();}, this);
-		},
-		renderHdfsTable : function(){
-			var that = this;
-
-			this.rHdfsTableList.show(new XATableLayout({
-				columns: this.getHdfsColumns(),
-				collection: this.hdfsResourceList,
-				includeFilter : false,
-				includePagination : false,
-				gridOpts : {
-					row : 	Backgrid.Row.extend({}),
-					header : XABackgrid,
-					emptyText : 'No Policies found!'
-				}
-				/*filterOpts : {
-				  name: ['name'],
-				  placeholder: localization.tt('plcHldr.searchByResourcePath'),
-				  wait: 150
-				}*/
-			}));
-		
-		},
-		renderHiveTable : function(){
-			var that = this;
-
-			this.rHiveTableList.show(new XATableLayout({
-				columns: this.getHiveColumns(),
-				collection: this.hiveResourceList,
-				includeFilter : false,
-				includePagination : false,
-				gridOpts : {
-					//row: TableRow,
-					header : XABackgrid,
-					emptyText : 'No Policies found!'
-				}
-				/*filterOpts : {
-				  name: ['name'],
-				  placeholder: localization.tt('plcHldr.searchByResourcePath'),
-				  wait: 150
-				}*/
-			}));
-		
-		},
-		renderHbaseTable : function(){
-			var that = this;
-
-			this.rHbaseTableList.show(new XATableLayout({
-				columns: this.getHbaseColumns(),
-				collection: this.hbaseResourceList,
-				includeFilter : false,
-				includePagination : false,
-				gridOpts : {
-					//row: TableRow,
-					header : XABackgrid,
-					emptyText : 'No Policies found!'
-				}
-				/*filterOpts : {
-				  name: ['name'],
-				  placeholder: localization.tt('plcHldr.searchByResourcePath'),
-				  wait: 150
-				}*/
-			}));
-		
-		},
-		renderKnoxTable : function(){
-			var that = this;
-
-			this.rKnoxTableList.show(new XATableLayout({
-				columns: this.getKnoxColumns(),
-				collection: this.knoxResourceList,
-				includeFilter : false,
-				includePagination : false,
-				gridOpts : {
-					//row: TableRow,
-					header : XABackgrid,
-					emptyText : 'No Policies found!'
-				}
-				/*filterOpts : {
-				  name: ['name'],
-				  placeholder: localization.tt('plcHldr.searchByResourcePath'),
-				  wait: 150
-				}*/
-			}));
-		
-		},
-		renderStormTable : function(){
-			var that = this;
-
-			this.rStormTableList.show(new XATableLayout({
-				columns: this.getStormColumns(),
-				collection: this.stormResourceList,
-				includeFilter : false,
-				includePagination : false,
-				gridOpts : {
-					//row: TableRow,
-					header : XABackgrid,
-					emptyText : 'No Policies found!'
-				}
-				/*filterOpts : {
-				  name: ['name'],
-				  placeholder: localization.tt('plcHldr.searchByResourcePath'),
-				  wait: 150
-				}*/
-			}));
-		
-		},
-		getHdfsColumns : function(){
-			var that = this;
-			var cols = {
-				policyName : {
-					cell : "uri",
-					href: function(model){
-						return '#!/hdfs/'+model.get('assetId')+'/policy/' + model.id;
-					},
-					label	: localization.tt("lbl.policyName"),
-					editable: false,
-					sortable : false
-				},	
-				name : {
-					cell : "html",
-					label	: localization.tt("lbl.resourcePath"),
-					editable: false,
-					sortable : false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return _.isUndefined(rawValue) ? '--': '<span title="'+rawValue+'">'+rawValue+'</span>';  
-						}
-					})
-				},
-				assetName : {
-					label : localization.tt("lbl.repository"),
-					cell: "String",
-					click : false,
-					drag : false,
-					editable:false,
-					sortable: false
-				},
-				isRecursive:{
-					label:localization.tt('lbl.includesAllPathsRecursively'),
-					cell :"html",
-					editable:false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							var status;
-							_.each(_.toArray(XAEnums.BooleanValue),function(m){
-								if(parseInt(rawValue) == m.value){
-									status =  (m.label == XAEnums.BooleanValue.BOOL_TRUE.label) ? true : false;
-								}	
-							});
-							//return status ? "Yes" : "No";
-							return status  ? '<label class="label label-success">YES</label>' : '<label class="label label">NO</label>';
-						}
-					}),
-					click : false,
-					drag : false,
-					sortable: false
-				},
-				auditList : {
-					label : localization.tt("lbl.auditLogging"),
-					cell: "html",
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue, model) {
-							//return model.has('auditList') ? 'On' : 'Off';
-							return model.has('auditList') ? '<label class="label label-success">ON</label>' : '<label class="label label">OFF</label>';
-						}
-					}),
-					click : false,
-					drag : false,
-					sortable: false,
-					editable:false
-				},
-				permMapListUser : {
-					name : 'permMapList',
-					reName : 'userName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.users"),
-				//	canHeaderSearch : true,
-				//	headerSearchStyle  : 'width:85%;',
-					placeholder : 'User(s)',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							var showMoreLess = false;
-							if(_.isArray(rawValue))
-								rawValue =  new Backbone.Collection(rawValue);
-							if(!_.isUndefined(rawValue) && rawValue.models.length > 0){
-								var userArr = _.uniq(_.compact(_.map(rawValue.models, function(m, i){
-									if(m.has('userName'))
-										return m.get('userName') ;
-								})));
-								if(userArr.length > 0)
-									var resourceId =rawValue.models[0].attributes.resourceId; 
-								var newUserArr = _.map(userArr, function(name, i){
-									if(i >=  4)
-										return '<span class="label label-info" policy-user-id="'+resourceId+'" style="display:none;">' + name + '</span>';
-									else if(i == 3 && userArr.length > 4){
-										showMoreLess = true;
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-									}
-									else
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-								});
-								if(showMoreLess){
-									newUserArr.push('<span class="pull-left"><a href="javascript:void(0);" data-id="showMoreUsers" class="" policy-user-id="'+resourceId+'"><code> + More..</code></a></span>\
-											<span class="pull-left" ><a href="javascript:void(0);" data-id="showLessUsers" class="" policy-user-id="'+resourceId+'" style="display:none;"><code> - Less..</code></a></span>');
-								}
-								return newUserArr.length ? newUserArr.join(' ') : '--';
-							}else
-								return '--';
-						}
-					}),
-					editable:false,
-					sortable: false
-				},
-				permMapList : {
-					reName : 'groupName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.groups"),
-				//	canHeaderSearch : true,
-				//	headerSearchStyle  : 'width:85%;',
-					placeholder : 'Group Name',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return XAUtil.showGroups(rawValue);
-						}
-					}),
-					sortable: false,
-					editable:false
-				}
-				/*isEncrypt:{
-					label:localization.tt("lbl.encrypted"),
-					cell :"Switch",
-					editable:false,
-				//	canHeaderFilter : true,
-				//	headerFilterList :[{label : 'ON',value : 1},{label :'OFF' ,value:2}],
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							var status;
-							_.each(_.toArray(XAEnums.BooleanValue),function(m){
-								if(parseInt(rawValue) == m.value){
-									status =  (m.label == XAEnums.BooleanValue.BOOL_TRUE.label) ? true : false;
-									return ;
-								}	
-							});
-							//You can use rawValue to custom your html, you can change this value using the name parameter.
-							return status;
-						}
-					}),
-					click : false,
-					drag : false,
-					onText : 'ON',
-					offText : 'OFF'
-				},*/
-				/*permissions : {
-					cell :  "html",
-					label : localization.tt("lbl.action"),
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue,model) {
-							return '<a href="#!/policy/'+model.id+'" class="btn btn-mini "><i class="icon-edit icon-large" /></a>\
-									<a href="javascript:void(0);" data-name ="deletePolicy" data-id="'+model.id+'"  class="btn btn-mini  btn-danger"><i class="icon-trash icon-large" /></a>';
-							//You can use rawValue to custom your html, you can change this value using the name parameter.
-						}
-					}),
-					editable:false,
-
-				},
-			*/
-				
-			};
-			return this.hdfsResourceList.constructor.getTableCols(cols, this.hdfsResourceList);
-		},
-		getHiveColumns : function(){
-			var that = this;
-			var cols = {
-				policyName : {
-					cell : "uri",
-					href: function(model){
-						return '#!/hive/'+model.get('assetId')+'/policy/' + model.id;
-					},
-					label	: localization.tt("lbl.policyName"),
-					editable: false,
-					sortable : false
-				},
-				databases : {
-					cell :'html',
-					label	: localization.tt("lbl.databaseName")+'(s)',
-					editable:false,
-					sortable : false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return _.isUndefined(rawValue) ? '--': '<span title="'+rawValue+'">'+rawValue+'</span>';  
-						}
-					})
-				},
-				tables : {
-					label	: localization.tt("lbl.tableName")+'(s)',
-					cell :'html',
-					editable:false,
-					sortable : false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return _.isUndefined(rawValue) ? '--': '<span title="'+rawValue+'">'+rawValue+'</span>';  
-						}
-					})
-				},
-				/*views : {
-					label	: localization.tt("lbl.viewName")+'(s)',
-					editable:false,
-					cell :'string',
-					sortable: false,
-					// headerSearchStyle  : 'width:85%;',
-					//headerFilterList :["Student","Teacher","StudentTeacher"],
-					placeholder : 'View Name',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {	return rawValue ? rawValue : '--';}
-					}),
-				},*/
-				udfs : {
-					label	: localization.tt("lbl.udfName")+'(s)',
-					editable:false,
-					cell :'string',
-					sortable: false,
-					// headerSearchStyle  : 'width:85%;',
-					//headerFilterList :["Student","Teacher","StudentTeacher"],
-					placeholder : 'UDF Name',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {	return rawValue ? rawValue : '--';}
-					})
-				},
-				columns : {
-					label	: localization.tt("lbl.columnName")+'(s)',
-					cell :'html',
-					placeholder : 'Column Name',
-					editable:false,
-					sortable : false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return _.isUndefined(rawValue) ? '--': '<span title="'+rawValue+'">'+rawValue+'</span>';  
-						}
-					})
-
-				},
-				assetName : {
-					label : localization.tt("lbl.repository"),
-					cell: "String",
-					click : false,
-					drag : false,
-					editable:false,
-					sortable: false
-				},
-				auditList : {
-					label : localization.tt("lbl.auditLogging"),
-					cell: "html",
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue, model) {
-							//return model.has('auditList') ? 'On' : 'Off';
-							return model.has('auditList') ? '<label class="label label-success">ON</label>' : '<label class="label label">OFF</label>';
-						}
-					}),
-					click : false,
-					drag : false,
-					sortable: false,
-					editable:false
-				},
-				permMapListUser : {
-					name : 'permMapList',
-					reName : 'userName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.users"),
-					placeholder : 'User(s)',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							var showMoreLess = false;
-							if(_.isArray(rawValue))
-								rawValue =  new Backbone.Collection(rawValue);
-							if(!_.isUndefined(rawValue) && rawValue.models.length > 0){
-								var userArr = _.uniq(_.compact(_.map(rawValue.models, function(m, i){
-									if(m.has('userName'))
-										return m.get('userName') ;
-								})));
-								if(userArr.length > 0)
-									var resourceId =rawValue.models[0].attributes.resourceId; 
-								var newUserArr = _.map(userArr, function(name, i){
-									if(i >=  4)
-										return '<span class="label label-info" policy-user-id="'+resourceId+'" style="display:none;">' + name + '</span>';
-									else if(i == 3 && userArr.length > 4){
-										showMoreLess = true;
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-									}
-									else
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-								});
-								if(showMoreLess){
-									newUserArr.push('<span class="pull-left"><a href="javascript:void(0);" data-id="showMoreUsers" class="" policy-user-id="'+resourceId+'"><code> + More..</code></a></span>\
-											<span class="pull-left" ><a href="javascript:void(0);" data-id="showLessUsers" class="" policy-user-id="'+resourceId+'" style="display:none;"><code> - Less..</code></a></span>');
-								}
-								return newUserArr.length ? newUserArr.join(' ') : '--';
-							}else
-								return '--';
-						}
-					}),
-					editable:false,
-					sortable: false
-				},
-				permMapList : {
-					reName : 'groupName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.group"),
-			//		headerSearchStyle  : 'width:85%;',
-					placeholder : 'Group Name',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return XAUtil.showGroups(rawValue);
-						}
-					}),
-					sortable: false,
-					editable:false
-				}
-				/*isEncrypt:{
-					label:localization.tt("lbl.encrypted"),
-					cell :"Switch",
-					editable:false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							var status;
-							_.each(_.toArray(XAEnums.BooleanValue),function(m){
-								if(parseInt(rawValue) == m.value){
-									status =  (m.label == XAEnums.BooleanValue.BOOL_TRUE.label) ? true : false;
-									return ;
-								}	
-							});
-							//You can use rawValue to custom your html, you can change this value using the name parameter.
-							return status;
-						}
-					}),
-					click : false,
-					drag : false,
-					onText : 'ON',
-					offText : 'OFF'
-				},*/
-				/*permissions : {
-					cell :"uri",
-					label : localization.tt("lbl.action"),
-					href: function(model){
-						return '#!/hive/policy/' + model.id;
-					},
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return 'Edit';
-							//You can use rawValue to custom your html, you can change this value using the name parameter.
-						}
-					}),
-				//	klass : 'btn btn-mini btn-blue',
-					editable:false,
-				//	iconKlass :'icon-edit',
-				//	iconTitle :'Edit'
-					
-
-				}*/
-				
 				
-			};
-			return this.hiveResourceList.constructor.getTableCols(cols, this.hiveResourceList);
-		},
-		getHbaseColumns : function(){
-			var cols = {
-				policyName : {
-					cell : "uri",
-					href: function(model){
-						return '#!/hbase/'+model.get('assetId')+'/policy/' + model.id;
-					},
-					label	: localization.tt("lbl.policyName"),
-					editable: false,
-					sortable : false
-				},
-				tables : {
-					label	: localization.tt("lbl.tableName")+'(s)',
-					cell :'html',
-					editable:false,
-					sortable : false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return _.isUndefined(rawValue) ? '--': '<span title="'+rawValue+'">'+rawValue+'</span>';  
-						}
-					})
-				},
-				columnFamilies : {
-					label	: localization.tt("lbl.columnFamilies")+'(s)',
-					cell :'html',
-					editable:false,
-					sortable : false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return _.isUndefined(rawValue) ? '--': '<span title="'+rawValue+'">'+rawValue+'</span>';  
-						}
-					})
-
-				},
-				assetName : {
-					label : localization.tt("lbl.repository"),
-					cell: "String",
-					click : false,
-					drag : false,
-					editable:false,
-					sortable: false
-				},
-				auditList : {
-					label : localization.tt("lbl.auditLogging"),
-					cell: "html",
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue, model) {
-							//return model.has('auditList') ? 'On' : 'Off';
-							return model.has('auditList') ? '<label class="label label-success">ON</label>' : '<label class="label label">OFF</label>';
-						}
-					}),
-					click : false,
-					drag : false,
-					sortable: false,
-					editable:false
-				},
-				/*isEncrypt:{
-					label:localization.tt("lbl.encrypted"),
-					cell :"html",
-					editable:false,
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue, model) {
-							return model.get('isEncrypt') == XAEnums.BooleanValue.BOOL_TRUE.value ? '<label class="label label-success">ON</label>' : '<label class="label label">OFF</label>';
-							var status;
-							_.each(_.toArray(XAEnums.BooleanValue),function(m){
-								if(parseInt(rawValue) == m.value){
-									status =  (m.label == XAEnums.BooleanValue.BOOL_TRUE.label) ? true : false;
-									return ;
-								}	
-							});
-							//You can use rawValue to custom your html, you can change this value using the name parameter.
-							return status;
-						}
-					}),
-					click : false,
-					drag : false,
-					sortable: false,
-					onText : 'ON',
-					offText : 'OFF'
-				},*/
-				permMapListUser : {
-					name : 'permMapList',
-					reName : 'userName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.users"),
-					placeholder : 'User(s)',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							var showMoreLess = false;
-							if(_.isArray(rawValue))
-								rawValue =  new Backbone.Collection(rawValue);
-							if(!_.isUndefined(rawValue) && rawValue.models.length > 0){
-								var userArr = _.uniq(_.compact(_.map(rawValue.models, function(m, i){
-									if(m.has('userName'))
-										return m.get('userName') ;
-								})));
-								if(userArr.length > 0)
-									var resourceId =rawValue.models[0].attributes.resourceId; 
-								var newUserArr = _.map(userArr, function(name, i){
-									if(i >=  4)
-										return '<span class="label label-info" policy-user-id="'+resourceId+'" style="display:none;">' + name + '</span>';
-									else if(i == 3 && userArr.length > 4){
-										showMoreLess = true;
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-									}
-									else
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-								});
-								if(showMoreLess){
-									newUserArr.push('<span class="pull-left"><a href="javascript:void(0);" data-id="showMoreUsers" class="" policy-user-id="'+resourceId+'"><code> + More..</code></a></span>\
-											<span class="pull-left" ><a href="javascript:void(0);" data-id="showLessUsers" class="" policy-user-id="'+resourceId+'" style="display:none;"><code> - Less..</code></a></span>');
-								}
-								return newUserArr.length ? newUserArr.join(' ') : '--';
-							}else
-								return '--';
-						}
-					}),
-					editable:false,
-					sortable: false
-				},
-				permMapList : {
-					reName : 'groupName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.group"),
-					canHeaderSearch : false,
-					// headerSearchStyle  : 'width:70%;',
-					placeholder : 'Group Name',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							return XAUtil.showGroups(rawValue);
-						}
-					}),
-					sortable: false,
-					editable:false
-				}
-				
-				
-			};
-			return this.hbaseResourceList.constructor.getTableCols(cols, this.hbaseResourceList);
-		},
-		getKnoxColumns : function(){
-			var cols = {
-				policyName : {
-					cell : "uri",
-					href: function(model){
-						return '#!/knox/'+model.get('assetId')+'/policy/' + model.id;
-					},
-					label	: localization.tt("lbl.policyName"),
-					editable: false,
-					sortable : false
-				},	
-				topologies : {
-					label	: localization.tt("lbl.topologyName")+'(s)',
-					/*href: function(model){
-						return '#!/knox/'+model.get('assetId')+'/policy/' + model.id;
-					},*/
-					editable:false,
-					cell :'string',
-					sortable : false
-						
-				},
-				services: {
-					label	: localization.tt("lbl.serivceName")+'(s)',
-					editable:false,
-					cell :'string',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {	return rawValue ? rawValue : '--';}
-					}),
-					sortable : false
-				},
-				assetName : {
-					label : localization.tt("lbl.repository"),
-					cell: "String",
-					click : false,
-					drag : false,
-					editable:false,
-					sortable: false
-				},
-				auditList : {
-					label : localization.tt("lbl.auditLogging"),
-					cell: "html",
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue, model) {
-							return model.has('auditList') ? '<label class="label label-success">ON</label>' : '<label class="label label">OFF</label>';
-						}
-					}),
-					click : false,
-					drag : false,
-					sortable : false,
-					editable : false
-				},
-				permMapListUser : {
-					name : 'permMapList',
-					reName : 'userName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.users"),
-					placeholder : 'User(s)',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							var showMoreLess = false;
-							if(_.isArray(rawValue))
-								rawValue =  new Backbone.Collection(rawValue);
-							if(!_.isUndefined(rawValue) && rawValue.models.length > 0){
-								var userArr = _.uniq(_.compact(_.map(rawValue.models, function(m, i){
-									if(m.has('userName'))
-										return m.get('userName') ;
-								})));
-								if(userArr.length > 0)
-									var resourceId =rawValue.models[0].attributes.resourceId; 
-								var newUserArr = _.map(userArr, function(name, i){
-									if(i >=  4)
-										return '<span class="label label-info" policy-user-id="'+resourceId+'" style="display:none;">' + name + '</span>';
-									else if(i == 3 && userArr.length > 4){
-										showMoreLess = true;
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-									}
-									else
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-								});
-								if(showMoreLess){
-									newUserArr.push('<span class="pull-left"><a href="javascript:void(0);" data-id="showMoreUsers" class="" policy-user-id="'+resourceId+'"><code> + More..</code></a></span>\
-											<span class="pull-left" ><a href="javascript:void(0);" data-id="showLessUsers" class="" policy-user-id="'+resourceId+'" style="display:none;"><code> - Less..</code></a></span>');
-								}
-								return newUserArr.length ? newUserArr.join(' ') : '--';
-							}else
-								return '--';
-						}
-					}),
-					editable:false,
-					sortable: false
-				},
-				permMapList : {
-					reName : 'groupName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.group"),
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							if(!_.isUndefined(rawValue))
-								return XAUtil.showGroups(rawValue);
-							else 
-								return '--';
-						}
-					}),
-					editable : false,
-					sortable : false
-				},
-			};
-			return this.knoxResourceList.constructor.getTableCols(cols, this.knoxResourceList);
-		},
-		getStormColumns : function(){
-			var cols = {
-				policyName : {
-					cell : "uri",
-					href: function(model){
-						return '#!/knox/'+model.get('assetId')+'/policy/' + model.id;
-					},
-					label	: localization.tt("lbl.policyName"),
-					editable: false,
-					sortable : false
-				},	
-				topologies : {
-					label	: localization.tt("lbl.topologyName")+'(s)',
-					/*href: function(model){
-						return '#!/knox/'+model.get('assetId')+'/policy/' + model.id;
-					},*/
-					editable:false,
-					cell :'string',
-					sortable : false
-						
-				},
-				/*services: {
-					label	: localization.tt("lbl.serivceName")+'(s)',
-					editable:false,
-					cell :'string',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {	return rawValue ? rawValue : '--';}
-					}),
-					sortable : false
-				},*/
-				assetName : {
-					label : localization.tt("lbl.repository"),
-					cell: "String",
-					click : false,
-					drag : false,
-					editable:false,
-					sortable: false
-				},
-				auditList : {
-					label : localization.tt("lbl.auditLogging"),
-					cell: "html",
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue, model) {
-							return model.has('auditList') ? '<label class="label label-success">ON</label>' : '<label class="label label">OFF</label>';
-						}
-					}),
-					click : false,
-					drag : false,
-					sortable : false,
-					editable : false
-				},
-				permMapListUser : {
-					name : 'permMapList',
-					reName : 'userName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.users"),
-					placeholder : 'User(s)',
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							var showMoreLess = false;
-							if(_.isArray(rawValue))
-								rawValue =  new Backbone.Collection(rawValue);
-							if(!_.isUndefined(rawValue) && rawValue.models.length > 0){
-								var userArr = _.uniq(_.compact(_.map(rawValue.models, function(m, i){
-									if(m.has('userName'))
-										return m.get('userName') ;
-								})));
-								if(userArr.length > 0)
-									var resourceId =rawValue.models[0].attributes.resourceId; 
-								var newUserArr = _.map(userArr, function(name, i){
-									if(i >=  4)
-										return '<span class="label label-info" policy-user-id="'+resourceId+'" style="display:none;">' + name + '</span>';
-									else if(i == 3 && userArr.length > 4){
-										showMoreLess = true;
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-									}
-									else
-										return '<span class="label label-info" policy-user-id="'+resourceId+'">' + name + '</span>';
-								});
-								if(showMoreLess){
-									newUserArr.push('<span class="pull-left"><a href="javascript:void(0);" data-id="showMoreUsers" class="" policy-user-id="'+resourceId+'"><code> + More..</code></a></span>\
-											<span class="pull-left" ><a href="javascript:void(0);" data-id="showLessUsers" class="" policy-user-id="'+resourceId+'" style="display:none;"><code> - Less..</code></a></span>');
-								}
-								return newUserArr.length ? newUserArr.join(' ') : '--';
-							}else
-								return '--';
-						}
-					}),
-					editable:false,
-					sortable: false
-				},
-				permMapList : {
-					reName : 'groupName',
-					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
-					label : localization.tt("lbl.group"),
-					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-						fromRaw: function (rawValue) {
-							if(!_.isUndefined(rawValue))
-								return XAUtil.showGroups(rawValue);
-							else 
-								return '--';
-						}
-					}),
-					editable : false,
-					sortable : false
-				},
-			};
-			return this.stormResourceList.constructor.getTableCols(cols, this.stormResourceList);
+			}).on('select2-focus', XAUtil.select2Focus);
 		},
 		/** all post render plugin initialization */
 		initializePlugins : function() {
@@ -1155,14 +413,27 @@ define(function(require) {'use strict';
 			
 		},
 		onSearch : function(e){
-			var that = this;
+			var that = this, type;
+			// XAUtil.blockUI();
+			//Get search values
 			var groups = (this.ui.userGroup.is(':visible')) ? this.ui.userGroup.select2('val'):undefined;
 			var users = (this.ui.userName.is(':visible')) ? this.ui.userName.select2('val'):undefined;
-			var rxName = this.ui.resourceName.val();
-			var policyName = this.ui.policyName.val();
-			var params = {groupId : groups,userId : users,name : rxName, policyName : policyName};
+			var rxName = this.ui.resourceName.val() || undefined;
+			var policyName = this.ui.policyName.val() || undefined;
+			var params = {group : groups, user : users, polResource : rxName, policyNamePartial : policyName};
+			
+			_.each(this.policyCollList, function(obj,i){
+				var coll = this[obj.collName];
+				//clear previous query params
+				_.each(params, function(val, attr){
+					delete coll.queryParams[attr];
+				});
+				//Set default page state
+				coll.state = this.defaultPageState;
+				coll.queryParams = $.extend(coll.queryParams, params)
+            	this.getResourceLists(obj.collName, obj.serviceDefName);
+            },this);
 			
-			this.getResourceLists(params);
 		},
 		autocompleteFilter	: function(e){
 			var $el = $(e.currentTarget);
@@ -1213,32 +484,28 @@ define(function(require) {'use strict';
 			}
 		},
 		onShowMore : function(e){
-			var id = $(e.currentTarget).attr('policy-group-id');
-			var elem = $(e.currentTarget).closest('.showMoreLess').attr('data-id');
-			$('[data-id="'+elem+'"]').find('[policy-group-id="'+id+'"]').show();
-			$('[data-id="showLess"][policy-group-id="'+id+'"]').show();
-			$('[data-id="showMore"][policy-group-id="'+id+'"]').hide();
+			var attrName = 'policy-groups-id';
+			var id = $(e.currentTarget).attr(attrName);
+			if(_.isUndefined(id)){
+				id = $(e.currentTarget).attr('policy-users-id');
+				attrName = 'policy-users-id';
+			}   
+			var $td = $(e.currentTarget).parents('td');
+			$td.find('['+attrName+'="'+id+'"]').show();
+			$td.find('[data-id="showLess"]['+attrName+'="'+id+'"]').show();
+			$td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').hide();
 		},
 		onShowLess : function(e){
-			var id = $(e.currentTarget).attr('policy-group-id');
-			var elem = $(e.currentTarget).closest('.showMoreLess').attr('data-id')
-			$('[data-id="'+elem+'"]').find('[policy-group-id="'+id+'"]').slice(4).hide();
-			$('[data-id="showLess"][policy-group-id="'+id+'"]').hide();
-			$('[data-id="showMore"][policy-group-id="'+id+'"]').show();
-		},
-		onShowMoreUsers : function(e){
-			var id = $(e.currentTarget).attr('policy-user-id');
-			var elem = $(e.currentTarget).closest('.showMoreLess').attr('data-id');
-			$('[data-id="'+elem+'"]').find('[policy-user-id="'+id+'"]').show();
-			$('[data-id="showLessUsers"][policy-user-id="'+id+'"]').show();
-			$('[data-id="showMoreUsers"][policy-user-id="'+id+'"]').hide();
-		},
-		onShowLessUsers : function(e){
-			var id = $(e.currentTarget).attr('policy-user-id');
-			var elem = $(e.currentTarget).closest('.showMoreLess').attr('data-id');
-			$('[data-id="'+elem+'"]').find('[policy-user-id="'+id+'"]').slice(4).hide();
-			$('[data-id="showLessUsers"][policy-user-id="'+id+'"]').hide();
-			$('[data-id="showMoreUsers"][policy-user-id="'+id+'"]').show();
+			var attrName = 'policy-groups-id';
+			var id = $(e.currentTarget).attr(attrName);
+			if(_.isUndefined(id)){
+				id = $(e.currentTarget).attr('policy-users-id');
+				attrName = 'policy-users-id';
+			}
+			var $td = $(e.currentTarget).parents('td');
+			$td.find('['+attrName+'="'+id+'"]').slice(4).hide();
+			$td.find('[data-id="showLess"]['+attrName+'="'+id+'"]').hide();
+			$td.find('[data-id="showMore"]['+attrName+'="'+id+'"]').show();
 		},
 		/** on close */
 		onClose : function() {
@@ -1246,4 +513,4 @@ define(function(require) {'use strict';
 	});
 
 	return UserAccessLayout;
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/85d5658f/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html b/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html
index b931774..58798d1 100644
--- a/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html
@@ -82,12 +82,7 @@
 		</div>
 	</div>
 
-	<!-- <div class="alert alert-success">
-	<a href="#" class="close" data-dismiss="alert">×</a>
-	<label data-js="searchResult"></label>
-	</div> -->
-
-	<div class="clearfix">
+<!-- 	<div class="clearfix">
 		<span class="pull-right">GOTO :&nbsp;&nbsp; 
 			<a href="javascript:;" class="link-tag gotoLink" data-js="gotoHive" style="margin-right: 5px;">
 				<i class=" icon-chevron-down" ></i>
@@ -106,48 +101,18 @@
 				Storm Table
 			</a>
 		</span>
-	</div>
+	</div> -->
 
 	<div class="row-fluid">
-		<h3 class="wrap-header bold reportSearchHeader" data-js="hdfsHeader"> {{tt 'lbl.listOfHDFSPolicies'}}
-			<span class="label label-yellow pull-right" data-js="hdfsSearchResult" ></span>
-		</h3>
-		<div class="wrap well position-relative">
-			<div  data-id="r_hdfsTable" class="hdfs-table showMoreLess"></div>
-			<div data-id="r_hdfsTableSpinner" class="" ></div>
-		</div>
+		{{#each policyHeaderList}}
+			<h3 class="wrap-header bold reportSearchHeader" data-js="hdfsHeader"> {{this.serviceDefName}}
+				<span class="label label-yellow pull-right" data-js="hdfsSearchResult" ></span>
+			</h3>
+			<div class="wrap well position-relative">
+				<div  data-id="{{this.collName}}" class="hdfs-table showMoreLess"></div>
+			</div>
+		{{/each}}	
 
-		<h3  class="wrap-header bold reportSearchHeader" data-js="hiveHeader"> {{tt 'lbl.listOfHIVEPolicies'}}
-			<span class="label label-yellow pull-right" data-js="hiveSearchResult" ></span>
-		</h3>
-		<div class="wrap well position-relative">
-			<div   data-id="r_hiveTable" class="showMoreLess"></div>
-			<div data-id="r_hiveTableSpinner" class="" ></div>
-		</div>
-		
-		<h3  class="wrap-header bold reportSearchHeader" data-js="hbaseHeader"> {{tt 'lbl.listOfHBASEPolicies'}}
-			<span class="label label-yellow pull-right" data-js="hbaseSearchResult" ></span>
-		</h3>
-		<div class="wrap well position-relative">
-			<div   data-id="r_hbaseTable" class="showMoreLess"></div>
-			<div data-id="r_hbaseTableSpinner" class="" ></div>
-		</div>
-		
-		<h3  class="wrap-header bold reportSearchHeader" data-js="knoxHeader"> {{tt 'lbl.listOfKNOXPolicies'}}
-			<span class="label label-yellow pull-right" data-js="knoxSearchResult" ></span>
-		</h3>
-		<div class="wrap well position-relative">
-			<div   data-id="r_knoxTable" class="showMoreLess"></div>
-			<div data-id="r_knoxTableSpinner" class="" ></div>
-		</div>
-		
-		<h3  class="wrap-header bold reportSearchHeader" data-js="stormHeader"> {{tt 'lbl.listOfSTORMPolicies'}}
-			<span class="label label-yellow pull-right" data-js="stormSearchResult" ></span>
-		</h3>
-		<div class="wrap well position-relative">
-			<div   data-id="r_stormTable" class="showMoreLess"></div>
-			<div data-id="r_stormTableSpinner" class="" ></div>
-		</div>
 	</div>
 
 </div>


Mime
View raw message