ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gau...@apache.org
Subject [4/5] incubator-ranger git commit: RANGER-760 : Various Ranger UI code clean up
Date Tue, 02 Feb 2016 06:06:10 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js b/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js
index 12bd6d7..ae81b86 100644
--- a/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js
@@ -48,7 +48,7 @@ define(function(require){
 			'rPagination'	: 'div[data-id="r_pagination"]'
 		},
 
-    	// /** ui selector cache */
+    	/** ui selector cache */
     	ui: {},
 
 		gridOpts : {
@@ -122,11 +122,9 @@ define(function(require){
 			this.listenTo(this.collection, "sync reset", this.showHidePager);
 			
             this.listenTo(this.collection, 'request', function(){
-//				$(this.rTableSpinner.el).addClass('loading');
 				this.$el.find(this.rTableSpinner.el).addClass('loading');
 			},this);
             this.listenTo(this.collection, 'sync error', function(){
-//				$(this.rTableSpinner.el).removeClass('loading');
 				this.$el.find(this.rTableSpinner.el).removeClass('loading');
 			},this);
 		},
@@ -158,11 +156,6 @@ define(function(require){
 		renderTable : function(){
 			var that = this;
 			this.rTableList.show(new Backgrid.Grid(this.gridOpts));
-
-			/*this.rTableSpinner.show(new Spinner({
-				collection: this.collection
-			}));*/
-
 		},
 		renderPagination : function(){
 			this.rPagination.show(new Backgrid.Extension.Paginator({
@@ -175,7 +168,6 @@ define(function(require){
 		showHidePager : function(){
 			if(this.collection.state && this.collection.state.totalRecords > XAGlobals.settings.PAGE_SIZE)	{
 				this.$el.find(this.rPagination.el).show()
-				//$(this.rPagination.el).show();
 			} else {
 				this.$el.find(this.rPagination.el).hide();
 			}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/folders/FolderInfo.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/folders/FolderInfo.js b/security-admin/src/main/webapp/scripts/views/folders/FolderInfo.js
deleted file mode 100644
index 18ef7e2..0000000
--- a/security-admin/src/main/webapp/scripts/views/folders/FolderInfo.js
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- 
-define(function(require){
-    'use strict';
-
-	var Backbone		= require('backbone');
-	var Communicator	= require('communicator');
-	
-	var XAUtil			= require('utils/XAUtils');
-	var XAEnums			= require('utils/XAEnums');
-	var VXPermMapList 	= require('collections/VXPermMapList');
-	var FolderInfo_tmpl = require('hbs!tmpl/folders/FolderInfo_tmpl');
-	var KnoxInfo_tmpl = require('hbs!tmpl/knox/KnoxInfo_tmpl');
-
-	var FolderInfo = Backbone.Marionette.ItemView.extend(
-	/** @lends FolderInfo */
-	{
-		_viewName : FolderInfo,
-		
-    	template: FolderInfo_tmpl,
-        templateHelpers :function(){
-        	
-        	var hiveModel = this.model.get('assetType') == XAEnums.AssetType.ASSET_HIVE.value ? true : false;
-        	var hbaseModel = this.model.get('assetType') == XAEnums.AssetType.ASSET_HBASE.value ? true : false;
-        	var hiveOrHbaseModel = hiveModel || hbaseModel;
-        	return {
-        		groupPermListArr: this.getGroupPermListArr(),
-        		userPermListArr : this.getUserPermListArr(),
-   				hdfsModel 		: this.model.get('assetType') == XAEnums.AssetType.ASSET_HDFS.value ? true : false,
-        		hiveOrHbaseModel: hiveOrHbaseModel,
-        		
-        	};
-        },
-    	/** ui selector cache */
-    	ui: {},
-
-		/** ui events hash */
-		events: function() {
-			var events = {};
-			//events['change ' + this.ui.input]  = 'onInputChange';
-			return events;
-		},
-
-    	/**
-		* intialize a new FolderInfo ItemView 
-		* @constructs
-		*/
-		initialize: function(options) {
-			console.log("initialized a FolderInfo ItemView");
-
-			_.extend(this, _.pick(options, ''));
-			//this.model.set('permMapList',new VXPermMapList(this.model.attributes.permMapList))
-			this.bindEvents();
-			this.getTemplateForView();
-		},
-
-		/** all events binding here */
-		bindEvents : function(){
-			/*this.listenTo(this.model, "change:foo", this.modelChanged, this);*/
-			/*this.listenTo(communicator.vent,'someView:someEvent', this.someEventHandler, this)'*/
-		},
-
-		/** on render callback */
-		onRender: function() {
-			this.initializePlugins();
-		},
-
-		/** all post render plugin initialization */
-		initializePlugins: function(){
-		},
-		getTemplateForView : function(){
-			if(this.model.get('assetType') == XAEnums.AssetType.ASSET_KNOX.value){
-				this.template = KnoxInfo_tmpl;
-			}
-		},
-		getGroupPermListArr : function(){
-			var groupList = [];
-			var perm=[],permListArr =[];
-			if(!_.isUndefined(this.model.attributes.permMapList)){
-				if(_.isArray(this.model.attributes.permMapList)){
-					groupList = new VXPermMapList(this.model.attributes.permMapList);
-					groupList =  groupList.groupBy('groupId');
-				}else{
-					groupList =  this.model.attributes.permMapList.groupBy('groupId');
-				}
-				
-				_.each(groupList,function(val,prop){
-					var groups = groupList[prop];
-					var permTypeArr =[],name ='',ipAddressArr =[];
-					groups = _.sortBy(groups, function (m) {return m.get('permType');});
-					_.each(groups,function(gprop){
-						var permVal = _.pick(gprop.attributes,'permType').permType;
-						var label = XAUtil.enumValueToLabel(XAEnums.XAPermType,permVal);
-						permTypeArr.push(label);
-						name = _.pick(gprop.attributes,'groupName').groupName;
-						if(!_.isUndefined(gprop.get('ipAddress')))
-							ipAddressArr.push(gprop.get('ipAddress'))
-								
-					});
-					if(name != undefined){
-						var ipAddress = _.uniq(ipAddressArr).toString();
-						permListArr.push({
-							name :name,
-							permType :permTypeArr.toString(),
-							ipAddress :_.isEmpty(ipAddress) ? "--" : ipAddress
-						});
-					}
-					
-				});
-			}
-        	return permListArr;
-	     },
-	     getUserPermListArr : function(){
-    	 	var userList = [];
-    	 	var perm=[],permListArr =[];
-    	 	if(!_.isUndefined(this.model.attributes.permMapList)){
-	    		 if(_.isArray(this.model.attributes.permMapList)){
-	    			 userList = new VXPermMapList(this.model.attributes.permMapList);
-	    			 userList =  userList.groupBy('userId');
-	    		 }else{
-	    			 userList =  this.model.attributes.permMapList.groupBy('userId');
-	    		 }
-	    		 //var userList =  this.model.attributes.permMapList.groupBy('userId');
-	    		 _.each(userList,function(val,prop){
-	    			 var users = userList[prop];
-	    			 users = _.sortBy(users, function (m) {return m.get('permType');});
-	    			 var permTypeArr =[],name ='', ipAddressArr =[];
-	    			 _.each(users,function(gprop){
-	    				 var permVal = _.pick(gprop.attributes,'permType').permType;
-	    				 var label = XAUtil.enumValueToLabel(XAEnums.XAPermType,permVal);
-	    				 permTypeArr.push(label);
-	    				 name = _.pick(gprop.attributes,'userName').userName;
-	    				 if(!_.isUndefined(gprop.get('ipAddress')))
-							ipAddressArr.push(gprop.get('ipAddress'))
-	    			 });
-	    			 if(name != undefined){
-	    				 var ipAddress = _.uniq(ipAddressArr).toString();	    				 
-	    				 permListArr.push({ name :name,
-	    					 permType :permTypeArr.toString(),
-	    					 ipAddress :_.isEmpty(ipAddress) ? "--" : ipAddress
-	    				 });
-	    			 }
-	    			 
-	    		 });
-	    	 }	
-	        return permListArr;
-		     },
-		/** on close */
-		onClose: function(){
-		}
-
-	});
-
-	return FolderInfo;
-});

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
index 52990dd..0a24bc1 100755
--- a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
@@ -40,7 +40,6 @@ define(function(require){
 		
     	template: KmsTablelayoutTmpl,
     	templateHelpers : function(){
-//    		return { kmsServiceName : this.kmsServiceName };
     	},
     	breadCrumbs :[XALinks.get('KmsManage')],
 		/** Layout sub regions */
@@ -78,10 +77,8 @@ define(function(require){
 			this.showKeyList = true;
 			this.isKnownKmsServicePage =  this.kmsManagePage == 'new' ? false : true;
 			this.initializeKMSServices();
-			if(this.isKnownKmsServicePage){
-				this.getKeysForKmsService();	
-			}
 			this.bindEvents();
+			this.defaultsCollstate = this.collection.state
 		},
 
 		/** all events binding here */
@@ -99,16 +96,19 @@ define(function(require){
 			});
 		},
 		getKeysForKmsService : function() {
+			var that = this;
 			this.collection.queryParams['provider'] = this.kmsServiceName;
 			this.collection.fetch({
 				cache : false,
 				reset :true,
-				error : function(model,resp){
+				error : function(collection,resp){
 					var errorMsg = 'Error getting key list!!';
 					if(!_.isUndefined(resp) && !_.isUndefined(resp.responseJSON) && !_.isUndefined(resp.responseJSON.msgDesc)){
 						errorMsg = resp.responseJSON.msgDesc;
 					}
 					XAUtil.notifyError('Error', errorMsg);
+					collection.state = that.defaultsCollstate;
+					collection.reset();
 				}
 			});
 		},
@@ -128,13 +128,19 @@ define(function(require){
 			}
 			this.setupKmsServiceAutoComplete();
 			this.addVisualSearch();
+			//Showing pagination even if No Key found
+			if(!this.isKnownKmsServicePage){
+				this.collection.reset();
+			}
+			if(this.isKnownKmsServicePage){
+                                this.getKeysForKmsService();
+                        }
 		},
 		onTabChange : function(e){
 			var that = this;
 			this.showKeyList = $(e.currentTarget).attr('href') == '#keys' ? true : false;
 			if(this.showKeyList){				
 				this.renderKeyTab();
-//				this.addVisualSearch();
 			}
 		},
 		renderKeyTab : function(){
@@ -152,19 +158,16 @@ define(function(require){
 					emptyText : 'No Key found!'
 				}
 			}));	
-
 		},
 
 		getColumns : function(){
 			var that = this;
 			var cols = {
-				
 				name : {
 					label	: localization.tt("lbl.keyName"),
 					cell :'string',
 					editable:false,
 					sortable:false,
-											
 				},
 				cipher : {
 					label	: localization.tt("lbl.cipher"),
@@ -206,12 +209,10 @@ define(function(require){
 					drag : false,
 					editable:false,
 					sortable:false,
-//                    sortType: 'toggle',
-//                    direction: 'descending',
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue, model) {
 							if(!_.isUndefined(rawValue))
-							return Globalize.format(new Date(rawValue),  "MM/dd/yyyy hh:mm:ss tt");
+								return Globalize.format(new Date(rawValue),  "MM/dd/yyyy hh:mm:ss tt");
 						}
 					})
 				},
@@ -227,7 +228,6 @@ define(function(require){
 						}),
 						editable: false,
 						sortable : false
-
 				}
 				
 			};
@@ -252,7 +252,6 @@ define(function(require){
 				    	  valueMatches :function(facet, searchTerm, callback) {
 								switch (facet) {
 								}     
-			            	
 							}
 				      }
 				};
@@ -263,6 +262,7 @@ define(function(require){
 		},
 		setupKmsServiceAutoComplete : function(serviceName){
 			var that = this, arr = [];
+			
 			this.ui.selectServiceName.select2({
 				maximumSelectionSize : 1,
 				closeOnSelect : true,
@@ -275,13 +275,13 @@ define(function(require){
 					url: "service/plugins/services",
 					dataType: 'json',
 					data: function (term, page) {
-						return {name : term, 'serviceType' : 'kms'};
+						return { name : term, 'serviceType' : 'kms' };
 					},
 					results: function (data, page) { 
 						var results = [],selectedVals = [];
 						if(data.resultSize != "0"){
 							results = data.services.map(function(m, i){	return {id : m.name, text: m.name};	});
-							return {results : results};
+							return { results : results };
 						}
 						return { results : results };
 					}
@@ -296,7 +296,7 @@ define(function(require){
 					return 'No service found.';
 				}
 			})
-			.on('select2-focus', XAUtil.select2Focus)
+			//.on('select2-focus', XAUtil.select2Focus)
 			.on('change',function(e) {
 				that.kmsServiceName = (e.currentTarget.value)
 				that.ui.addNewKey.attr('disabled',false);
@@ -311,12 +311,12 @@ define(function(require){
 			var obj = this.collection.get($(e.currentTarget).data('id'));
 			var model = new KmsKey(obj.attributes);
 			model.collection = this.collection;
-			var url = model.urlRoot+"/"+model.get('name')+"?provider="+ this.kmsServiceName;
+			var url = model.urlRoot +"/"+model.get('name') +"?provider="+ this.kmsServiceName;
+			
 			XAUtil.confirmPopup({
 				msg :'Are you sure want to delete ?',
 				callback : function(){
 					XAUtil.blockUI();
-					
 					model.destroy({
 						'url' : url,
 						'success': function(model, response) {
@@ -343,7 +343,7 @@ define(function(require){
 			var obj = this.collection.get($(e.currentTarget).data('id'));
 			var model = new KmsKey({ 'name' : obj.attributes.name });
 			model.collection = this.collection;
-			 var url = model.urlRoot+"?provider="+ this.kmsServiceName;
+			var url = model.urlRoot + "?provider=" + this.kmsServiceName;
 			XAUtil.confirmPopup({
 				msg :'Are you sure want to rollover ?',
 				callback : function(){
@@ -363,7 +363,7 @@ define(function(require){
                             var errorMsg = 'Error rollovering key!';
                             XAUtil.blockUI('unblock');
                             if(!_.isUndefined(resp) && !_.isUndefined(resp.responseJSON) && !_.isUndefined(resp.responseJSON.msgDesc)){
-                                    errorMsg = resp.responseJSON.msgDesc;
+                            	errorMsg = resp.responseJSON.msgDesc;
                             }
                             XAUtil.notifyError('Error', errorMsg);
 						}
@@ -379,4 +379,4 @@ define(function(require){
 	});
 
 	return KmsTableLayout; 
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js
index 0bc62b6..38cb03f 100644
--- a/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js
@@ -34,7 +34,6 @@ define(function(require){
 	
 	var KmsKeyCreateTmpl= require('hbs!tmpl/kms/KmsKeyCreate_tmpl');
 	var RKmsKeyForm 	= require('views/kms/KmsKeyForm');
-//	var RangerServiceDef	= require('models/RangerServiceDef');
 
 	var KmsKeyCreate = Backbone.Marionette.Layout.extend(
 	/** @lends KmsKeyCreate */
@@ -49,8 +48,9 @@ define(function(require){
     	},
     	breadCrumbs :function(){
     		var opts = { 'kmsService' : this.kmsService, 'kmsServiceDefModel' : this.kmsServiceDefModel }
-    		if(this.model.isNew())
+    		if(this.model.isNew()){
     			return [XALinks.get('KmsManage',opts), XALinks.get('KmsServiceForKey', opts), XALinks.get('KmsKeyCreate')];
+    		}
     	} ,        
 
 		/** Layout sub regions */
@@ -110,9 +110,7 @@ define(function(require){
 		onSave: function(){
 			var that =this ;
 			var errors = this.form.commit({validate : false});
-			if(! _.isEmpty(errors)){
-				return;
-			}
+			if(! _.isEmpty(errors))	return;
 			var options = {
 				url : this.model.urlRoot+"?provider="+ this.kmsServiceName,
 				success: function () {
@@ -125,12 +123,14 @@ define(function(require){
 				error : function (model, resp, options) {
 					XAUtil.blockUI('unblock');
 					var errorMsg = 'Error creating Key!';
-					if(!_.isUndefined(resp) && !_.isUndefined(resp.responseJSON) && !_.isUndefined(resp.responseJSON.msgDesc)){
+					if(!_.isUndefined(resp) && !_.isUndefined(resp.responseJSON) 
+							&& !_.isUndefined(resp.responseJSON.msgDesc)){
 						errorMsg = resp.responseJSON.msgDesc;
 					}
 					XAUtil.notifyError('Error', errorMsg);
 				}
 			}
+			
 			//to check model is new or not
 			options.type = (this.model.has('versions')) ? 'PUT'  : 'POST';
 			this.form.beforeSave();
@@ -145,7 +145,6 @@ define(function(require){
 			var that = this;
 			var url = this.model.urlRoot+"?provider="+ this.kmsServiceName;
 			XAUtil.confirmPopup({
-				//msg :localize.tt('msg.confirmDelete'),
 				msg :'Are you sure want to delete ?',
 				callback : function(){
 					XAUtil.blockUI();

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionCreate.js b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionCreate.js
index 3e03d80..02b879d 100644
--- a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionCreate.js
@@ -38,25 +38,23 @@ define(function(require){
 	{
 		_viewName : 'ModulePermissionCreate',
 
-	template: ModulePermissionCreateTmpl,
-	breadCrumbs :function(){
-		if(this.model.isNew())
-			return [XALinks.get('ModulePermissions')];
-		else
-			return [XALinks.get('ModulePermissions'),XALinks.get('ModulePermissionEdit',this.model)];
-	},
-
-		/** Layout sub regions */
-	regions: {
-		'rForm' :'div[data-id="r_form"]'
-	},
-
-	/** ui selector cache */
-	ui: {
-		'tab' 		: '.nav-tabs',
-		'btnSave'	: '[data-id="save"]',
-		'btnCancel' : '[data-id="cancel"]'
-	},
+		template: ModulePermissionCreateTmpl,
+		breadCrumbs :function(){
+			return this.model.isNew() ? [XALinks.get('ModulePermissions')] 
+					: [XALinks.get('ModulePermissions'),XALinks.get('ModulePermissionEdit',this.model)];
+		},
+		
+			/** Layout sub regions */
+		regions: {
+			'rForm' :'div[data-id="r_form"]'
+		},
+		
+		/** ui selector cache */
+		ui: {
+			'tab' 		: '.nav-tabs',
+			'btnSave'	: '[data-id="save"]',
+			'btnCancel' : '[data-id="cancel"]'
+		},
 
 		/** ui events hash */
 		events: function() {
@@ -94,34 +92,33 @@ define(function(require){
 		initializePlugins: function(){
 		},
 		renderForm : function(){
-			   var VXGroupList		= require('collections/VXGroupList');
-			   var VXUserList		= require('collections/VXUserList');
-			   var params = {sortBy : 'name'};
-			   this.userList = new VXUserList();
-			   this.userList.setPageSize(100,{fetch:true});
-			   this.userList.fetch({
-					cache :false,
-					data: params,
-					async : false
-			   });
-			   this.groupList = new VXGroupList();
-			   this.groupList.setPageSize(100,{fetch:true});
-			   this.groupList.fetch({
-				   cache :false,
-				   data : params,
-				   async : false
-			   });
-			var that = this;
-			this.form = new ModulePermissionForm({
-				template  : require('hbs!tmpl/permissions/ModulePermissionForm_tmpl'),
-				model 	  : that.model,
-				groupList : that.groupList,
-				userList  : that.userList
-			});
-			this.rForm.show(this.form);
+			var VXGroupList		= require('collections/VXGroupList');
+			var VXUserList		= require('collections/VXUserList');
+		    var params = {sortBy : 'name'};
+		    this.userList = new VXUserList();
+		    this.userList.setPageSize(100,{fetch:true});
+		    this.userList.fetch({
+		    	cache :false,
+				data: params,
+				async : false
+		   });
+		   this.groupList = new VXGroupList();
+		   this.groupList.setPageSize(100,{fetch:true});
+		   this.groupList.fetch({
+			   cache :false,
+			   data : params,
+			   async : false
+		   });
+		   var that = this;
+		   this.form = new ModulePermissionForm({
+			   template  : require('hbs!tmpl/permissions/ModulePermissionForm_tmpl'),
+			   model 	  : that.model,
+			   groupList : that.groupList,
+			   userList  : that.userList
+		   });
+		   this.rForm.show(this.form);
 		},
 		onSave: function(){
-
 			var errors = this.form.commit({validate : false});
 			if(! _.isEmpty(errors)){
 				this.form.beforeSaveModulePermissions();
@@ -142,14 +139,14 @@ define(function(require){
 					var msg = that.editMode ? 'Module Permissions updated successfully' :'Module Permissions created successfully';
 					XAUtil.notifySuccess('Success', msg);
 					App.appRouter.navigate("#!/permissions",{trigger: true});
-				}   ,
+				},
 				error : function(model,resp){
 					XAUtil.blockUI('unblock');
 					if(!_.isUndefined(resp.responseJSON) && !_.isUndefined(resp.responseJSON.msgDesc)){
 						XAUtil.notifyError('Error',resp.responseJSON.msgDesc);
-					}else
+					} else {
 						XAUtil.notifyError('Error', "Error occurred while creating/updating module permissions.");
-
+					}
 				}
 			});
 		},

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
index 497a4a2..e311f1e 100644
--- a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
+++ b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
@@ -46,9 +46,6 @@ define(function(require) {
 		_viewName : 'ModulePermissionForm',
 		template : require('hbs!tmpl/permissions/ModulePermissionForm_tmpl'),
 		templateHelpers :function(){
-			return {
-
-			};
 		},
 		templateData : function(){
 			return { 'id' : this.model.id, 'permHeaders' : this.getPermHeaders() };
@@ -59,7 +56,6 @@ define(function(require) {
 				this.setupFieldsforEditModule();
 			}
 			Backbone.Form.prototype.initialize.call(this, options);
-
 		},
 		ui : {
 			/*selectGroups	: 'div[data-fields="selectGroups"]',
@@ -99,17 +95,12 @@ define(function(require) {
 					editorAttrs  : {'checked':'checked',disabled:true},
 					title : 'Is Allowed ?'
 					},
-
 			}
 		},
 		render: function(options) {
 			var that = this;
-
 			Backbone.Form.prototype.render.call(this, options);
-			if(!this.model.isNew()){
-				//this.setUpSwitches();
-			}
-
+			
 		},
 		setupFieldsforEditModule : function(){
 			var groupsNVList=[],usersNVList =[];
@@ -135,19 +126,18 @@ define(function(require) {
 		getPlugginAttr :function(autocomplete, options){
 			var that = this;
 			if(!autocomplete)
-				return{tags : true,width :'220px',multiple: true,minimumInputLength: 1};
+				return{ tags : true, width :'220px', multiple: true, minimumInputLength: 1 };
 			else {
 				return {
 					closeOnSelect : true,
 					multiple: true,
 					minimumInputLength: 0,
 					tokenSeparators: [",", " "],
-					/*tags : modelDefaultTags,*/
 					initSelection : function (element, callback) {
 						var data = [];
 						_.each(options.permList,function (elem) {
-								data.push({id: elem[options.idKey], text: elem[options.textKey]});
-							});
+							data.push({id: elem[options.idKey], text: elem[options.textKey]});
+						});
 						callback(data);
 					},
 					createSearchChoice: function(term, data) {
@@ -170,16 +160,16 @@ define(function(require) {
 						cache: false,
 						data: function (term, page) {
 							//To be checked
-							return {name : term, isVisible : XAEnums.VisibilityStatus.STATUS_VISIBLE.value};
-//							return {loginId : term};
+							return { name : term, isVisible : XAEnums.VisibilityStatus.STATUS_VISIBLE.value };
 						},
 						results: function (data, page) {
 							var results = [];
 							if(data.resultSize != "0"){
-								if(!_.isUndefined(data.vXGroups))
+								if(!_.isUndefined(data.vXGroups)){
 									results = data.vXGroups.map(function(m, i){	return {id : m.id+"", text: m.name};	});
-								else if(!_.isUndefined(data.vXUsers))
+								} else if(!_.isUndefined(data.vXUsers)){
 									results = data.vXUsers.map(function(m, i){	return {id : m.id+"", text: m.name};	});
+								}
 							}
 							return { results : results};
 						},
@@ -199,12 +189,7 @@ define(function(require) {
 						return result.text;
 					},
 					formatNoMatches : function(term){
-						switch (term){
-							//case  that.type.DATABASE :return localization.tt("msg.enterAlteastOneCharactere");
-							//case  that.type.TABLE :return localization.tt("msg.enterAlteastOneCharactere");
-							//case  that.type.COLUMN :return localization.tt("msg.enterAlteastOneCharactere");
-							default : return "No Matches found";
-						}
+						return "No Matches found";
 					}
 				};
 			}
@@ -223,19 +208,18 @@ define(function(require) {
 			var selectedVals = (!_.isNull(objValsStr)) ? objValsStr.toString().split(',') : [];
 			var selectedIdList=[];
 			selectedVals = _.each(selectedVals, function(eachVal){
-								//Ignoring any non existing Group Name
-								if(_.isNumber(parseInt(eachVal))  && !_.isNaN(parseInt(eachVal))){
-									selectedIdList.push(Number(eachVal));
-								}
-							});
+				//Ignoring any non existing Group Name
+				if(_.isNumber(parseInt(eachVal))  && !_.isNaN(parseInt(eachVal))){
+					selectedIdList.push(Number(eachVal));
+				}
+			});
 			var modelPermList = options.permList;
 			var modelPerms = _.unique(_.pluck(options.permList, options.idKey));
 			if(!_.isEmpty(selectedIdList)){
 				//Look for equals
 				if(_.isEqual(selectedIdList,modelPerms)) {
 					//No changes in Selected Users
-				}else{
-
+				} else {
 					//look for new values -
 					//loop through each new element and check if it has any non matching ids
 					var diff = _.filter(selectedIdList, function(value){ return !_.contains(modelPerms, value); });
@@ -261,7 +245,7 @@ define(function(require) {
 					}
 				}
 
-			}else{
+			} else {
 				//Remove permissions from all objects which earlier had permission
 				_.each(options.permList, function(perm){
 					perm.isAllowed = 0;
@@ -270,5 +254,6 @@ define(function(require) {
 
 		}
 	});
+	
 	return ModulePermissionForm;
 });

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
index 18d7c4c..354992a 100644
--- a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermsTableLayout.js
@@ -27,10 +27,10 @@ define(function(require){
 	var XAGlobals 		= require('utils/XAGlobals');
 	var SessionMgr 		= require('mgrs/SessionMgr');
 	var XAUtil			= require('utils/XAUtils');
+	var localization	= require('utils/XALangSupport');
 
 	var XABackgrid		= require('views/common/XABackgrid');
 	var XATableLayout	= require('views/common/XATableLayout');
-	var localization	= require('utils/XALangSupport');
 	var RangerServiceDef	= require('models/RangerServiceDef');
 	var UserPermission 		= require('models/UserPermission');
 	var ModulePermsTableLayoutTmpl = require('hbs!tmpl/permissions/ModulePermsTableLayout_tmpl');
@@ -44,25 +44,22 @@ define(function(require){
 	{
 		_viewName : 'ModulePermsTableLayout',
 
-	template: ModulePermsTableLayoutTmpl,
+		template: ModulePermsTableLayoutTmpl,
 
 		templateHelpers : function(){
-			return {
-				//rangerService:this.rangerService
-			};
 		},
 
-	breadCrumbs : function(){
-		return [XALinks.get('ModulePermissions')];
+		breadCrumbs : function(){
+			return [XALinks.get('ModulePermissions')];
 		},
 
 		/** Layout sub regions */
-	regions: {
+		regions: {
 			'rTableList'	: 'div[data-id="r_table"]',
 		},
 
-	// /** ui selector cache */
-	ui: {
+		/** ui selector cache */
+		ui: {
 			'btnShowMore' : '[data-id="showMore"]',
 			'btnShowLess' : '[data-id="showLess"]',
 			'visualSearch' : '.visual_search'
@@ -77,13 +74,14 @@ define(function(require){
 			return events;
 		},
 
-	/**
+		/**
 		* intialize a new RangerPolicyTableLayout Layout
 		* @constructs
 		*/
 		initialize: function(options) {
 			console.log("initialized a ModulePermsTableLayout Layout");
-			//_.extend(this, _.pick(options));
+			
+			_.extend(this, _.pick(options));
 			this.bindEvents();
 		},
 
@@ -148,10 +146,9 @@ define(function(require){
 					label : localization.tt("lbl.users"),
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue, model) {
-							if(!_.isUndefined(rawValue))
-								return XAUtil.showGroupsOrUsers(rawValue, model, 'users');
-							else
-								return '--';
+							return !_.isUndefined(rawValue) ? 
+									XAUtil.showGroupsOrUsers(rawValue, model, 'users')
+									:  '--';
 						}
 					}),
 					editable : false,
@@ -200,12 +197,8 @@ define(function(require){
 		},
 		addVisualSearch : function(){
 			var that = this;
-			//var resourceSearchOpt = _.map(this.collection.models, function(resource){ return XAUtil.capitaliseFirstLetter(resource.module) });
-
 			var searchOpt = ['Module Name','Group Name','User Name'];
-
 			var serverAttrName  = [{text : "Module Name", label :"module"},{text : "Group Name", label :"groupName"},{text : "User Name", label :"userName"}];
-
 			var pluginAttr = {
 				      placeholder :localization.tt('h.searchForPermissions'),
 				      container : this.ui.visualSearch,
@@ -213,17 +206,7 @@ define(function(require){
 				      callbacks :  {
 					  valueMatches :function(facet, searchTerm, callback) {
 								switch (facet) {
-									/*case 'Module Name':
-										callback(that.getActiveStatusNVList());
-										break;
-									case 'Group Name':
-										callback(XAUtil.enumToSelectLabelValuePairs(XAEnums.AuthType));
-										break;
-									case 'User Name' :
-										setTimeout(function () { XAUtil.displayDatepicker(that.ui.visualSearch, callback); }, 0);
-										break;*/
 								}
-
 							}
 				      }
 				};
@@ -234,6 +217,7 @@ define(function(require){
 				if(obj.label != XAEnums.ActiveStatus.STATUS_DELETED.label)
 					return obj;
 			});
+			
 			return _.map(activeStatusList, function(status) { return { 'label': status.label, 'value': status.label.toLowerCase()}; })
 		},
 		/** on close */

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
index 42d27b1..ff72ced 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
@@ -33,11 +33,12 @@ define(function(require) {
 	var VXGroup			= require('models/VXGroup');
 	var VXGroupList			= require('collections/VXGroupList');
 	var VXUserList			= require('collections/VXUserList');
+	
 	require('bootstrap-editable');
 	require('esprima');
     	
-	var FormInputItem = Backbone.Marionette.ItemView.extend({
-		_msvName : 'FormInputItem',
+	var PermissionItem = Backbone.Marionette.ItemView.extend({
+		_msvName : 'PermissionItem',
 		template : require('hbs!tmpl/policies/PermissionItem'),
 		tagName : 'tr',
 		templateHelpers : function(){
@@ -85,16 +86,14 @@ define(function(require) {
 			//render permissions and policy conditions
 			if(this.rangerServiceDefModel.get('name') == XAEnums.ServiceType.SERVICE_TAG.label){
 				this.renderPermsForTagBasedPolicies()
-			}else{
+			} else {
 				this.renderPerms();
 			}
 			this.renderPolicyCondtion();
-			//this.initializePlugins();
 		},
 		setupFormForEditMode : function() {
 			this.accessItems = _.map(this.accessTypes, function(perm){ 
-				if(!_.isUndefined(perm)) 
-					return {'type':perm.name,isAllowed : false}
+				if(!_.isUndefined(perm)) return {'type':perm.name, isAllowed : false}
 			});
 			if(this.model.has('editMode') && this.model.get('editMode')){
 				if(!_.isUndefined(this.model.get('groupName')) && !_.isNull(this.model.get('groupName'))){
@@ -142,7 +141,6 @@ define(function(require) {
 		dropDownChange : function($select){
 			var that = this;
 			$select.on('change',function(e){
-		//		console.log(e.currentTarget.value);
 				var name = ($(e.currentTarget).attr('data-js') == that.ui.selectGroups.attr('data-js')) ? 'group': 'user';
 				that.checkDirtyFieldForDropDown(e);
 				
@@ -152,7 +150,7 @@ define(function(require) {
 						gNameArr = _.without(that.model.get(name+'Name').split(','), e.removed.text);
 					if(!_.isEmpty(gNameArr)){
 						that.model.set(name+'Name',gNameArr.join(','));
-					}else{
+					} else {
 						that.model.unset(name+'Name');
 					}
 					that.toggleAddButton(e);
@@ -185,6 +183,7 @@ define(function(require) {
 			var tags = list.map(function(m){
 				return { id : m.id+"" , text : m.get('name')};
 			});
+			
 			$select.select2({
 				closeOnSelect : true,
 				placeholder : placeholder,
@@ -194,8 +193,6 @@ define(function(require) {
 				tags : tags, 
 				initSelection : function (element, callback) {
 					var data = [];
-					console.log(list);
-					
 					$(element.val().split(",")).each(function () {
 						var obj = _.findWhere(tags,{text:this});
 						data.push({id: obj.id, text: this})
@@ -213,12 +210,14 @@ define(function(require) {
 						//Get selected values of groups/users dropdown
 						selectedVals = that.getSelectdValues($select, typeGroup);
 						if(data.resultSize != "0"){
-							if(typeGroup)
+							if(typeGroup){
 								results = data.vXGroups.map(function(m, i){	return {id : m.id+"", text: m.name};	});
-							else
+							} else {
 								results = data.vXUsers.map(function(m, i){	return {id : m.id+"", text: m.name};	});
-							if(!_.isEmpty(selectedVals))
+							}
+							if(!_.isEmpty(selectedVals)){
 								results = XAUtil.filterResultByText(results, selectedVals);
+							}
 							return {results : results};
 						}
 						return {results : results};
@@ -257,7 +256,6 @@ define(function(require) {
 					}
 //			    	that.checkDirtyFieldForGroup(values);
 					
-					
 					var permTypeArr = [];
 					var valArr = _.map(values, function(id){
 						if(!_.isUndefined(id)){
@@ -303,7 +301,7 @@ define(function(require) {
 			this.ui.addPerms.attr('title','Components Permissions')
 			this.ui.delegatedAdmin.parent('td').hide();
 			this.perms =  _.map(this.accessTypes,function(m){return {text:m.label, value:m.name};});
-//			this.perms.push({'value' : -1, 'text' : 'Select/Deselect All'});
+
 			//create x-editable for permissions
 			this.ui.addPerms.editable({
 			    emptytext : 'Add Permissions',
@@ -329,7 +327,6 @@ define(function(require) {
 					}
 //			    	that.checkDirtyFieldForGroup(values);
 					
-					
 					var permTypeArr = [];
 					var valArr = _.map(values, function(id){
 						if(!_.isUndefined(id)){
@@ -383,10 +380,11 @@ define(function(require) {
 		clickOnPermissions : function(that) {
 			var selectAll = true;
 			var checklist = that.$('.editable-checklist').find('input[type="checkbox"]')
+			
 			_.each(checklist,function(checkbox){ if($(checkbox).val() != -1 && !$(checkbox).is(':checked')) selectAll = false;})
 			if(selectAll){
 				that.$('.editable-checklist').find('input[type="checkbox"][value="-1"]').prop('checked',true)
-			}else{
+			} else {
 				that.$('.editable-checklist').find('input[type="checkbox"][value="-1"]').prop('checked',false)
 			}
 			//for selectAll functionality
@@ -424,6 +422,7 @@ define(function(require) {
 							return; 
 						}
 						_.each(value, function(val, name){ if(!_.isEmpty(val)) continue_ = true; });
+						
 						if(continue_){
 							//Generate html to show on UI
 							var html = _.map(value, function(val,name) {
@@ -449,7 +448,7 @@ define(function(require) {
 							$(this).html(html);
 							that.ui.addConditionsSpan.find('i').attr('class', 'icon-pencil');
 							that.ui.addConditionsSpan.attr('title','edit');
-						}else{
+						} else {
 							that.model.unset('conditions');
 							$(this).empty();
 							that.ui.addConditionsSpan.find('i').attr('class', 'icon-plus');
@@ -491,11 +490,6 @@ define(function(require) {
 		getSelectdValues : function($select, typeGroup){
 			var vals = [],selectedVals = [];
 			var name = typeGroup ? 'group' : 'user';
-//			this.collection.each(function(m){
-//				if(!_.isUndefined(m.get(name+'Name')) && !_.isNull(m.get(name+'Name'))){
-//					vals.push.apply(vals, m.get(name+'Name').split(','));
-//				}
-//			});
 			if(!_.isEmpty($select.select2('data')))
 				selectedVals = _.map($select.select2('data'),function(obj){ return obj.text});
 			vals.push.apply(vals , selectedVals);
@@ -513,10 +507,23 @@ define(function(require) {
 			//Set Delegated Admin value 
 			if(!_.isUndefined($el.find('input').data('js'))){
 				this.model.set('delegateAdmin',$el.is(':checked'));
-				return;
 			}
-		},
+			//select/deselect all functionality
+			if(this.checkAll($el.find('input[type="checkbox"][value!="-1"]'))){
+				$el.find('input[type="checkbox"][value="-1"]').prop('checked', true)
+			} else {
+			    $el.find('input[type="checkbox"][value="-1"]').prop('checked', false)
+			}
 
+		},
+		checkAll : function($inputs){
+			 var checkall = true;
+			 $inputs.each(function(idx, input){
+			    if(!checkall)   return;
+			 	checkall = $(input).is(':checked') ? true : false
+			 });
+			 return checkall;
+		},
 		checkDirtyFieldForCheckBox : function(perms){
 			var permList = [];
 			if(!_.isUndefined(this.model.get('_vPermList')))
@@ -538,16 +545,16 @@ define(function(require) {
 				if( !_.isUndefined(e.added)){
 					if((grpTemp.length ) == this.groupList.length && ((usrTemp.length) == this.userList.length)){
 						$('[data-action="addGroup"]').hide();
-					}else{
+					} else {
 						$('[data-action="addGroup"]').show();
 					}
 				} 
 				if(!_.isUndefined(e.removed))
 					$('[data-action="addGroup"]').show();
-			}else{
+			} else {
 				if((grpTemp.length ) == this.groupList.length && ((usrTemp.length) == this.userList.length)){
 					$('[data-action="addGroup"]').hide();
-				}else{
+				} else {
 					$('[data-action="addGroup"]').show();
 				}
 			}
@@ -577,7 +584,7 @@ define(function(require) {
 
 
 	return Backbone.Marionette.CompositeView.extend({
-		_msvName : 'FormInputItemList',
+		_msvName : 'PermissionItemList',
 		template : require('hbs!tmpl/policies/PermissionList'),
 		templateHelpers :function(){
 			return {
@@ -589,7 +596,7 @@ define(function(require) {
 			if(!item){
 				return;
 			}
-			return FormInputItem;
+			return PermissionItem;
 		},
 		itemViewContainer : ".js-formInput",
 		itemViewOptions : function() {
@@ -612,16 +619,11 @@ define(function(require) {
 				this.collection.add(new Backbone.Model());
 		},
 		onRender : function(){
-//			this.toggleAddButton();
-			//this.initializePlugins();
 		},
 
 		addNew : function(){
 			var that =this;
-//			if(this.groupList.length > this.collection.length && (this.userList.length > this.collection.length)){
-				this.collection.add(new Backbone.Model());
-//				this.toggleAddButton();
-//			}
+			this.collection.add(new Backbone.Model());
 		},
 		toggleAddButton : function(){
 			var groupNames=[], userNames=[];
@@ -635,17 +637,18 @@ define(function(require) {
 					userNames.push.apply(userNames,temp);
 				}
 			});
-			if(groupNames.length == this.groupList.length && userNames.length == this.userList.length )
+			if(groupNames.length == this.groupList.length && userNames.length == this.userList.length ){
 				this.$('button[data-action="addGroup"]').hide();
-			else
+			} else {
 				this.$('button[data-action="addGroup"]').show();
+			}
 		},
 		getPermHeaders : function(){
 			var permList = [];
 			if(this.rangerServiceDefModel.get('name') != XAEnums.ServiceType.SERVICE_TAG.label){
 				permList.unshift(localization.tt('lbl.delegatedAdmin'));
 				permList.unshift(localization.tt('lbl.permissions'));
-			}else{
+			} else {
 				permList.unshift(localization.tt('lbl.componentPermissions'));
 			}
 			if(!_.isEmpty(this.rangerServiceDefModel.get('policyConditions'))){

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
index cc11cef..a4454bd 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
@@ -49,10 +49,11 @@ define(function(require){
     	},
     	breadCrumbs :function(){
     		var name  = this.rangerServiceDefModel.get('name') != XAEnums.ServiceType.SERVICE_TAG.label ? 'ServiceManager' : 'TagBasedServiceManager';
-    		if(this.model.isNew())
+    		if(this.model.isNew()){
     			return [XALinks.get(name),XALinks.get('ManagePolicies',{model : this.rangerService}),XALinks.get('PolicyCreate')];
-    		else
+    		} else {
     			return [XALinks.get(name),XALinks.get('ManagePolicies',{model : this.rangerService}),XALinks.get('PolicyEdit')];
+    		}
     	} ,        
 
 		/** Layout sub regions */
@@ -123,13 +124,8 @@ define(function(require){
 			XAUtil.preventNavigation(localization.tt('dialogMsg.preventNavPolicyForm'),this.rForm.$el);
 		},
 		popupCallBack : function(msg,validateObj){
-			var that = this;
 			XAUtil.alertPopup({
 				msg :msg,
-				callback : function(){
-				//	if(validateObj.auditLoggin)
-				//		that.savePolicy();
-				}
 			});
 		},
 		onSave: function(){
@@ -159,39 +155,36 @@ define(function(require){
 			if(!valid){
 				if((!validateObj.groupSet && !validateObj.userSet) && (validateObj.condSet)) {
 					this.popupCallBack(localization.tt('msg.addUserOrGroupForPC'),validateObj);
-				}else if((!validateObj.groupSet && !validateObj.userSet) && (validateObj.permSet)) {
+				} else if((!validateObj.groupSet && !validateObj.userSet) && (validateObj.permSet)) {
 					this.popupCallBack(localization.tt('msg.addUserOrGroup'),validateObj);
 					
-				}else if(validateObj.groupSet && (!validateObj.permSet)){
+				} else if(validateObj.groupSet && (!validateObj.permSet)){
 					this.popupCallBack(localization.tt('msg.addGroupPermission'),validateObj);
-				}else if((!validateObj.groupSet) && (validateObj.permSet)) {
+				} else if((!validateObj.groupSet) && (validateObj.permSet)) {
 					this.popupCallBack(localization.tt('msg.addGroup'),validateObj);
 						
-				}else if(validateObj.userSet && (!validateObj.userPerm)){
+				} else if(validateObj.userSet && (!validateObj.userPerm)){
 					this.popupCallBack(localization.tt('msg.addUserPermission'),validateObj);
-				}else if((!validateObj.userSet) && (validateObj.userPerm)) {
+				} else if((!validateObj.userSet) && (validateObj.userPerm)) {
 					this.popupCallBack(localization.tt('msg.addUser'),validateObj);
 						
-				}else if((!validateObj.auditLoggin) && (!validateObj.groupPermSet)){
+				} else if((!validateObj.auditLoggin) && (!validateObj.groupPermSet)){
 					return true;
-//					XAUtil.alertPopup({ msg :localization.tt('msg.yourAuditLogginIsOff') });
 				}else{
-//					this.savePolicy();
 					return true;
 				}
-			}else{
+			} else {
 				if(validateObj.groupSet && (!validateObj.permSet)){
 					this.popupCallBack(localization.tt('msg.addGroupPermission'),validateObj);
-				}else if((!validateObj.groupSet) && (validateObj.permSet)) {
+				} else if((!validateObj.groupSet) && (validateObj.permSet)) {
 					this.popupCallBack(localization.tt('msg.addGroup'),validateObj);
 						
-				}else if(validateObj.userSet && (!validateObj.userPerm)){
+				} else if(validateObj.userSet && (!validateObj.userPerm)){
 					this.popupCallBack(localization.tt('msg.addUserPermission'),validateObj);
-				}else if((!validateObj.userSet) && (validateObj.userPerm)) {
+				} else if((!validateObj.userSet) && (validateObj.userPerm)) {
 					this.popupCallBack(localization.tt('msg.addUser'),validateObj);
 						
-				}else{
-//					this.savePolicy();
+				} else {
 					return true;
 				}
 			}
@@ -238,7 +231,6 @@ define(function(require){
 		onDelete :function(){
 			var that = this;
 			XAUtil.confirmPopup({
-				//msg :localize.tt('msg.confirmDelete'),
 				msg :'Are you sure want to delete ?',
 				callback : function(){
 					XAUtil.blockUI();
@@ -251,11 +243,11 @@ define(function(require){
 						},
 						error: function (model, response, options) {
 							XAUtil.blockUI('unblock');
-							if ( response && response.responseJSON && response.responseJSON.msgDesc){
+							if (response && response.responseJSON && response.responseJSON.msgDesc){
 								    XAUtil.notifyError('Error', response.responseJSON.msgDesc);
-							    }else
+							} else {
 							    	XAUtil.notifyError('Error', 'Error deleting Policy!');
-							    console.log("error");
+							}
 						}
 					});
 				}
@@ -265,8 +257,6 @@ define(function(require){
 		onClose: function(){
 			XAUtil.allowNavigation();
 		}
-
 	});
-
 	return RangerPolicyCreate;
 });

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/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 55ea285..59aac0d 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js
@@ -31,7 +31,6 @@ define(function(require){
 	var XABackgrid		= require('views/common/XABackgrid');
 	var XATableLayout	= require('views/common/XATableLayout');
 	var localization	= require('utils/XALangSupport');
-	var vFolderInfo = require('views/folders/FolderInfo');
 	var RangerService		= require('models/RangerService');
 	var RangerServiceDef	= require('models/RangerServiceDef');
 	var RangerPolicy 		= require('models/RangerPolicy');

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js b/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
index f7c72dc..bac6c34 100644
--- a/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
@@ -22,13 +22,13 @@ define(function(require){
     'use strict';
 
 	var Backbone			= require('backbone');
-
 	var XALinks 			= require('modules/XALinks');
 	var XAEnums 			= require('utils/XAEnums');
 	var XAUtil				= require('utils/XAUtils');
 	var SessionMgr 			= require('mgrs/SessionMgr');
+	
 	var RangerServiceList 	= require('collections/RangerServiceList');
-	var RangerService 	= require('models/RangerService');
+	var RangerService 		= require('models/RangerService');
 	
 	var ServicemanagerlayoutTmpl = require('hbs!tmpl/common/ServiceManagerLayout_tmpl');
 	return Backbone.Marionette.Layout.extend(
@@ -39,11 +39,10 @@ define(function(require){
     	template: ServicemanagerlayoutTmpl,
 
 		templateHelpers: function(){
-			var groupedServices = this.services.groupBy("type");
 			return {
-				operation : SessionMgr.isSystemAdmin() || SessionMgr.isKeyAdmin(),
+				operation 	: SessionMgr.isSystemAdmin() || SessionMgr.isKeyAdmin(),
 				serviceDefs : this.collection.models,
-				services : groupedServices
+				services 	: this.services.groupBy("type")
 			};
 		},
     	breadCrumbs :function(){

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/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 8491a79..623ae03 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -105,7 +105,6 @@ define(function(require) {
 			console.log("initialized a AuditLayout Layout");
 
 			_.extend(this, _.pick(options, 'accessAuditList','tab'));
-		//	this.initializePolling();
 			this.bindEvents();
 			this.currentTab = '#'+this.tab;
 			var date = new Date().toString();
@@ -119,20 +118,13 @@ define(function(require) {
 			//this.listenTo(this.collection, "change:foo", this.render, this);
 		},
 		initializeCollection : function(){
-			
 			this.collection.fetch({
 				reset : true,
 				cache : false
 			});
 		},
-		initializePolling : function(){
-			this.timerId = setInterval(function(){
-//				that.onRefresh(this.accessAuditList);
-				console.log('polling collection..');
-			},XAGlobals.settings.AUDIT_REPORT_POLLING);
-		},
 		initializeServiceDefColl : function() {
-			this.serviceDefList 			= new RangerServiceDefList();
+			this.serviceDefList	= new RangerServiceDefList();
 			this.serviceDefList.fetch({ 
 				cache : false,
 				async:false
@@ -146,15 +138,15 @@ define(function(require) {
 				this.onTabChange();
 				this.ui.tab.find('li[class="active"]').removeClass();
 				this.ui.tab.find('[href="'+this.currentTab+'"]').parent().addClass('active');
-				
-			}else{
+			} else {
 				this.renderBigDataTable();
 				this.addSearchForBigDataTab();
 				this.modifyTableForSubcolumns();
 			}
 		 },
-		 displayDatepicker : function ($el, callback) {
-		    var input = $el.find('.search_facet.is_editing input.search_facet_input');
+		displayDatepicker : function ($el, callback) {
+			var input = $el.find('.search_facet.is_editing input.search_facet_input');
+		    
 		    input.datepicker({
 		    	autoclose : true,
 		    	dateFormat: 'yy-mm-dd'
@@ -168,7 +160,7 @@ define(function(require) {
 		    	input.datepicker("destroy");
 		    });
 		    input.datepicker('show');
-		  },
+		},
 		modifyTableForSubcolumns : function(){
 			this.$el.find('[data-id="r_tableList"] table thead').prepend('<tr>\
 					<th class="renderable pid"></th>\
@@ -186,17 +178,17 @@ define(function(require) {
 		},
 		renderDateFields : function(){
 			var that = this;
+
 			this.ui.startDate.datepicker({
 				autoclose : true
-				//language : $.cookie().lang
 			}).on('changeDate', function(ev) {
 				that.ui.endDate.datepicker('setStartDate', ev.date);
 			}).on('keydown',function(){
 				return false;
 			});
+			
 			this.ui.endDate.datepicker({
 				autoclose : true
-				//language : $.cookie().lang
 			}).on('changeDate', function(ev) {
 				that.ui.startDate.datepicker('setEndDate', ev.date);
 			}).on('keydown',function(){
@@ -205,60 +197,60 @@ define(function(require) {
 		},
 		onTabChange : function(e){
 			var that = this, tab;
-			if(!_.isUndefined(e))
-				tab = $(e.currentTarget).attr('href');
-			else
-				tab = this.currentTab;
+			tab = !_.isUndefined(e) ? $(e.currentTarget).attr('href') : this.currentTab;
 			this.$el.parents('body').find('.datepicker').remove();
 			switch (tab) {
-			case "#bigData":
-				this.currentTab = '#bigData';
-				this.ui.visualSearch.show();
-				this.ui.visualSearch.parents('.well').show();
-				this.renderBigDataTable();
-				this.modifyTableForSubcolumns();
-				if(this.accessAuditList.length <= 0){
-					this.accessAuditList.fetch({
-						cache : false
+				case "#bigData":
+					this.currentTab = '#bigData';
+					this.ui.visualSearch.show();
+					this.ui.visualSearch.parents('.well').show();
+					this.renderBigDataTable();
+					this.modifyTableForSubcolumns();
+					if(this.accessAuditList.length <= 0){
+						this.accessAuditList.fetch({
+							cache : false
+						});
+					}
+					this.addSearchForBigDataTab();
+					this.listenTo(this.accessAuditList, "request", that.updateLastRefresh)
+					break;
+				case "#admin":
+					this.currentTab = '#admin';
+					this.trxLogList = new VXTrxLogList();
+					this.renderAdminTable();
+					if(_.isUndefined(App.sessionId)){
+			     	    this.trxLogList.fetch({
+							   cache : false
+						});
+					}
+					this.addSearchForAdminTab();
+					this.listenTo(this.trxLogList, "request", that.updateLastRefresh)
+					break;
+				case "#loginSession":
+					this.currentTab = '#loginSession';
+					this.authSessionList = new VXAuthSession();
+					this.renderLoginSessionTable();
+					//Setting SortBy as id and sortType as desc = 1
+					this.authSessionList.setSorting('id',1); 
+					this.authSessionList.fetch({
+						cache:false,
 					});
-				}
-				this.addSearchForBigDataTab();
-				break;
-			case "#admin":
-				this.currentTab = '#admin';
-				this.trxLogList = new VXTrxLogList();
-				this.renderAdminTable();
-				if(_.isUndefined(App.sessionId)){
-		     	    this.trxLogList.fetch({
-						   cache : false
+					this.addSearchForLoginSessionTab();
+					this.listenTo(this.authSessionList, "request", that.updateLastRefresh)
+					break;
+				case "#agent":
+					this.currentTab = '#agent';
+					this.policyExportAuditList = new VXPolicyExportAuditList();	
+					var params = { priAcctId : 1 };
+					that.renderAgentTable();
+					this.policyExportAuditList.setSorting('createDate',1);
+					this.policyExportAuditList.fetch({
+						cache : false,
+						data :params
 					});
-				}
-				this.addSearchForAdminTab();
-					
-				break;
-			case "#loginSession":
-				this.currentTab = '#loginSession';
-				this.authSessionList = new VXAuthSession();
-				this.renderLoginSessionTable();
-				//Setting SortBy as id and sortType as desc = 1
-				this.authSessionList.setSorting('id',1); 
-				this.authSessionList.fetch({
-					cache:false,
-				});
-				this.addSearchForLoginSessionTab();
-				break;
-			case "#agent":
-				this.currentTab = '#agent';
-				this.policyExportAuditList = new VXPolicyExportAuditList();	
-				var params = { priAcctId : 1 };
-				that.renderAgentTable();
-				this.policyExportAuditList.setSorting('createDate',1);
-				this.policyExportAuditList.fetch({
-					cache : false,
-					data :params
-				});
-				this.addSearchForAgentTab();
-				break;	
+					this.addSearchForAgentTab();
+					this.listenTo(this.policyExportAuditList, "request", that.updateLastRefresh)
+					break;	
 			}
 			var lastUpdateTime = Globalize.format(new Date(),  "MM/dd/yyyy hh:mm:ss tt");
 			that.ui.lastUpdateTimeLabel.html(lastUpdateTime);
@@ -289,12 +281,12 @@ define(function(require) {
 					valueMatches : function(facet, searchTerm, callback) {
 						var auditList = [];
 						_.each(XAEnums.ClassTypes, function(obj){
-							if((obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value) ||
-									(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value) ||
-									(obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_POLICY.value) ||
-									(obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_SERVICE.value) ||
-									(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value) || 
-									(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value))
+							if((obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value) 
+									|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value) 
+									|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_POLICY.value) 
+									|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_SERVICE.value)
+									|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value) 
+									|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value))
 								auditList.push({label :obj.label, value :obj.value+''});
 						});
 						
@@ -333,7 +325,6 @@ define(function(require) {
 								callback([today]);
 								break;
 				            }
-				            	
 					}
 			      }
 			};
@@ -354,12 +345,12 @@ define(function(require) {
 			
 			var auditList = [],query = '';
 			_.each(XAEnums.ClassTypes, function(obj){
-				if((obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value) ||
-						(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value) ||
-						(obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_POLICY.value) ||
-						(obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_SERVICE.value) ||
-						(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value) || 
-						(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value))
+				if((obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value) 
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value) 
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_POLICY.value) 
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_SERVICE.value) 
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value)  
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value))
 					auditList.push({label :obj.label, value :obj.label+''});
 			});
 			if(!_.isUndefined(App.sessionId)){
@@ -565,7 +556,7 @@ define(function(require) {
 								userName :self.model.get('owner'),
 								action : action
 							});
-						}else{
+						} else {
 							var view = new vOperationDiffDetail({
 								collection : fullTrxLogListForTrxId,
 								classType : self.model.get('objectClassType'),
@@ -587,9 +578,6 @@ define(function(require) {
 						modal.$el.addClass('modal-diff').attr('tabindex',-1);
 						modal.$el.find('.cancel').hide();
 					});
-					
-					
-					
 				}
 			});
 			this.ui.tableList.addClass("clickable");
@@ -607,15 +595,14 @@ define(function(require) {
 		getAdminTableColumns : function(){
 			var auditList = [];
 			_.each(XAEnums.ClassTypes, function(obj){
-				if((obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value) ||
-					(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value) ||
-					(obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_POLICY.value) ||
-					(obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_SERVICE.value) ||
-					(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value) || 
-					(obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value))
+				if((obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value) 
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value)
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_POLICY.value) 
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_RANGER_SERVICE.value)
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value)
+						|| (obj.value == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value))
 				auditList.push({text :obj.label, id :obj.value});
 			});
-			console.log(auditList);
 			var cols = {
 				operation : {
 					label : localization.tt("lbl.operation"),
@@ -631,7 +618,7 @@ define(function(require) {
 								label = XAUtils.enumValueToLabel(XAEnums.ClassTypes,rawValue), html = '';
 							if(rawValue == XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value || rawValue == XAEnums.ClassTypes.CLASS_TYPE_RANGER_SERVICE.value)
 								html = 	'Service '+action+'d '+'<b>'+name+'</b>';
-							if(rawValue == XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value|| rawValue == XAEnums.ClassTypes.CLASS_TYPE_RANGER_POLICY.value)
+							if(rawValue == XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value || rawValue == XAEnums.ClassTypes.CLASS_TYPE_RANGER_POLICY.value)
 								html = 	'Policy '+action+'d '+'<b>'+name+'</b>';
 							if(rawValue == XAEnums.ClassTypes.CLASS_TYPE_XA_USER.value)
 								html = 	'User '+action+'d '+'<b>'+name+'</b>';
@@ -672,7 +659,6 @@ define(function(require) {
 					cell: "String",
 					click : false,
 					drag : false,
-					//sortable:false,
 					editable:false,
                     sortType: 'toggle',
                     direction: 'descending',
@@ -692,14 +678,16 @@ define(function(require) {
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue) {
 							var html = '';
-							if(rawValue =='create')
+							if(rawValue =='create'){
 								html = 	'<label class="label label-success">'+rawValue+'</label>';
-							else if(rawValue == 'update')
+							} else if(rawValue == 'update'){
 								html = 	'<label class="label label-yellow">'+rawValue+'</label>';
-							else if(rawValue == 'delete')
+							}else if(rawValue == 'delete'){
 								html = 	'<label class="label label-important">'+rawValue+'</label>';
-							else
+							} else {
 								html = 	'<label class="label">'+rawValue+'</label>';
+							}
+
 							return html;
 						}
 					})
@@ -796,19 +784,10 @@ define(function(require) {
 								if(rawValue == -1){
 									return '--';
 								}	
-								/*var rangerService = new RangerService();
-								rangerService.urlRoot += '/name/'+model.get('repoName'); 
-								rangerService.fetch({
-								  cache : false,
-								  async : false
-								});*/
-
-//								if (SessionMgr.isKeyAdmin()) {
-									var serviceDef = that.serviceDefList.findWhere({'id' : model.get('repoType')})
-									if(_.isUndefined(serviceDef)){
-										return rawValue;
-									}
-//								}
+								var serviceDef = that.serviceDefList.findWhere({'id' : model.get('repoType')})
+								if(_.isUndefined(serviceDef)){
+									return rawValue;
+								}
 								var href = 'javascript:void(0)';
 								return '<a href="'+href+'" title="'+rawValue+'">'+rawValue+'</a>';
 							}
@@ -836,7 +815,6 @@ define(function(require) {
 						cell: "String",
 						click : false,
 						drag : false,
-					//	sortable:false,
 						editable:false
 					},
 					repoName : {
@@ -880,7 +858,6 @@ define(function(require) {
 						cell: "html",
 						click : false,
 						drag : false,
-			//			sortable:false,
 						editable:false,
 						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 							fromRaw: function (rawValue) {
@@ -888,10 +865,11 @@ define(function(require) {
 								_.each(_.toArray(XAEnums.AccessResult),function(m){
 									if(parseInt(rawValue) == m.value){
 										label=  m.label;
-										if(m.value == XAEnums.AccessResult.ACCESS_RESULT_ALLOWED.value)
+										if(m.value == XAEnums.AccessResult.ACCESS_RESULT_ALLOWED.value){
 											html = 	'<label class="label label-success">'+label+'</label>';
-										else 
+										} else {
 											html = 	'<label class="label label-important">'+label+'</label>';
+										} 
 									}	
 								});
 								return html;
@@ -957,7 +935,7 @@ define(function(require) {
 				if(obj.value !=  XAEnums.AuthType.AUTH_TYPE_UNKNOWN.value)
 					authTypeList.push({text :obj.label, id :obj.value});
 			});
-			console.log(authStatusList);
+
 			var cols = {
 				id : {
 					label : localization.tt("lbl.sessionId"),
@@ -965,7 +943,6 @@ define(function(require) {
 					href: function(model){
 						return '#!/reports/audit/loginSession/id/'+model.get('id');
 					},
-//					sortable:false,
 					editable:false,
 					sortType: 'toggle',
 					direction: 'descending'
@@ -985,12 +962,13 @@ define(function(require) {
 							_.each(_.toArray(XAEnums.AuthStatus),function(m){
 								if(parseInt(rawValue) == m.value){
 									label=  m.label;
-									if(m.value == 1)
+									if(m.value == 1){
 										html = 	'<label class="label label-success">'+label+'</label>';
-									else if(m.value == 2)
+									} else if(m.value == 2){
 										html = 	'<label class="label label-important">'+label+'</label>';
-									else
+									} else {
 										html = 	'<label class="label">'+label+'</label>';
+									}
 								}	
 							});
 							return html;
@@ -1039,7 +1017,6 @@ define(function(require) {
 				authTime : {
 					label : localization.tt("lbl.loginTime")+ '   ( '+this.timezone+' )',
 					cell: "String",
-				//	sortable:false,
 					editable:false,
 					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 						fromRaw: function (rawValue, model) {
@@ -1110,11 +1087,8 @@ define(function(require) {
 						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
 							fromRaw: function (rawValue, model) {
 								var html = rawValue;
-								if(rawValue > 400)
-									html = '<label class="label btn-danger">'+rawValue+'</label>';
-								else
-									html = '<label class="label btn-success">'+rawValue+'</label>';
-								return html;
+								return (rawValue > 400) ? '<label class="label btn-danger">'+rawValue+'</label>'
+										:	'<label class="label btn-success">'+rawValue+'</label>';
 							}
 						})
 					},
@@ -1142,6 +1116,7 @@ define(function(require) {
 				coll = this.authSessionList;
 				break;
 			case "#agent":
+				//TODO
 				params = { 'priAcctId' : 1 };
 				coll = this.policyExportAuditList;
 				break;	
@@ -1157,25 +1132,21 @@ define(function(require) {
 				}
 				
 			});
-			
-				
 		},
 		onSearch : function(e){
 			this.setCurrentTabCollection();
-			var resourceName= this.ui.resourceName.val();
-			var startDate 	= this.ui.startDate.val();
-			var endDate  	= this.ui.endDate.val();
-			var params = { 'startDate' : startDate , 'endDate' : endDate };
+			var resourceName= this.ui.resourceName.val(),
+				startDate 	= this.ui.startDate.val(),
+				endDate  	= this.ui.endDate.val(),
+				params = { 'startDate' : startDate , 'endDate' : endDate };
 			//After every search we need goto to first page
 			$.extend(this.collection.queryParams,params);
 			//collection.fetch({data: data, reset: true});
 
 			this.collection.state.currentPage = this.collection.state.firstPage;
-			
 			this.collection.fetch({
 				reset : true,
-				cache : false
-				//data : params,
+				cache : false,
 			});
 		},
 		setCurrentTabCollection : function(){
@@ -1201,13 +1172,12 @@ define(function(require) {
 			});
 		},
 
-		/*
-		 * onChangeRepository : function(){ this.onSearch(); },
-		 */
 		/** all post render plugin initialization */
 		initializePlugins : function() {
 		},
-
+		updateLastRefresh : function(){
+			this.ui.lastUpdateTimeLabel.html(Globalize.format(new Date(),  "MM/dd/yyyy hh:mm:ss tt"));
+		},
 		/** on close */
 		onClose : function() {
 			clearInterval(this.timerId);

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js b/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js
index 8f0f67e..6f1069d 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/LoginSessionDetail.js
@@ -35,9 +35,6 @@ define(function(require){
 		
     	template: LoginSessionDetail_tmpl,
         templateHelpers :function(){
-        	
-        	return {
-        	};
         },
     	/** ui selector cache */
     	ui: {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js b/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
index 1b66728..5f6d156 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/OperationDiffDetail.js
@@ -27,9 +27,9 @@ define(function(require){
 	var PolicyOperationDiff_tmpl 		= require('hbs!tmpl/reports/PolicyOperationDiff_tmpl');
 	var PolicyUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/PolicyUpdateOperationDiff_tmpl');
 	var PolicyDeleteUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/PolicyDeleteOperationDiff_tmpl');
-	var KnoxPolicyOperationDiff_tmpl 		= require('hbs!tmpl/reports/KnoxPolicyOperationDiff_tmpl');
-	var KnoxPolicyUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/KnoxPolicyUpdateOperationDiff_tmpl');
-	var KnoxPolicyDeleteUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/KnoxPolicyDeleteOperationDiff_tmpl');
+	var KnoxPolicyOperationDiff_tmpl 			= require('hbs!tmpl/reports/KnoxPolicyOperationDiff_tmpl');
+	var KnoxPolicyUpdateOperationDiff_tmpl 		= require('hbs!tmpl/reports/KnoxPolicyUpdateOperationDiff_tmpl');
+	var KnoxPolicyDeleteUpdateOperationDiff_tmpl= require('hbs!tmpl/reports/KnoxPolicyDeleteOperationDiff_tmpl');
 	var AssetOperationDiff_tmpl 		= require('hbs!tmpl/reports/AssetOperationDiff_tmpl');
 	var AssetUpdateOperationDiff_tmpl 	= require('hbs!tmpl/reports/AssetUpdateOperationDiff_tmpl');
 	var UserOperationDiff_tmpl 			= require('hbs!tmpl/reports/UserOperationDiff_tmpl');
@@ -76,7 +76,6 @@ define(function(require){
         				newGroupList 		: this.newGroupList,
         				previousGroupList 	: this.previousGroupList,
         				isGroup 			: this.isGroup
-        			
         		});
         	}
         	
@@ -109,7 +108,6 @@ define(function(require){
 			
 			_.extend(this, _.pick(options, 'classType','objectName','objectId','objectCreatedDate','action','userName'));
 			this.bindEvents();
-			//this.initializeDiffOperation();
 			this.getTemplateForView();
 			
 		},
@@ -126,7 +124,6 @@ define(function(require){
 			//remove last comma from Perms
 			_.each(this.ui.diff.find('ol li'),function(m){
 				var text = $(m).text().replace(/,(?=[^,]*$)/, '');
-				//$(m).text(text);
 				$(m).find('span').last().remove();
 			});
 			_.each(this.ui.policyDiff.find('ol li'),function(m){
@@ -140,9 +137,9 @@ define(function(require){
 				this.templateType=XAEnums.ClassTypes.CLASS_TYPE_XA_ASSET.value;
 				if(this.action == 'create'){
 					this.template = AssetOperationDiff_tmpl;
-				}else if(this.action == 'update'){
+				} else if(this.action == 'update'){
 					this.template = AssetUpdateOperationDiff_tmpl;
-				}else{
+				} else {
 					this.template = AssetOperationDiff_tmpl;
 				}
 				this.assetDiffOperation();
@@ -151,9 +148,9 @@ define(function(require){
 				this.templateType=XAEnums.ClassTypes.CLASS_TYPE_XA_RESOURCE.value;
 				if(this.action == 'create'){
 					this.template = PolicyOperationDiff_tmpl;
-				}else if(this.action == 'update'){
+				} else if(this.action == 'update'){
 					this.template = PolicyUpdateOperationDiff_tmpl;
-				}else{
+				} else{
 					this.template = PolicyDeleteUpdateOperationDiff_tmpl;
 				}
 				this.resourceDiffOperation();
@@ -163,9 +160,9 @@ define(function(require){
 					|| this.classType == XAEnums.ClassTypes.CLASS_TYPE_PASSWORD_CHANGE.value){
 				if(this.action == 'create' || this.action == 'delete'){
 					this.template = UserOperationDiff_tmpl;	
-				}else if(this.action == 'update' || this.action == "password change"){
+				} else if(this.action == 'update' || this.action == "password change"){
 					this.template = UserUpdateOperationDiff_tmpl;
-				}else{
+				} else{
 					this.template = UserOperationDiff_tmpl;
 				}
 				this.userDiffOperation();
@@ -174,14 +171,11 @@ define(function(require){
 			if(this.classType == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value){
 				if(this.action == 'create'){
 					this.template = GroupOperationDiff_tmpl;
-					//this.groupDiffOperation();
-				}else if(this.action == 'update'){
+				} else if(this.action == 'update'){
 					this.template = GroupUpdateOperationDiff_tmpl;
-				}else{
+				} else{
 					this.template = GroupOperationDiff_tmpl;
 				}
-				//this.template=GroupUpdateOperationDiff_tmpl;
-			//	this.groupDiffOperation();
 				this.templateType = XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value;
 			} 
 		},
@@ -210,8 +204,7 @@ define(function(require){
 			this.userList = [],this.groupList = [];
 			this.collection.each(function(m){
 				var attrName = m.get('attributeName'), type = 'permType';
-				if(attrName == "IP Address")
-					type = 'ipAddress';
+				if(attrName == "IP Address")	type = 'ipAddress';
 				if(m.get('attributeName') == 'Permission Type' || m.get('attributeName') == "IP Address"){
 					if(m.get('parentObjectClassType') == XAEnums.ClassTypes.CLASS_TYPE_XA_GROUP.value){
 						if(m.get('action') != 'delete'){
@@ -231,8 +224,7 @@ define(function(require){
 						}
 						if($.inArray(m.get('parentObjectName'),that.groupList) < 0)
 							that.groupList.push(m.get('parentObjectName'));
-					}
-					else{
+					} else {
 						if(m.get('action') != 'delete'){
 							if(m.get('action') == 'create'){
 								var obj = {userName : m.get('parentObjectName')};
@@ -255,11 +247,12 @@ define(function(require){
 					}
 					modelColl.push(m);
 					
-				}else if(m.get('attributeName') == 'Repository Type'){
-					if(m.get('action') != 'delete')
+				} else if(m.get('attributeName') == 'Repository Type'){
+					if(m.get('action') != 'delete'){
 						that.repositoryType = m.get('newValue');
-					else
+					} else {
 						that.repositoryType = m.get('previousValue');
+					}
 					modelColl.push(m);
 					if(that.repositoryType == XAEnums.AssetType.ASSET_KNOX.label && m.get('action') == "create")//XAEnums.AssetType.ASSET_KNOX.value)
 						that.template = KnoxPolicyOperationDiff_tmpl;
@@ -267,15 +260,16 @@ define(function(require){
 						that.template = KnoxPolicyUpdateOperationDiff_tmpl;
 					if(that.repositoryType == XAEnums.AssetType.ASSET_KNOX.label && m.get('action') == "delete")
 						that.template = KnoxPolicyDeleteUpdateOperationDiff_tmpl;
-				}else if(m.get('attributeName') == 'Policy Name'){
-					if(m.get('action') != 'delete')
+				} else if(m.get('attributeName') == 'Policy Name'){
+					if(m.get('action') != 'delete'){
 						that.policyName = m.get('newValue');
-					else
+					} else {
 						that.policyName = m.get('previousValue');
+					}
 					if(m.get('newValue') == m.get('previousValue'))
 						modelColl.push(m);
 				}
-				
+			
 				if(_.isUndefined(m.get('attributeName')))
 					modelColl.push(m);
 			});
@@ -346,7 +340,7 @@ define(function(require){
 					if(m.get('action') == 'delete' || m.get('action') == 'update')
 						that.previousGroupList.push(m.get('parentObjectName'));
 					modelArr.push(m);
-				}else if(m.get('attributeName') == 'User Role'){
+				} else if(m.get('attributeName') == 'User Role'){
 					var newRole =  m.get('newValue').replace(/[[\]]/g,'');
 					var prevRole = m.get('previousValue').replace(/[[\]]/g,'');
 					if( newRole == "ROLE_USER")
@@ -361,13 +355,14 @@ define(function(require){
 						m.set('previousValue',XAEnums.UserRoles.ROLE_SYS_ADMIN.label)
 					else if(prevRole == "ROLE_KEY_ADMIN")
 						m.set('previousValue',XAEnums.UserRoles.ROLE_KEY_ADMIN.label)
-				}else{
+				} else {
 					if(!m.has('attributeName'))
 						modelArr.push(m);
 				}
 			});
-			if(!_.isEmpty(this.newGroupList) || !_.isEmpty(this.previousGroupList))
+			if(!_.isEmpty(this.newGroupList) || !_.isEmpty(this.previousGroupList)){
 				this.isGroup = true;
+			}
 			this.collection.remove(modelArr);
 		},
 		groupDiffOperation : function(){

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js b/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
index b65dff4..c9a0847 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
@@ -25,6 +25,7 @@ define(function(require){
 	var XAEnums					 		= require('utils/XAEnums');
 	var XALinks							= require('modules/XALinks');
 	var XAUtils					 		= require('utils/XAUtils');
+	
 	var RangerPolicy					= require('models/RangerPolicy');
 	var RangerService					= require('models/RangerService');
 	var RangerServiceDef				= require('models/RangerServiceDef');
@@ -82,7 +83,6 @@ define(function(require){
 			
 			_.extend(this, _.pick(options, 'classType','objectName','objectId','objectCreatedDate','action','userName','policyId'));
 			this.bindEvents();
-			//this.initializeDiffOperation();
 			this.initializeServiceDef();
 			this.getTemplateForView();
 			
@@ -91,15 +91,13 @@ define(function(require){
 			var url, policyName = this.collection.findWhere({'attributeName':'Policy Name'});
 			if(this.action == 'create'){
 				this.policyName = policyName.get('newValue');
-			}else if(this.action == 'delete'){
+			} else if(this.action == 'delete'){
 				this.policyName = policyName.get('previousValue');
 			}
 			if(!_.isUndefined(this.collection.models[0]) ){
 				this.policyName = _.isUndefined(this.policyName) ? this.collection.models[0].get('objectName') : this.policyName;
 				if(this.action != 'delete'){
-//					url = XAUtils.getRangerServiceByName(this.collection.models[0].get('parentObjectName'))
 					var rangerService = new RangerService({ 'id' : this.collection.models[0].get('parentObjectId') })
-//					rangerService.url = url;
 					rangerService.fetch({
 						cache : false,
 						async : false
@@ -209,6 +207,7 @@ define(function(require){
 		getPolicyResources : function() {
 			var policyResources = this.collection.findWhere({'attributeName':'Policy Resources'});
 			this.collection.remove(policyResources);
+			
 			if(!_.isUndefined(policyResources.get('newValue')) && !_.isEmpty(policyResources.get('newValue'))){
 				var resources = {} ;
 				var resourceNewValues = JSON.parse(policyResources.get('newValue'));
@@ -249,13 +248,12 @@ define(function(require){
 			}
 			if(this.action == "update"){
 				_.each(resources,function(val, key){ 
-//					console.log(oldResources)
 					if(val != oldResources[key])
 						this.collection.add({'attributeName':key, 'newValue':val.toString(),'previousValue': oldResources[key],type : "Policy Resources"}); 
 				}, this)
-			}else if(this.action == "create"){
+			} else if(this.action == "create"){
 				_.each(resources,function(val, key){ this.collection.add({'attributeName':key, 'newValue':val.toString()}); }, this)
-			}else{
+			} else{
 				_.each(oldResources,function(val, key){ this.collection.add({'attributeName':key, 'previousValue':val.toString()}); }, this)
 			}
 		},
@@ -263,6 +261,7 @@ define(function(require){
 			var items = {};
 			var policyItems = this.collection.findWhere({'attributeName':'Policy Items'});
 			this.collection.remove(policyItems);
+			
 			if(!_.isUndefined(policyItems.get('newValue')) && !_.isEmpty(policyItems.get('newValue'))){
 				this.newPolicyItems = JSON.parse(policyItems.get('newValue'));
 				_.each(this.newPolicyItems, function(obj){
@@ -286,7 +285,7 @@ define(function(require){
 			this.oldPermList =[], this.newPermList =[]
 			if(this.action == "update"){
 				this.setOldeNewPermList();
-			}else{
+			} else {
 				this.oldPermList = this.oldPolicyItems;
 				this.newPermList = this.newPolicyItems;
 			}
@@ -330,8 +329,6 @@ define(function(require){
 					this.newPermList.push({})
 				}
 			}
-			console.log(this.oldPermList)
-			console.log(this.newPermList)
 		},
 		/** all post render plugin initialization */
 		initializePlugins: function(){

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/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 ac05eba..63b5d35 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js
@@ -78,13 +78,8 @@ define(function(require) {'use strict';
 		/** ui events hash */
 		events : function() {
 			var events = {};
-			//events['change ' + this.ui.input]  = 'onInputChange';
 			events['click ' + this.ui.searchBtn]  = 'onSearch';
-			//events["'change ' "+ this.ui.userName +"','" + this.ui.userGroup+"'"]  = 'onSearch';
-			//events['change ' + this.ui.userName+ ','+this.ui.userGroup+ ',' +this.ui.resourceName] = 'onSearch';
 			events['click .autoText']  = 'autocompleteFilter';
-			
-			//events['keydown ' + this.ui.userGroup]  = 'groupKeyDown';
 			events['click .gotoLink']  = 'gotoTable';
 			events['click ' + this.ui.btnShowMore]  = 'onShowMore';
 			events['click ' + this.ui.btnShowLess]  = 'onShowLess';
@@ -101,7 +96,6 @@ define(function(require) {'use strict';
 			console.log("initialized a UserAccessLayout Layout");
 			_.extend(this, _.pick(options, 'groupList','userList'));
 			this.bindEvents();
-			
 		},
 		initializeRequiredData : function() {
 			this.policyCollList = [];
@@ -116,7 +110,6 @@ define(function(require) {'use strict';
 		},
 		initializeServiceDef : function() {
 			   this.serviceDefList = new RangerServiceDefList();
-//			   this.serviceDefList.queryParams.sortBy = 'id';
 			   this.serviceDefList.fetch({
 				   cache : false,
 				   async:false
@@ -138,34 +131,18 @@ define(function(require) {'use strict';
 				this.renderTable(obj.collName, obj.serviceDefName);
 				this.getResourceLists(obj.collName,obj.serviceDefName);
 			},this);
+			this.$el.find('[data-js="policyName"]').focus()
 		},
 		
 		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');
 				
 			});
@@ -271,14 +248,6 @@ define(function(require) {'use strict';
 		},
 		/** on render callback */
 		setupGroupAutoComplete : function(){
-			//tags : true,
-			/*width :'220px',
-			multiple: true,
-			minimumInputLength: 1,
-			data :this.groupList.map(function(m) {
-				//console.log(m);
-				return {id : m.id,text : m.get('name')};
-			}),*/
 			this.groupArr = this.groupList.map(function(m){
 				return { id : m.get('name') , text : m.get('name')};
 			});
@@ -293,8 +262,6 @@ define(function(require) {'use strict';
 				// 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: obj.text, text: obj.text});
@@ -329,7 +296,7 @@ define(function(require) {'use strict';
 				formatNoMatches: function(result){
 					return 'No group found.';
 				}
-			}).on('select2-focus', XAUtil.select2Focus);
+			})//.on('select2-focus', XAUtil.select2Focus);
 		},		
 		setupUserAutoComplete : function(){
 			var that = this;
@@ -384,7 +351,7 @@ define(function(require) {'use strict';
 					return 'No user found.';
 				}
 				
-			}).on('select2-focus', XAUtil.select2Focus);
+			})//.on('select2-focus', XAUtil.select2Focus);
 		},
 		/** all post render plugin initialization */
 		initializePlugins : function() {
@@ -395,6 +362,7 @@ define(function(require) {'use strict';
 				if (wrap.hasClass('wrap') && ! wrap.hasClass('non-collapsible'))
 					$(this).append('<a href="#" class="wrap-collapse pull-right">hide&nbsp;&nbsp;<i class="icon-caret-up"></i></a>').append('<a href="#" class="wrap-expand pull-right" style="display: none">show&nbsp;&nbsp;<i class="icon-caret-down"></i></a>');
 			});
+			
 			// Collapse wrap
 			$(document).on("click", "a.wrap-collapse", function() {
 				var self = $(this).hide(100, 'linear');
@@ -413,7 +381,6 @@ define(function(require) {'use strict';
 			});
 			
 			this.ui.resourceName.bind( "keydown", function( event ) {
-
 				if ( event.keyCode === $.ui.keyCode.ENTER ) {
 					that.onSearch();
 				}
@@ -422,7 +389,6 @@ define(function(require) {'use strict';
 		},
 		onSearch : function(e){
 			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;
@@ -459,7 +425,6 @@ define(function(require) {'use strict';
 				this.setupUserAutoComplete();
 				$button.text('Username');
 			}
-			//this.onSearch();
 		},
 		gotoTable : function(e){
 			var that = this, elem = $(e.currentTarget),pos;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/018644b9/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js b/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js
index 598db83..dcc85ab 100644
--- a/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js
+++ b/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js
@@ -91,13 +91,11 @@ define(function(require) {
 		},
 		initialize : function(options) {
 			_.extend(this, _.pick(options, 'fieldLabel'));
-//					this.listenTo(this.groupList, 'sync', this.render, this);
-					if(this.collection.length == 0)
-						this.collection.add(new Backbone.Model());
+			if(this.collection.length == 0){
+				this.collection.add(new Backbone.Model());
+			}
 		},
 		onRender : function(){
-//			this.$('table').hide();
-			
 		},
 		addNew : function(){
 			var that =this;



Mime
View raw message