ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject [11/44] ARGUS-1. Initial code commit (Selvamohan Neethiraj via omalley)
Date Thu, 14 Aug 2014 20:50:22 GMT
http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/utils/XATemplateHelpers.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XATemplateHelpers.js b/security-admin/src/main/webapp/scripts/utils/XATemplateHelpers.js
new file mode 100644
index 0000000..3b46c36
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/utils/XATemplateHelpers.js
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+	/*
+	 * General guidelines while writing helpers:
+	 * 
+	 * - If returning HTML use return new Handlebars.SafeString();
+	 * - If the helper needs optional arguments use the "hash arguments"
+	 *   Eg. {{{link . "See more..." story.url class="story"}}}
+	 *   NOTE: the first argument after the helper name should be . which will be context in the helper function
+	 *   Handlebars.registerHelper('link', function(context, text, url, options) {
+	 *   	var attrs = [];
+	 * 		
+	 *   	for(var prop in options.hash) {
+	 *   		attrs.push(prop + '="' + options.hash[prop] + '"');
+	 *   	}	
+	 *   	return new Handlebars.SafeString("<a " + attrs.join(" ") + ">" + text + "</a>");
+	 *   });
+	 * 
+	 * 
+	 * NOTE: Due to some limitations in the require-handlebars-plugin, we cannot have helper that takes zero arguments,
+	 *       for such helpers we have to pass a "." as first argument. [https://github.com/SlexAxton/require-handlebars-plugin/issues/72] 
+	 */
+	
+
+define(function ( require ){
+
+	var Handlebars	= require('Handlebars');
+	var HHelpers = {};
+	
+	/**
+     * Convert new line (\n\r) to <br>
+     * from http://phpjs.org/functions/nl2br:480
+     */
+	Handlebars.registerHelper('nl2br', function(text) {
+        text = Handlebars.XAUtils.escapeExpression(text);
+        var nl2br = (text + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '<br>' + '$2');
+        return new Handlebars.SafeString(nl2br);
+    });
+	
+	/*
+	 * escapeHtmlChar
+	 */
+	Handlebars.registerHelper("escapeHtmlChar", function(str) {
+		return Util.escapeHtmlChar(str);
+	});
+	
+	Handlebars.registerHelper("nl2brAndEscapeHtmlChar", function(str) {
+		return Util.nl2brAndEscapeHtmlChar(str);
+	});
+	
+	/*
+	 * required to fetch label for enum value
+	 */ 
+	Handlebars.registerHelper('convertEnumValueToLabel', function(enumName, enumValue) {
+		return Util.enumValueToLabel( Util.getEnum(enumName), enumValue);
+	});
+	
+	/*
+	 * Truncate the String till n positions
+	 */
+	Handlebars.registerHelper('truncStr', function(str, n, useWordBoundary) {
+		var len = n || 1;
+		var useWordBn = useWordBoundary || false;
+		return str.trunc(len, useWordBn);
+	});
+	
+	/*Handlebars.registerHelper('tt', function(str) {
+		return localization.tt(str);
+	});*/
+	
+	Handlebars.registerHelper('getCopyrightDate', function() {
+		return new Date().getFullYear().toString();
+	});
+	
+	Handlebars.registerHelper('if_eq', function(context, options) {
+		if (context == options.hash.compare)
+			return options.fn(this);
+		return options.inverse(this);
+	});
+
+	Handlebars.registerHelper('if_gt', function(context, options) {
+		if (context > options.hash.compare)
+			return options.fn(this);
+		return options.inverse(this);
+	});
+
+	Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
+		switch (operator) {
+			case '==':
+				return (v1 == v2) ? options.fn(this) : options.inverse(this);
+			break;
+			case '===':
+				return (v1 === v2) ? options.fn(this) : options.inverse(this);
+			break;
+			case '<':
+				return (v1 < v2) ? options.fn(this) : options.inverse(this);
+			break;
+			case '<=':
+				return (v1 <= v2) ? options.fn(this) : options.inverse(this);
+			break;
+			case '>':
+				return (v1 > v2) ? options.fn(this) : options.inverse(this);
+			break;
+			case '>=':
+				return (v1 >= v2) ? options.fn(this) : options.inverse(this);
+			break;
+			default:
+				return options.inverse(this);     
+			break;
+		}
+		//return options.inverse(this);
+	});
+
+
+    /**
+     * This helper provides a for i in range loop
+     *
+     * start and end parameters have to be integers >= 0 or their string representation. start should be <= end.
+     * In all other cases, the block is not rendered.
+     * Usage:
+     *        <ul>
+     *            {{#for 0 10}}
+     *                <li>{{this}}</li>
+     *            {{/for}}
+     *        </ul>
+     */
+    Handlebars.registerHelper('for', function(start, end, options) {
+        var fn = options.fn, inverse = options.inverse;
+        var isStartValid = (start != undefined && !isNaN(parseInt(start)) && start >= 0);
+        var isEndValid = (end != undefined && !isNaN(parseInt(end)) && end >= 0);
+        var ret = "";
+
+        if (isStartValid && isEndValid && parseInt(start) <= parseInt(end)) {
+            for (var i = start; i <= end; i++) {
+                ret = ret + fn(i);
+            }
+        } else {
+            ret = inverse(this);
+        }
+
+        return ret;
+    });
+
+	Handlebars.registerHelper('dateFormat', function(context, block) {
+		if (window.moment) {
+			var f = block.hash.format || "MMM Do, YYYY";
+			return moment(Date(context)).format(f);
+		}else{
+			return context;   //  moment plugin not available. return data as is.
+		};
+	});
+	return HHelpers;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/utils/XAUtils.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
new file mode 100644
index 0000000..65d90a7
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -0,0 +1,633 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+
+define(function(require) {
+    'use strict';
+	
+	var XAEnums		= require('utils/XAEnums');
+	var localization	= require('utils/XALangSupport');
+	var XAUtils = {};
+	require('pnotify');
+	
+	// ///////////////////////////////////////////////////////
+	// Enum utility methods
+	// //////////////////////////////////////////////////////
+	/**
+	 * Get enum for the enumId
+	 * @param {integer} enumId - The enumId
+	 */
+	XAUtils.getEnum = function(enumId) {
+		if (!enumId || enumId.length < 1) {
+			return "";
+		}
+		// check if the enums are loaded
+		if (!XAEnums[enumId]) {
+			return "";
+		}
+		return XAEnums[enumId];
+	};
+
+	/**
+	 * Get enum by Enum and value
+	 * @param {Object} myEnum - The enum
+	 * @param {integer} value - The value
+	 */
+	XAUtils.enumElementByValue = function(myEnum, value) {
+		var element = _.detect(myEnum, function(element) {
+			return element.value == value;
+		});
+		return element;
+	};
+
+	/**
+	 * Get enum by Enum and name, value
+	 * @param {Object} myEnum - The enum
+	 * @param {string} propertyName - The name of key
+	 * @param {integer} propertyValue - The value
+	 */
+	XAUtils.enumElementByPropertyNameValue = function(myEnum, propertyName, propertyValue) {
+		for ( var element in myEnum) {
+			if (myEnum[element][propertyName] == propertyValue) {
+				return myEnum[element];
+			}
+		}
+		return null;
+	};
+
+	/**
+	 * Get enum value for given enum label
+	 * @param {Object} myEnum - The enum
+	 * @param {string} label - The label to search for in the Enum
+	 */
+	XAUtils.enumLabelToValue = function(myEnum, label) {
+		var element = _.detect(myEnum, function(element) {
+			return element.label == label;
+		});
+		return (typeof element === "undefined") ? "--" : element.value;
+	};
+
+	/**
+	 * Get enum label for given enum value
+	 * @param {Object} myEnum - The enum
+	 * @param {integer} value - The value
+	 */
+	XAUtils.enumValueToLabel = function(myEnum, value) {
+		var element = _.detect(myEnum, function(element) {
+			return element.value == value;
+		});
+		return (typeof element === "undefined") ? "--" : element.label;
+	};
+
+	/**
+	 * Get enum label tt string for given Enum value
+	 * @param {Object} myEnum - The enum
+	 * @param {integer} value - The value
+	 */
+	XAUtils.enumValueToLabeltt = function(myEnum, value) {
+		var element = _.detect(myEnum, function(element) {
+			return element.value == value;
+		});
+		return (typeof element === "undefined") ? "--" : element.tt;
+	};
+
+	/**
+	 * Get NVpairs for given Enum to be used in Select
+	 * @param {Object} myEnum - The enum
+	 */
+	XAUtils.enumToSelectPairs = function(myEnum) {
+		return _.map(myEnum, function(o){
+			return {
+				val : o.value,
+				label : o.label
+			};
+		});
+	};
+
+
+	/**
+	 * Get NVpairs for given Enum
+	 * @param {Object} myEnum - The enum
+	 */
+	XAUtils.enumNVPairs = function(myEnum) {
+		var nvPairs = {
+			' ' : '--Select--'
+		};
+
+		for ( var name in myEnum) {
+			nvPairs[myEnum[name].value] = myEnum[name].label;
+		}
+
+		return nvPairs;
+	};
+
+	/**
+	 * Get array NV pairs for given Array
+	 * @param {Array} myArray - The eArraynum
+	 */
+	XAUtils.arrayNVPairs = function(myArray) {
+		var nvPairs = {
+			' ' : '--Select--'
+		};
+		_.each(myArray, function(val) {
+			nvPairs[val] = val;
+		});
+		return nvPairs;
+	};
+
+	/**
+	 * Notify Info the given title / text
+	 * @param {string} title - The title
+	 * @param {string} text - The text
+	 */
+	XAUtils.notifyInfo = function(title, text) {
+		$.pnotify({
+			pnotify_title : title,
+			pnotify_text : text
+		});
+	};
+
+	/**
+	 * Notify Error the given title / text
+	 * @param {string} title - The title
+	 * @param {string} text - The text
+	 */
+	XAUtils.notifyError = function(title, text) {
+		$.pnotify({
+			pnotify_title : title,
+			pnotify_text : text,
+			pnotify_type : 'error'
+		});
+	};
+	
+	/**
+	 * Notify Success the given title / text
+	 * @param {string} title - The title
+	 * @param {string} text - The text
+	 */
+	XAUtils.notifySuccess = function(title, text) {
+		$.pnotify({
+			pnotify_title : title,
+			pnotify_text : text,
+			pnotify_type : 'success'
+		});
+	};
+	
+	
+	/**
+	 * Convert new line to <br />
+	 * @param {string} str - the string to convert
+	 */
+	XAUtils.nl2br = function(str) {
+		if (!str)
+			return '';
+		return str.replace(/\n/g, '<br/>').replace(/[\r\t]/g, " ");
+	};
+
+	/**
+	 * Convert <br /> to new line 
+	 * @param {string} str - the string to convert
+	 */
+	XAUtils.br2nl = function(str) {
+		if (!str)
+			return '';
+		return str.replace(/\<br(\s*\/|)\>/gi, '\n');
+	};
+
+	/**
+	 * Escape html chars
+	 * @param {string} str - the html string to escape
+	 */
+	XAUtils.escapeHtmlChar = function(str) {
+		if (!str)
+			return '';
+		str = str.replace(/&/g, "&amp;");
+		str = str.replace(/>/g, "&gt;");
+		str = str.replace(/</g, "&lt;");
+		str = str.replace(/\"/g, "&quot;");
+		str = str.replace(/'/g, "&#039;");
+		return str;
+	};
+
+	/**
+	 * nl2br and Escape html chars
+	 * @param {string} str - the html string
+	 */
+	XAUtils.nl2brAndEscapeHtmlChar = function(str) {
+
+		if (!str)
+			return '';
+		var escapedStr = escapeHtmlChar(str);
+		var finalStr = nl2br(str);
+		return finalStr;
+	};
+
+	/**
+	 * prevent navigation with msg and call callback
+	 * @param {String} msg - The msg to show
+	 * @param {function} callback - The callback to call
+	 */
+	XAUtils.preventNavigation = function(msg, $form, callback) {
+		$("body a, i[class^='icon-'],allowNav").on("click.blockNavigation", function(e) {
+			XAUtils.preventNavigationHandler(e, msg, $form, callback);
+		});
+	};
+
+	/**
+	 * remove the block of preventNavigation
+	 */
+	XAUtils.allowNavigation = function() {
+		$("body a, i[class^='icon-']").off('click.blockNavigation');
+	};
+
+	XAUtils.preventNavigationHandler = function(e, msg,$form,callback) {
+		var formChanged = false;
+		if(!_.isUndefined($form))
+			formChanged = $form.find('.dirtyField').length > 0 ? true : false;
+		if (!$(e.currentTarget).hasClass("_allowNav") && formChanged) {
+			
+			e.preventDefault();
+			e.stopImmediatePropagation();
+			XAUtils.alertPopup({
+				msg : msg,
+				title : "Warning",
+				callback : callback
+			});
+			return false;
+		}
+	};
+
+	/**
+	 * Bootbox wrapper for alert
+	 * @param {Object} params - The params
+	 */
+	XAUtils.alertPopup = function(params) {
+		if(params.callback == undefined){
+			bootbox.alert(params.msg);
+		} else {
+			bootbox.alert(params.msg,params.callback);
+		}
+	};
+
+	/**
+	 * Bootbox wrapper for confirm
+	 * @param {Object} params - The params
+	 */
+	XAUtils.confirmPopup = function(params) {
+		bootbox.confirm(params.msg, function(result) {
+			if(result){
+				params.callback();
+			}
+		}); 
+	};	
+
+	XAUtils.filterResultByIds = function(results , selectedVals){
+		return _.filter(results,function(obj){
+			if($.inArray(obj.id,selectedVals) < 0)
+				return obj;
+				
+			});
+	};
+	XAUtils.scrollToField = function(field){
+		$("html, body").animate({
+			scrollTop: field.position().top-80
+		}, 1100, function(){
+			field.focus();
+		});
+	};
+	XAUtils.blockUI = function(options){
+		var Opt = {autoUnblock : false , clickUnblock : false, bgPath : 'images/' ,content: '<img src="images/blockLoading.gif" > Please wait..',css :{}};
+		options = _.isUndefined(options)  ?  Opt : options;
+		$.msg(options);
+	};
+	XAUtils.showGroups = function(rawValue){
+		var showMoreLess = false;
+		if(_.isArray(rawValue))
+			rawValue =  new Backbone.Collection(rawValue);
+		if(!_.isUndefined(rawValue) && rawValue.models.length > 0){
+			var groupArr = _.uniq(_.compact(_.map(rawValue.models, function(m, i){
+				if(m.has('groupName'))
+					return m.get('groupName') ;
+			})));
+			if(groupArr.length > 0)
+				var resourceId =rawValue.models[0].attributes.resourceId; 
+			var newGroupArr = _.map(groupArr, function(name, i){
+				if(i >=  4)
+					return '<span class="label label-info" policy-group-id="'+resourceId+'" style="display:none;">' + name + '</span>';
+				else if(i == 3 && groupArr.length > 4){
+					showMoreLess = true;
+					return '<span class="label label-info" policy-group-id="'+resourceId+'">' + name + '</span>';
+				}
+				else
+					return '<span class="label label-info" policy-group-id="'+resourceId+'">' + name + '</span>';
+			});
+			if(showMoreLess){
+				newGroupArr.push('<span class="pull-left"><a href="javascript:void(0);" data-id="showMore" class="" policy-group-id="'+resourceId+'"><code style=""> + More..</code></a></span><span class="pull-left" ><a href="javascript:void(0);" data-id="showLess" class="" policy-group-id="'+resourceId+'" style="display:none;"><code> - Less..</code></a></span>');
+			}
+			return newGroupArr.length ? newGroupArr.join(' ') : '--';
+		}else
+			return '--';
+	};
+	 
+	XAUtils.defaultErrorHandler = function(model, error) {
+		var App		= require('App');
+		var vError = require('views/common/ErrorView');
+        if (error.status == 404 ) {
+           // trigger event or route to login here.
+        	App.rContent.show(new vError({
+        		pageNotFound :true
+        	}));
+        }else if (error.status == 401 ) {
+        	window.location.replace('login.jsp');
+        }
+    };
+    XAUtils.select2Focus  =  function(event) {
+	    if (/^select2-focus/.test(event.type)) {
+	        $(this).select2('open');
+	    }
+	};
+	XAUtils.makeCollForGroupPermission = function(model){
+		var XAEnums			= require('utils/XAEnums');
+		var formInputColl = new Backbone.Collection(); 
+		// permMapList = [ {id: 18, groupId : 1, permType :5}, {id: 18, groupId : 1, permType :4}, {id: 18, groupId : 2, permType :5} ]
+		// [1] => [ {id: 18, groupId : 1, permType :5}, {id: 18, groupId : 1, permType :4} ]
+		// [2] => [ {id: 18, groupId : 2, permType :5} ]
+		if(!model.isNew()){
+			if(!_.isUndefined(model.get('permMapList'))){
+				var vPermMapList = model.get('permMapList'); //model.get('_vPermMapList');
+				var groupPerms = _.filter(vPermMapList,function(m){if(m.permFor == XAEnums.XAPermForType.XA_PERM_FOR_GROUP.value ) return m;});
+				var permsGroupBy = _.groupBy(groupPerms,function(m) { return m.permGroup; });
+				_.each(permsGroupBy,function(values, g){
+					if(g != 'undefined'){
+						var idPermMapArr = []; // This should be array of integers of perms eg. [1,2,5]
+						var groupIds=[],groupNames=[];
+						_.each(values, function(v){
+							if(groupIds.indexOf(v.groupId) == -1)
+								groupIds.push(v.groupId);
+							if(groupNames.indexOf(v.groupName ) == -1)
+								groupNames.push(v.groupName);
+							if(_.isEmpty(_.findWhere(idPermMapArr, {permType: v.permType})))
+								idPermMapArr.push( { id : v.id,permType :v.permType, groupId :v.groupId} );
+						});
+						
+						var m = new Backbone.Model({
+							groupId 	: groupIds.join(','),
+							groupName 	: groupNames.join(','),
+							ipAddress	: values[0].ipAddress,
+							editMode 	: true,
+							
+						});
+						m.set('_vPermList', idPermMapArr);
+						formInputColl.add(m);
+					}
+					
+				});
+			}
+	   }
+		return formInputColl;
+	};
+	
+	XAUtils.makeCollForUserPermission = function(model){
+		var XAEnums			= require('utils/XAEnums');
+		var coll = new Backbone.Collection(); 
+		// permMapList = [ {id: 18, groupId : 1, permType :5}, {id: 18, groupId : 1, permType :4}, {id: 18, groupId : 2, permType :5} ]
+		// [1] => [ {id: 18, groupId : 1, permType :5}, {id: 18, groupId : 1, permType :4} ]
+		// [2] => [ {id: 18, groupId : 2, permType :5} ]
+		if(!model.isNew()){
+			if(!_.isUndefined(model.get('permMapList'))){
+				var vPermMapList =  model.get('permMapList');//model.get('_vPermMapList');
+				var userPerms = _.filter(vPermMapList, function(m){if(m.permFor == XAEnums.XAPermForType.XA_PERM_FOR_USER.value) return m;});
+				var userPermsGroupBy = _.groupBy(userPerms,function(m) { return m.permGroup; });
+				_.each(userPermsGroupBy,function(values, g){
+					if(g != 'undefined'){
+						var idPermMapArr = []; // This should be array of integers of perms eg. [1,2,5]
+						
+						var userIds=[],userNames=[];
+						_.each(values, function(v){
+							if(userIds.indexOf(v.userId) == -1)
+								userIds.push(v.userId);
+							if(userNames.indexOf(v.userName) == -1)
+								userNames.push(v.userName);
+							if(_.isEmpty(_.findWhere(idPermMapArr, {permType: v.permType})))
+								idPermMapArr.push( { id : v.id,permType :v.permType, userId :v.userId } );
+						});
+						
+						var m = new Backbone.Model({
+							userId 		: userIds.join(','),
+							userName 	: userNames.join(','),
+							ipAddress	: values[0].ipAddress,
+							editMode 	: true
+						});
+						
+						m.set('_vPermList', idPermMapArr);
+						coll.add(m);
+					}
+					
+				});	
+			}
+		   }
+		return coll;
+	};
+	 XAUtils.checkDirtyField  =  function(arg1, arg2, $elem) {
+		 if(_.isEqual(arg1,arg2)){
+				$elem.removeClass('dirtyField');
+			}else{
+				$elem.addClass('dirtyField');
+			}
+	};
+	XAUtils.checkDirtyFieldForToggle = function(fieldEditor){
+		if(fieldEditor.$el.hasClass('dirtyField')){
+			fieldEditor.$el.removeClass('dirtyField');
+		}else{
+			fieldEditor.$el.addClass('dirtyField');
+		}
+	};
+	XAUtils.enumToSelectLabelValuePairs = function(myEnum) {
+		return _.map(myEnum, function(o){
+			return {
+				label : o.label,
+				value : o.value+''
+				//category :'DHSS',
+			};
+		});
+	};
+	XAUtils.hackForVSLabelValuePairs = function(myEnum) {
+		return _.map(myEnum, function(o){
+			return {
+				label : o.label,
+				value : o.label+''
+				//category :'DHSS',
+			};
+		});
+	};
+	XAUtils.addVisualSearch = function(searchOpt,serverAttrName,collection,pluginAttr){
+		var visualSearch ;
+		var search = function(searchCollection, serverAttrName, searchOpt,collection){
+			var params = {};
+			searchCollection.each(function(m){
+				var serverParamName = _.findWhere(serverAttrName,{text :m.attributes.category});
+				var extraParam = {};
+				if(_.has(serverParamName,'multiple') && serverParamName.multiple){
+					extraParam[serverParamName.label] = XAUtils.enumLabelToValue(serverParamName.optionsArr,m.get('value'));;
+					$.extend(params ,extraParam);
+				}else{
+					if(!_.isUndefined(serverParamName)){
+						extraParam[serverParamName.label] = m.get('value');
+						$.extend(params ,extraParam);
+					}
+				}
+			});
+			collection.queryParams = $.extend(collection.queryParams,params);
+			collection.state.currentPage = collection.state.firstPage;
+			collection.fetch({
+				reset : true,
+				cache : false
+				//data : params,
+			});
+		};
+		//var searchOpt = ['Event Time','User','Resource Name','Resource ID','Resource Type','Repository Name','Repository Type','Result','Client IP','Client Type','Access Type','Access Enforcer','Audit Type','Session ID'];
+		
+		var callbackCommon = {
+	        search       : function(query, searchCollection) {
+	        					search(searchCollection, serverAttrName, searchOpt,collection);
+	        			   },
+	        facetMatches :  function(callback) {
+	        				//	console.log(visualSearch);
+	        					var searchOptTemp = $.extend(true, [], searchOpt);
+	        					visualSearch.searchQuery.each(function(m){
+	        						if($.inArray(m.get('category'),searchOptTemp) >= 0){
+	        							searchOptTemp.splice($.inArray(m.get('category'),searchOptTemp), 1);
+	        						} 
+	        					});
+	        					//visualSearch.options.readOnly = searchOptTemp.length <= 0 ? true : false;
+	        					callback(searchOptTemp);
+	        				},
+	        removedFacet : function(removedFacet,searchCollection,indexObj){
+					        	//console.log(removedFacet);
+	        					
+					        	var removedFacetSeverName = _.findWhere(serverAttrName,{text :removedFacet.get('category')});
+					        	if(!_.isUndefined(removedFacetSeverName)){
+					        		delete collection.queryParams[removedFacetSeverName.label];
+					        		collection.state.currentPage = collection.state.firstPage;
+					        		collection.fetch({
+					        			reset : true,
+					        			cache : false
+					        		});
+					        	}
+					        	//TODO Added for Demo to remove datapicker popups
+					        	if(!_.isUndefined(visualSearch.searchBox.$el))
+					        		visualSearch.searchBox.$el.parents('body').find('.datepicker').remove();
+					        }
+	        //we can also add focus, blur events callback here..
+	      };
+		pluginAttr.callbacks =	$.extend(callbackCommon, pluginAttr.callbacks);
+		//Initializing VisualSearch Plugin....
+		visualSearch = VS.init($.extend(pluginAttr, {remainder : false }));
+		
+		if(visualSearch.searchQuery.length > 0) //For On Load Visual Search
+			search(visualSearch.searchQuery, serverAttrName, searchOpt,collection);
+		
+		return visualSearch;
+	};
+	
+	XAUtils.displayDatepicker = function ($el, facet, $date, callback) {
+	    var input = $el.find('.search_facet.is_editing input.search_facet_input');
+	    $el.parents('body').find('.datepicker').hide();
+	    input.datepicker({
+	    	autoclose : true,
+	    	dateFormat: 'yy-mm-dd'
+	    }).on('changeDate', function(ev){
+	    	callback(ev.date);
+	    	input.datepicker("hide");
+	    	var e = jQuery.Event("keydown");
+	    	e.which = 13; // Enter
+	    	$(this).trigger(e);
+	    });
+	    if(!_.isUndefined($date)){
+	    	if(facet == 'Start Date'){
+	    		input.datepicker('setEndDate', $date);
+	    	}else{
+	    		input.datepicker('setStartDate', $date);
+	    	}
+	    }
+	    input.datepicker('show');
+	    input.on('blur',function(e){
+	    	input.datepicker("hide");
+	    	//$('.datepicker').remove();
+	    	
+	    });
+	    //input.attr("readonly", "readonly");
+	    input.on('keydown',function(e){
+	    	if(e.which == 9 && e.shiftKey ){
+	    		input.datepicker('setValue', new Date());
+	    		input.trigger('change');
+	    		input.datepicker("hide");
+	    	}
+	    	if(e.which == 13){
+	    		var e1 = jQuery.Event("keypress");
+	    		e1.which = 13; // Enter
+	    		$(this).trigger(e1);
+	    		
+	    	}
+	    });
+	    return input;
+	};
+	XAUtils.getPerms = function(policyType){
+		var permArr = [];
+		switch(policyType){
+		case XAEnums.AssetType.ASSET_HDFS.value :
+			permArr = ['XA_PERM_TYPE_READ', 'XA_PERM_TYPE_WRITE', 'XA_PERM_TYPE_EXECUTE','XA_PERM_TYPE_ADMIN'];
+			break;
+		case XAEnums.AssetType.ASSET_HIVE.value :
+			permArr = ['XA_PERM_TYPE_SELECT','XA_PERM_TYPE_UPDATE','XA_PERM_TYPE_CREATE','XA_PERM_TYPE_DROP','XA_PERM_TYPE_ALTER',
+			           'XA_PERM_TYPE_INDEX','XA_PERM_TYPE_LOCK', 'XA_PERM_TYPE_ALL', 'XA_PERM_TYPE_ADMIN'];
+			break;
+		case XAEnums.AssetType.ASSET_HBASE.value :
+			permArr = ['XA_PERM_TYPE_READ','XA_PERM_TYPE_WRITE','XA_PERM_TYPE_CREATE','XA_PERM_TYPE_ADMIN'];
+			break;
+		case XAEnums.AssetType.ASSET_KNOX.value :
+			permArr = ['XA_PERM_TYPE_ALLOW','XA_PERM_TYPE_ADMIN'];
+			break;
+		case XAEnums.AssetType.ASSET_STORM.value :
+			permArr = ['XA_PERM_TYPE_SUBMIT_TOPOLOGY','XA_PERM_TYPE_FILE_UPLOAD','XA_PERM_TYPE_GET_NIMBUS',
+			           'XA_PERM_TYPE_GET_CLUSTER_INFO','XA_PERM_TYPE_FILE_DOWNLOAD','XA_PERM_TYPE_KILL_TOPOLOGY',
+			           'XA_PERM_TYPE_REBALANCE','XA_PERM_TYPE_ACTIVATE','XA_PERM_TYPE_DEACTIVATE','XA_PERM_TYPE_GET_TOPOLOGY_CONF',
+			           'XA_PERM_TYPE_GET_TOPOLOGY','XA_PERM_TYPE_GET_USER_TOPOLOGY','XA_PERM_TYPE_GET_TOPOLOGY_INFO','XA_PERM_TYPE_UPLOAD_NEW_CREDENTIAL'
+			           ];
+			break;	
+		}
+		return permArr;
+	};
+	XAUtils.getPermHeaders = function(policyType, isGroup){
+		if(_.isUndefined(isGroup))	isGroup = true;
+		var permHeaders = isGroup ? [localization.tt('lbl.selectGroup')] :[localization.tt('lbl.selectUser')]; 
+		
+		switch(policyType){
+		case XAEnums.AssetType.ASSET_HDFS.value :
+			permHeaders.push(localization.tt('lbl.read'),localization.tt('lbl.write'),localization.tt('lbl.execute'),localization.tt('lbl.admin'),'');
+			break;
+		case XAEnums.AssetType.ASSET_HIVE.value :
+			permHeaders.push(localization.tt('lbl.select'),localization.tt('lbl.update'),localization.tt('lbl.create'),localization.tt('lbl.drop'),localization.tt('lbl.alter'),localization.tt('lbl.index'),localization.tt('lbl.lock'),localization.tt('lbl.all'),localization.tt('lbl.admin'),'');
+			break;
+		case XAEnums.AssetType.ASSET_HBASE.value :
+			permHeaders.push(localization.tt('lbl.read'),localization.tt('lbl.write'),localization.tt('lbl.create'),localization.tt('lbl.admin'),'');
+			break;
+		case XAEnums.AssetType.ASSET_KNOX.value :
+			permHeaders.push(localization.tt('lbl.ipAddress'),localization.tt('lbl.allow'),localization.tt('lbl.admin'),'');
+			break;
+		case XAEnums.AssetType.ASSET_STORM.value :
+			permHeaders.push(localization.tt('lbl.actions'),'');
+			break;	
+		}
+		return permHeaders;
+	};
+    return XAUtils;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/utils/XAViewUtils.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAViewUtils.js b/security-admin/src/main/webapp/scripts/utils/XAViewUtils.js
new file mode 100644
index 0000000..38ef08e
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/utils/XAViewUtils.js
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+
+define(function(require) {
+    'use strict';
+	
+	var XAViewUtil = {};
+	
+	return XAViewUtil;
+
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/accounts/AccountCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/accounts/AccountCreate.js b/security-admin/src/main/webapp/scripts/views/accounts/AccountCreate.js
new file mode 100644
index 0000000..c79d907
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/accounts/AccountCreate.js
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+    var App		= require('App');
+	var Backbone		= require('backbone');
+	var Communicator	= require('communicator');
+	var XAUtil			= require('utils/XAUtils');
+	var XALinks 		= require('modules/XALinks');
+	
+	var AccountCreate_tmpl = require('hbs!tmpl/accounts/AccountCreate_tmpl'); 
+	var AccountForm = require('views/accounts/AccountForm');
+
+	var AccountCreate = Backbone.Marionette.Layout.extend(
+	/** @lends AccountCreate */
+	{
+		_viewName : 'AccountCreate',
+		
+    	template: AccountCreate_tmpl,
+    	breadCrumbs :function(){
+    		if(this.model.isNew())
+    			return [XALinks.get('Accounts'), XALinks.get('AccountCreate')];
+    		else
+    			return [XALinks.get('Accounts'), XALinks.get('AccountEdit')];
+    	} ,
+        
+		/** Layout sub regions */
+    	regions: {
+			'rForm' :'div[data-id="r_form"]'
+		},
+
+    	/** ui selector cache */
+    	ui: {
+			'btnSave'	: '[data-id="save"]',
+			'btnCancel' : '[data-id="cancel"]'
+		},
+
+		/** ui events hash */
+		events: function() {
+			var events = {};
+			events['click ' + this.ui.btnSave]		= 'onSave';
+			events['click ' + this.ui.btnCancel]	= 'onCancel';
+			return events;
+		},
+
+    	/**
+		* intialize a new AccountCreate ItemView 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a AccountCreate ItemView");
+
+			_.extend(this, _.pick(options, ''));
+			
+		
+
+			this.bindEvents();
+		},
+
+		/** 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.form = new AccountForm({
+				model : this.model,
+				template : require('hbs!tmpl/accounts/AccountForm_tmpl')
+			});
+			this.rForm.show(this.form);
+			if(!this.model.isNew()){
+				this.form.setUpSwitches();
+			}
+			this.initializePlugins();
+		},
+
+		/** all post render plugin initialization */
+		initializePlugins: function(){
+		},
+
+		onSave: function(){
+			var errors = this.form.commit({validate : false});
+			if(! _.isEmpty(errors)){
+				return;
+			}
+			this.model.save();
+			/*this.model.save({},{
+				wait: true,
+				success: function () {
+					var msg = 'Account created successfully';
+					XAUtil.notifySuccess('Success', msg);
+					App.appRouter.navigate("#!/accounts",{trigger: true});
+					console.log("success");
+				},
+				error: function (model, response, options) {
+					XAUtil.notifyError('Error', 'Error creating Account!');
+					console.log("error");
+				}
+			});*/
+		},
+		onCancel: function(){
+			App.appRouter.navigate("#!/accounts",{trigger: true});
+		},
+		/** on close */
+		onClose: function(){
+			App.appRouter.navigate("#!/accounts",{trigger: true});
+		}
+
+	});
+
+	return AccountCreate;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/accounts/AccountDetailLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/accounts/AccountDetailLayout.js b/security-admin/src/main/webapp/scripts/views/accounts/AccountDetailLayout.js
new file mode 100644
index 0000000..cc1f518
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/accounts/AccountDetailLayout.js
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+	var Communicator	= require('communicator');
+
+	var AccountdetaillayoutTmpl = require('hbs!tmpl/accounts/AccountDetailLayout_tmpl');
+	
+
+	var AccountDetailLayout = Backbone.Marionette.Layout.extend(
+	/** @lends AccountDetailLayout */
+	{
+		_viewName : 'AccountDetailLayout',
+		
+    	template: AccountdetaillayoutTmpl,
+        
+		/** Layout sub regions */
+    	regions: {
+    		rAccountDetail : '#r_accDetail'
+    	},
+
+    	/** ui selector cache */
+    	ui: {},
+
+		/** ui events hash */
+		events: function() {
+			var events = {};
+			//events['change ' + this.ui.input]  = 'onInputChange';
+			return events;
+		},
+
+    	/**
+		* intialize a new AccountDetailLayout Layout 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a AccountDetailLayout Layout");
+
+			_.extend(this, _.pick(options, ''));
+			
+			this.bindEvents();
+		},
+
+		/** 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();
+			this.renderDetailView();
+		},
+		renderDetailView : function(){
+			var that = this;	
+			
+        },
+		/** all post render plugin initialization */
+		initializePlugins: function(){
+		},
+
+		/** on close */
+		onClose: function(){
+		}
+
+	});
+
+	return AccountDetailLayout; 
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/accounts/AccountForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/accounts/AccountForm.js b/security-admin/src/main/webapp/scripts/views/accounts/AccountForm.js
new file mode 100644
index 0000000..7ac9dda
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/accounts/AccountForm.js
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+	var Communicator	= require('communicator');
+	var localization = require('utils/XALangSupport');
+	var XAEnums 	= require('utils/XAEnums');
+	
+	require('Backbone.BootstrapModal');
+	require('backbone-forms.list');
+	require('backbone-forms.templates');
+	require('backbone-forms');
+
+	var AccountForm = Backbone.Form.extend(
+	/** @lends AccountForm */
+	{
+		_viewName : 'AccountForm',
+    	/**
+		* intialize a new AccountForm Form View 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a AccountForm Form View");
+    		Backbone.Form.prototype.initialize.call(this, options);
+
+			_.extend(this, _.pick(options, ''));
+
+			this.bindEvents();
+		},
+		
+		/*schema : function(){
+			return _.pick(_.result(this.model.schema),'customerName', 'accountStatus', 'accountCode');
+		},
+*/
+		/** all events binding here */
+		bindEvents : function(){
+			/*this.on('field:change', function(form, fieldEditor){
+    			this.evFieldChange(form, fieldEditor);
+    		});*/
+		},
+
+		/** on render callback */
+		onRender: function() {
+			this.initializePlugins();
+			/*if(!this.model.isNew()){
+				this.setUpSwitches();
+			}*/
+		},
+		setUpSwitches :function(){
+			var that = this;
+			var accountStatus = false;
+			_.each(_.toArray(XAEnums.BooleanValue),function(m){
+				if(parseInt(that.model.get('accountStatus')) == m.value)
+					accountStatus =  (m.label == XAEnums.BooleanValue.BOOL_TRUE.label) ? true : false;
+			});
+			this.fields.accountStatus.editor.setValue(accountStatus);
+		},
+
+		/** all post render plugin initialization */
+		initializePlugins: function(){
+		}
+
+	});
+
+	return AccountForm;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/accounts/AccountTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/accounts/AccountTableLayout.js b/security-admin/src/main/webapp/scripts/views/accounts/AccountTableLayout.js
new file mode 100644
index 0000000..cb9472f
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/accounts/AccountTableLayout.js
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require) {'use strict';
+
+	var Backbone = require('backbone');
+	var Communicator = require('communicator');
+	
+	var XALinks = require('modules/XALinks');
+	var XAEnums 	= require('utils/XAEnums');
+	var localization = require('utils/XALangSupport');
+	var XABackgrid		= require('views/common/XABackgrid');
+	var XATableLayout	= require('views/common/XATableLayout');
+
+	var AccounttablelayoutTmpl = require('hbs!tmpl/accounts/AccountTableLayout_tmpl');
+
+	require('backgrid');
+	require('backgrid-paginator');
+	//require('backbone-pageable');
+	require('jquery-toggles');
+
+	var AccountTableLayout = Backbone.Marionette.Layout.extend(
+	/** @lends AccountTableLayout */
+	{
+		_viewName : 'AccountTableLayout',
+
+		template : AccounttablelayoutTmpl,
+		breadCrumbs : [XALinks.get('Accounts')],
+
+		/** Layout sub regions */
+		regions : {
+			'rTableList' : 'div[data-id="r_tableList"]',
+			'rPagination' : 'div[data-id="r_pagination"]'
+		},
+
+		/** ui selector cache */
+		ui : {},
+
+		/** ui events hash */
+		events : function() {
+			var events = {};
+			//events['change ' + this.ui.input]  = 'onInputChange';
+			return events;
+		},
+
+		/**
+		 * intialize a new AccountTableLayout Layout
+		 * @constructs
+		 */
+		initialize : function(options) {
+			console.log("initialized a AccountTableLayout Layout");
+
+			_.extend(this, _.pick(options, ''));
+
+			this.bindEvents();
+		},
+
+		/** 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();
+			this.renderTable();
+		},
+
+		/** all post render plugin initialization */
+		initializePlugins : function() {
+		},
+
+		renderTable : function() {
+			/*if(! this.collection.length){
+			 return;
+			 }*/
+			/*var TableRow = Backgrid.Row.extend({
+			});
+
+			this.rTableList.show(new Backgrid.Grid({
+				className: 'table table-bordered table-condensed backgrid',
+				columns : this.getColumns(),
+				collection : this.collection,
+				row : TableRow
+			}));
+			
+
+			this.rPagination.show(new Backgrid.Extension.Paginator({
+				collection : this.collection,
+				className: "pagination",
+				controls : {
+					rewind : {
+						label : "«",
+						title : "First"
+					},
+					back : {
+						label : "‹",
+						title : "Previous"
+					},
+					forward : {
+						label : "›",
+						title : "Next"
+					},
+					fastForward : {
+						label : "»",
+						title : "Last"
+					}
+				},
+			}));*/
+			this.rTableList.show(new XATableLayout({
+				columns: this.getColumns(),
+				collection: this.collection,
+				includeFilter : false,
+				gridOpts : {
+					header : XABackgrid,
+					emptyText : 'No Accounts found!'
+				}
+			}));
+		},
+
+		getColumns : function() {
+			var cols = {
+				//id : {},
+				customerName : {
+					label : "Customer Name",
+					cell : "uri",
+					href: function(model){
+						return '#!/account/'+model.get('id')+'/user/' + 1;
+					}
+				},
+				accountStatus : {
+					label : "Status",
+					/*cell :"Switch",
+					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;
+						}
+					}),*/
+					formatter : _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw : function(rawValue) {
+							return rawValue == XAEnums.ActiveStatus.STATUS_ENABLED.value ? XAEnums.ActiveStatus.STATUS_ENABLED.label: XAEnums.ActiveStatus.STATUS_DISABLED.label;
+						}
+					})
+				}
+				/*action : {
+					cell :"uri",
+					label : localization.tt("lbl.action"),
+					href: function(model){
+						return '#!/accounts/' + model.id+'/edit';
+					},
+					title : 'Edit',
+					editable:false,
+					iconKlass :'icon-edit',
+					iconTitle :'Edit'
+					
+
+				}*/
+			};
+			return this.collection.constructor.getTableCols(cols, this.collection);
+		},
+
+		/** on close */
+		onClose : function() {
+		}
+	});
+
+	return AccountTableLayout;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/asset/AssetCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/asset/AssetCreate.js b/security-admin/src/main/webapp/scripts/views/asset/AssetCreate.js
new file mode 100644
index 0000000..50a15ca
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/asset/AssetCreate.js
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+/* 
+ * Repository/Asset create view
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+	var App				= require('App');
+
+	var XAUtil			= require('utils/XAUtils');
+	var XAEnums			= require('utils/XAEnums');
+	var XALinks 		= require('modules/XALinks');
+	var localization	= require('utils/XALangSupport');
+
+	var AssetForm		= require('views/asset/AssetForm');
+	var AssetcreateTmpl = require('hbs!tmpl/asset/AssetCreate_tmpl');
+
+	var AssetCreate = Backbone.Marionette.Layout.extend(
+	/** @lends AssetCreate */
+	{
+		_viewName : 'AssetCreate',
+
+		template: AssetcreateTmpl,
+		
+		templateHelpers : function(){
+			return { editAsset : this.editAsset};
+		},
+        
+		breadCrumbs :function(){
+			if(this.model.isNew())
+				return [XALinks.get('RepositoryManager'), XALinks.get('AssetCreate', {model:this.model})];
+			else
+				return [XALinks.get('RepositoryManager'), XALinks.get('AssetEdit',{model:this.model})];
+		},        
+
+		/** Layout sub regions */
+		regions: {
+			'rForm' :'div[data-id="r_form"]'
+		},
+
+		/** ui selector cache */
+		ui: {
+			'btnSave'	: '[data-id="save"]',
+			'btnCancel' : '[data-id="cancel"]',
+			'btnDelete' : '[data-id="delete"]',
+			'btnTestConn' : '[data-id="testConn"]'
+		},
+
+		/** ui events hash */
+		events: function() {
+			var events = {};
+			events['click ' + this.ui.btnSave]		= 'onSave';
+			events['click ' + this.ui.btnCancel]	= 'onCancel';
+			events['click ' + this.ui.btnDelete]	= 'onDelete';
+			events['click ' + this.ui.btnTestConn]	= 'onTestConnection';
+			return events;
+		},
+
+		/**
+		 * intialize a new AssetCreate Layout 
+		 * @constructs
+		 */
+		initialize: function(options) {
+			console.log("initialized a AssetCreate Layout");
+
+			_.extend(this, _.pick(options, 'repositoryName'));
+			if(! this.model.isNew()){
+				this.setupModel();
+			}
+			this.form = new AssetForm({
+				model : this.model,
+				template : require('hbs!tmpl/asset/AssetForm_tmpl')
+			});
+			this.editAsset = this.model.has('id') ? true : false;
+
+			this.bindEvents();
+		},
+		setupModel : function(){
+			var that = this;
+			//var obj = _.pick(this.model.attributes,['username','password','fsDefaultName' ,'authorization', 'authentication', 'auth_to_local', 'datanode', 'namenode', 'secNamenode']);
+			if(this.model.get('config')){
+				var configObj = $.parseJSON(this.model.get('config')); 
+				_.each(configObj,function(val,prop){
+					_.each(that.model.propertiesNameMap,function(v,p){
+						if(prop == v){
+							that.model.set(p,val);
+						}
+					});
+				});
+			}
+			
+			//this.model.set('config',JSON.stringify(obj));
+		},
+
+		/** 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() {
+			if(!this.editAsset){
+				this.ui.btnDelete.hide();
+				this.ui.btnSave.html('Add');
+			}else{
+				
+			//	XAUtil.preventNavigation(localization.tt('dialogMsg.preventNavRepositoryForm'));
+			}
+			this.rForm.show(this.form);
+			this.rForm.$el.dirtyFields();
+			XAUtil.preventNavigation(localization.tt('dialogMsg.preventNavRepositoryForm'),this.rForm.$el);
+			this.initializePlugins();
+		},
+
+		/** all post render plugin initialization */
+		initializePlugins: function(){
+		},
+
+		onSave: function(){
+			var errors = this.form.commit({validate : false});
+			if(! _.isEmpty(errors)){
+				return;
+			}
+			this.form.formValidation();
+			this.saveAsset();
+
+		},
+		saveAsset : function(){
+			var that = this;
+			this.form.beforeSave();
+			XAUtil.blockUI();
+			this.model.save({},{
+				wait: true,
+				success: function () {
+					XAUtil.blockUI('unblock');
+					XAUtil.allowNavigation();
+					var msg = that.editAsset ? 'Repository updated successfully' :'Repository created successfully';
+					XAUtil.notifySuccess('Success', msg);
+					
+					if(that.editAsset){
+						App.appRouter.navigate("#!/policymanager",{trigger: true});
+						return;
+					}
+					
+					App.appRouter.navigate("#!/policymanager",{trigger: true});
+					
+				},
+				error: function (model, response, options) {
+					XAUtil.blockUI('unblock');
+					if ( response && response.responseJSON && response.responseJSON.msgDesc){
+						if(response.responseJSON.msgDesc == "serverMsg.fsDefaultNameValidationError"){
+							that.form.fields.fsDefaultName.setError(localization.tt(response.responseJSON.msgDesc));
+							XAUtil.scrollToField(that.form.fields.fsDefaultName.$el);
+						}else if(response.responseJSON.msgDesc == "Repository Name already exists"){
+							response.responseJSON.msgDesc = "serverMsg.repositoryNameAlreadyExistsError";
+							that.form.fields.name.setError(localization.tt(response.responseJSON.msgDesc));
+							XAUtil.scrollToField(that.form.fields.name.$el);
+						}else if(response.responseJSON.msgDesc == "XUser already exists"){
+							response.responseJSON.msgDesc = "serverMsg.userAlreadyExistsError";
+							that.form.fields.userName.setError(localization.tt(response.responseJSON.msgDesc));
+							XAUtil.scrollToField(that.form.fields.userName.$el);
+						}else
+							XAUtil.notifyError('Error', response.responseJSON.msgDesc);
+					}else
+						XAUtil.notifyError('Error', 'Error creating Asset!');
+					console.log("error");
+				}
+			});
+		},
+		onDelete :function(){
+			var that = this;
+			XAUtil.confirmPopup({
+				//msg :localize.tt('msg.confirmDelete'),
+				msg :'Are you sure want to delete ?',
+				callback : function(){
+					XAUtil.blockUI();
+					
+					that.model.destroy({
+						success: function(model, response) {
+							XAUtil.blockUI('unblock');
+							XAUtil.allowNavigation();
+							XAUtil.notifySuccess('Success', 'Repository delete successfully');
+							App.appRouter.navigate("#!/policymanager",{trigger: true});
+						},
+						error: function (model, response, options) {
+							XAUtil.blockUI('unblock');
+							if ( response && response.responseJSON && response.responseJSON.msgDesc){
+									XAUtil.notifyError('Error', response.responseJSON.msgDesc);
+							}else
+								XAUtil.notifyError('Error', 'Error occured while deleting asset!');
+						}
+					});
+					
+				}
+			});
+		},
+		onTestConnection : function(){
+			var errors = this.form.commit({validate : false});
+			if(! _.isEmpty(errors)){
+				return;
+			}
+			this.form.beforeSave();
+			this.model.testConfig(this.model,{
+					//wait: true,
+					success: function (msResponse, options) {
+						if(msResponse.statusCode)
+							bootbox.alert("Connection Problem.");
+						else
+							bootbox.alert("Connected Successfully.");
+					},
+					error: function (msResponse, options) {
+					}	
+				});
+		},
+		onCancel : function(){
+			XAUtil.allowNavigation();
+			App.appRouter.navigate("#!/policymanager",{trigger: true});
+		},
+		/** on close */
+		onClose: function(){
+			XAUtil.allowNavigation();
+		}
+	});
+
+	return AssetCreate; 
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js b/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js
new file mode 100644
index 0000000..aa45a9e
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/asset/AssetForm.js
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+    
+	var XAEnums			= require('utils/XAEnums');
+	var localization	= require('utils/XALangSupport');
+
+	require('backbone-forms');
+	require('backbone-forms.list');
+	require('backbone-forms.templates');
+	require('backbone-forms.XAOverrides');
+
+	var AssetForm = Backbone.Form.extend(
+	/** @lends AssetForm */
+	{
+		_viewName : 'AssetForm',
+
+    	/**
+		* intialize a new AssetForm Form View 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a AssetForm Form View");
+    		Backbone.Form.prototype.initialize.call(this, options);
+
+			_.extend(this, _.pick(options, ''));
+
+			this.bindEvents();
+		},
+
+		/** all events binding here */
+		bindEvents : function(){
+			this.on('assetType:change', function(form, fieldEditor){
+    			this.evFieldChange(form, fieldEditor);
+    		});
+		},
+
+		/** schema for the form
+		* If you see that a field should behave similarly in all the forms, its 
+		* better to make the change in this.model.schema itself
+		*
+		* Override here ONLY if special case!!
+		*/
+
+		fields: ['name', 'description', 'activeStatus', 'assetType','config', '_vPassword'],
+
+		schema : function(){
+
+			var attrs = _.pick(_.result(this.model,'schemaBase'), 'name', 'description', 'activeStatus', 'assetType', 'config');
+
+			attrs._vPassword = {
+				type		: 'Password',
+				title		: localization.tt("lbl.assetConfigPass")
+			};
+			$.extend(attrs,{
+				userName : {
+					type : 'Text',
+//					fieldClass : "hdfs hive knox",
+					title : this.model.propertiesNameMap.userName+" *",//'xalogin.username'
+					validators  : ['required',{type:'regexp',regexp:/^[a-z][a-z0-9,._'-]+$/i,message :'Please enter valid username'}],
+					editorAttrs :{'class':'stretchTextInput','maxlength': 32}
+				},
+				passwordKeytabfile : {
+					type : 'Password',
+//					fieldClass : "hdfs hive knox",
+					title : this.model.propertiesNameMap.passwordKeytabfile+" *",//'xalogin.password'
+					validators:['required'],
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				fsDefaultName : {
+					fieldClass : "hdfs",
+					title : this.model.propertiesNameMap.fsDefaultName +" *",//'core-site.fs.default.name',
+					validators:['required'],
+					            /*{type:'regexp',regexp:new RegExp('(hdfs://)\\s*(.*?):[0-9]{1,5}'),
+								message :localization.tt('serverMsg.fsDefaultNameValidationError')}],*/
+					editorAttrs :{'class':'stretchTextInput'}								
+							
+					
+				},
+				authorization : {
+					fieldClass : "hdfs",
+					title : this.model.propertiesNameMap.authorization,//'core-site.hadoop.security.authorization',
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				authentication : {
+					fieldClass : "hdfs",
+					title : this.model.propertiesNameMap.authentication,//'core-site.hadoop.security.authentication'
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				auth_to_local : {
+					fieldClass : "hdfs",
+					title : this.model.propertiesNameMap.auth_to_local,//'core-site.hadoop.security.auth_to_local'
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				datanode : {
+					title		: this.model.propertiesNameMap.datanode,//'hdfs-site.dfs.datanode.kerberos.principal',
+					fieldClass : "hdfs",
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				namenode : {
+					title		: this.model.propertiesNameMap.namenode,//'hdfs-site.dfs.namenode.kerberos.principal',
+					fieldClass : "hdfs",
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				secNamenode : {
+					title		: this.model.propertiesNameMap.secNamenode,//'hdfs-site.dfs.secondary.namenode.kerberos.principal',
+					fieldClass : "hdfs",
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				driverClassName : {
+					fieldClass : "hive",
+					title : this.model.propertiesNameMap.driverClassName,//'xalogin.jdbc.driverClassName'
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				url : {
+					fieldClass : "hive",
+					title : this.model.propertiesNameMap.url,//'xalogin.jdbc.url'
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				masterKerberos : {
+					fieldClass : "hbase",
+					title : this.model.propertiesNameMap.masterKerberos,
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				rpcEngine : {
+					fieldClass : "hbase",
+					title : this.model.propertiesNameMap.rpcEngine,
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				rpcProtection : {
+					fieldClass : "hbase",
+					title : this.model.propertiesNameMap.rpcProtection,
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				securityAuthentication : {
+					fieldClass : "hbase",
+					title : this.model.propertiesNameMap.securityAuthentication,
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				zookeeperProperty : {
+					fieldClass : "hbase",
+					title : this.model.propertiesNameMap.zookeeperProperty,
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				zookeeperQuorum : {
+					fieldClass : "hbase",
+					title : this.model.propertiesNameMap.zookeeperQuorum,
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				zookeeperZnodeParent : {
+					fieldClass : "hbase",
+					title : this.model.propertiesNameMap.zookeeperZnodeParent,
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				knoxUrl : {
+					fieldClass : "knox",
+					title : this.model.propertiesNameMap.knoxUrl,
+					editorAttrs :{'class':'stretchTextInput'}
+				},
+				commonnameforcertificate : {
+					title : localization.tt('lbl.commonNameForCertificate'),
+					editorAttrs :{'class':'stretchTextInput'}
+				}
+			});
+			return attrs;
+		},
+
+		/** on render callback */
+		render: function(options) {
+			Backbone.Form.prototype.render.call(this, options);
+
+			this.initializePlugins();
+			this.renderCustomFields();
+			if(!this.model.isNew())
+				this.fields.assetType.editor.$el.prop('disabled',true);
+			else
+				this.fields.activeStatus.editor.setValue(XAEnums.ActiveStatus.STATUS_ENABLED.value);
+		},
+
+		/** all custom field rendering */
+		renderCustomFields: function(){
+			/*this.$('[data-customfields="field1"]').append(new fieldView({
+			}).render().el);*/
+			//TODO FIXME 
+			
+			if(this.model)
+				this.assetTypeChanged(this.model.get('assetType'));
+		},
+
+		/** all post render plugin initialization */
+		initializePlugins: function(){
+		},
+
+		formValidation : function(){
+			//return false;
+			return true;
+		},
+
+		beforeSave : function(){
+			var that = this;
+			//this.model.set('assetId', XAGlobals.hardcoded.HDFSAssetId);
+//			var attrs = ['userName','passwordKeytabfile','fsDefaultName' ,'authorization', 'authentication', 'auth_to_local', 'datanode', 'namenode', 'secNamenode',
+//							'driverClassName', 'url'];
+			var attrs;
+			switch(parseInt(this.model.get('assetType'))){
+				case XAEnums.AssetType.ASSET_HDFS.value :
+					attrs = ['userName','passwordKeytabfile','fsDefaultName' ,'authorization', 'authentication', 'auth_to_local', 'datanode', 'namenode', 'secNamenode',
+								'commonnameforcertificate'];
+					break;
+				case XAEnums.AssetType.ASSET_HIVE.value :
+					attrs = ['userName','passwordKeytabfile','driverClassName', 'url','commonnameforcertificate'];
+					break;
+				case XAEnums.AssetType.ASSET_HBASE.value :
+					attrs = ['userName','passwordKeytabfile','fsDefaultName' ,'authorization', 'authentication', 'auth_to_local', 'datanode', 'namenode', 'secNamenode',
+								'masterKerberos','rpcEngine','rpcProtection','securityAuthentication','zookeeperProperty','zookeeperQuorum','zookeeperZnodeParent','commonnameforcertificate'];
+					break;
+				case XAEnums.AssetType.ASSET_KNOX.value :
+					attrs = ['userName','passwordKeytabfile','knoxUrl','commonnameforcertificate'];
+					break;
+				case XAEnums.AssetType.ASSET_STORM.value :
+					attrs = ['userName','passwordKeytabfile','commonnameforcertificate'];
+			}
+			var obj = _.pick(this.model.attributes,attrs);
+			_.each(obj,function(val,prop){
+				obj[that.model.propertiesNameMap[prop]] = obj[prop];
+				delete obj[prop];
+				this.model.unset(prop);
+			},this);
+			this.model.set('config',JSON.stringify(obj));
+		},
+		evFieldChange : function(form, fieldEditor){
+			this.assetTypeChanged(fieldEditor.getValue());
+		},
+		assetTypeChanged : function(val){
+			this.$('.hive').parents('fieldset').show();
+			this.$('.hdfs,.hive,.hbase,.knox').hide();
+			switch(parseInt(val)){
+				case XAEnums.AssetType.ASSET_HDFS.value :
+					this.fields.fsDefaultName.$el.find('.control-label').html(this.model.propertiesNameMap.fsDefaultName+'*');
+//					this.fields.fsDefaultName.editor.validators.push('required');
+					this.$('.hdfs').show();
+					break;
+				case XAEnums.AssetType.ASSET_HIVE.value :
+					this.fields.fsDefaultName.editor.validators = this.removeElementFromArr(this.fields.fsDefaultName.editor.validators , 'required');
+					this.$('.hive').show();
+					break;
+				case XAEnums.AssetType.ASSET_HBASE.value :
+					//	this.$('.hive').parents('fieldset').hide();
+					this.fields.fsDefaultName.$el.find('.control-label').html(this.model.propertiesNameMap.fsDefaultName);
+					this.fields.fsDefaultName.$el.removeClass('error');
+					this.fields.fsDefaultName.$el.find('.help-inline').html('');
+//					this.fields.fsDefaultName.editor.$el.val('');
+					this.fields.fsDefaultName.editor.validators = this.removeElementFromArr(this.fields.fsDefaultName.editor.validators , 'required');
+					//Set default value to zookeeperZnodeParent
+					if(this.model.isNew())
+						this.fields.zookeeperZnodeParent.editor.$el.val('/hbase');
+					this.$('.hdfs').show();
+					this.$('.hive').show();//parents('fieldset').show();
+					this.fields.driverClassName.$el.hide();
+					this.fields.url.$el.hide();
+					this.$('.hbase').show();
+					break;
+				case XAEnums.AssetType.ASSET_KNOX.value :
+					this.fields.fsDefaultName.editor.validators = this.removeElementFromArr(this.fields.fsDefaultName.editor.validators , 'required');
+					this.$('.knox').show();
+					break;
+				case XAEnums.AssetType.ASSET_STORM.value :
+					this.fields.fsDefaultName.editor.validators = this.removeElementFromArr(this.fields.fsDefaultName.editor.validators , 'required');
+					this.$('.storm').show();
+					break;	
+				
+			}
+	/*		if(val == XAEnums.AssetType.ASSET_HDFS.value){
+				this.fields.fsDefaultName.$el.find('.control-label').html(this.model.propertiesNameMap.fsDefaultName+'*');
+				this.fields.fsDefaultName.editor.validators.push('required');
+				this.$('.hdfs').show();
+			}else if(val == XAEnums.AssetType.ASSET_HIVE.value){
+				this.fields.fsDefaultName.editor.validators = this.removeElementFromArr(this.fields.fsDefaultName.editor.validators , 'required');
+				this.$('.hive').show();
+			}else{
+			//	this.$('.hive').parents('fieldset').hide();
+				this.fields.fsDefaultName.$el.find('.control-label').html(this.model.propertiesNameMap.fsDefaultName);
+				this.fields.fsDefaultName.$el.removeClass('error');
+				this.fields.fsDefaultName.$el.find('.help-inline').html('');
+//				this.fields.fsDefaultName.editor.$el.val('');
+				this.fields.fsDefaultName.editor.validators = this.removeElementFromArr(this.fields.fsDefaultName.editor.validators , 'required');
+				//Set default value to zookeeperZnodeParent
+				if(this.model.isNew())
+					this.fields.zookeeperZnodeParent.editor.$el.val('/hbase');
+				this.$('.hdfs').show();
+				this.$('.hive').show();//parents('fieldset').show();
+				this.fields.driverClassName.$el.hide();
+				this.fields.url.$el.hide();
+				this.$('.hbase').show();
+			}*/
+			this.fields.userName.setValue('');
+			this.fields.passwordKeytabfile.setValue('');
+			if(! this.model.isNew()){
+				if(val == this.model.get('assetType') && this.model.get('config')){
+					var configObj=$.parseJSON(this.model.get('config'));
+					this.fields.userName.setValue(configObj[this.model.propertiesNameMap.userName]);
+					this.fields.passwordKeytabfile.setValue(configObj[this.model.propertiesNameMap.passwordKeytabfile]);
+				}
+			}
+			
+		},
+		removeElementFromArr : function(arr ,elem){
+			var index = $.inArray(elem,arr);
+			if(index >= 0) arr.splice(index,1);
+			return arr;
+		}
+	});
+
+	return AssetForm;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/asset/AssetTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/asset/AssetTableLayout.js b/security-admin/src/main/webapp/scripts/views/asset/AssetTableLayout.js
new file mode 100644
index 0000000..2cb6190
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/asset/AssetTableLayout.js
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+	var Communicator	= require('communicator');
+	var App				= require('App');
+	var XALinks 		= require('modules/XALinks');
+	var XAEnums 		= require('utils/XAEnums');
+	var XAGlobals 		= require('utils/XAGlobals');
+	var localization	= require('utils/XALangSupport');
+	
+	var XABackgrid		= require('views/common/XABackgrid');
+	var XATableLayout	= require('views/common/XATableLayout');
+
+	var AssettablelayoutTmpl = require('hbs!tmpl/asset/AssetTableLayout_tmpl'); 
+
+	require('backgrid-filter');
+	require('backgrid-paginator');
+	require('bootbox');
+
+	var AssetTableLayout = Backbone.Marionette.Layout.extend(
+	/** @lends AssetTableLayout */
+	{
+		_viewName : 'AssetTableLayout',
+		
+    	template: AssettablelayoutTmpl,
+        
+		/*
+    	breadCrumbs :function(){
+    		if(this.model.isNew())
+    			return [XALinks.get(''), XALinks.get('')];
+    		else
+    			return [XALinks.get(''), XALinks.get('')];
+    	},        
+		*/
+
+		/** Layout sub regions */
+    	regions: {
+			'rTableList'	: 'div[data-id="r_assettable"]'
+		},
+
+    	/** ui selector cache */
+    	ui: {},
+
+		/** ui events hash */
+		events: function() {
+			var events = {};
+			//events['change ' + this.ui.input]  = 'onInputChange';
+			return events;
+		},
+
+    	/**
+		* intialize a new AssetTableLayout Layout 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a AssetTableLayout Layout");
+
+			_.extend(this, _.pick(options, ''));
+			
+			this.collection.extraSearchParams = {
+				//resourceType : XAEnums.AssetType.ASSET_HDFS.value	
+			};
+
+			this.bindEvents();
+		},
+
+		/** 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();
+			this.renderTable();
+		},
+
+		/** all post render plugin initialization */
+		initializePlugins: function(){
+		},
+
+		renderTable : function(){
+			var that = this;
+			var TableRow = Backgrid.Row.extend({
+				events: {
+					'click' : 'onClick'
+				},
+				onClick: function (e) {
+					if($(e.toElement).is('.icon-edit'))
+						return;
+					this.$el.parent('tbody').find('tr').removeClass('tr-active');
+					this.$el.toggleClass('tr-active');
+					that.rFolderInfo.show(new vFolderInfo({
+						model : this.model
+					}));
+									
+				}
+			});
+
+			this.rTableList.show(new XATableLayout({
+				columns: this.getColumns(),
+				collection: this.collection,
+				includeFilter : false,
+				gridOpts : {
+					row: TableRow,
+					header : XABackgrid,
+					emptyText : localization.tt('plcHldr.noAssets')
+				},
+				filterOpts : {
+				  name: ['name'],
+				  placeholder: localization.tt('plcHldr.searchByResourcePath'),
+				  wait: 150
+				}
+			}));
+		},
+
+		getColumns : function(){
+			var that = this;
+			var cols = {
+				name : {
+					label	: localization.tt("lbl.resourcePath"),
+					placeholder : 'Resource Path',
+					editable:false
+					//cell :"uri,"
+					/*href: function(model){
+						return '#!/policy/' + model.id;
+					}*/
+				}
+				
+			};
+			return this.collection.constructor.getTableCols(cols, this.collection);
+		},
+
+
+		/** on close */
+		onClose: function(){
+		}
+
+	});
+
+	return AssetTableLayout; 
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/common/AddGroup.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/common/AddGroup.js b/security-admin/src/main/webapp/scripts/views/common/AddGroup.js
new file mode 100644
index 0000000..7db51c4
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/common/AddGroup.js
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+	var Communicator	= require('communicator');
+	var XAUtil			= require('utils/XAUtils');
+	var XAEnums			= require('utils/XAEnums');
+	var localization	= require('utils/XALangSupport');
+	var VXGroup			= require('models/VXGroup');
+	var AddGroup_tmpl = require('hbs!tmpl/common/AddGroup_tmpl');
+	
+	require('bootstrap-editable');
+	var AddGroup = Backbone.Marionette.ItemView.extend(
+	/** @lends AddGroup */
+	{
+		_viewName : 'AddGroup',
+		
+    	template: AddGroup_tmpl,
+        templateHelpers :function() {
+        	return {
+        		groupId : this.model.get('groupIdList'),
+        		isModelNew	: this.model.isNew()
+        	};
+        },
+    	/** ui selector cache */
+    	ui: {
+    		'addGroup' :'#addGroup',
+    		'errorMsg' : '[data-error="groupIdList"]'
+    	},
+
+		/** ui events hash */
+		events: function() {
+			var events = {};
+			//events['change ' + this.ui.input]  = 'onInputChange';
+			return events;
+		},
+
+    	/**
+		* intialize a new AddGroup ItemView 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a AddGroup ItemView");
+
+			_.extend(this, _.pick(options, 'groupList'));
+			this.bindEvents();
+		},
+
+		/** 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() {
+			var that = this , arr =[];
+			this.groupArr = this.groupList.map(function(m){
+				return { id : m.id+"" , text : m.get('name')};
+			});
+			this.initializePlugins();
+			$.fn.editable.defaults.mode = 'popover';
+			
+			if(!_.isUndefined(this.model.get('userSource')) && this.model.get('userSource') == XAEnums.UserSource.XA_USER.value){
+				this.$el.find('#tags-edit-1').hide();
+			}
+
+			this.$('.tags').editable({
+			    placement: 'right',
+			    emptytext : 'Please select',
+				select2 :this.getSelect2Options(),
+			    display: function(values,srcDate) {
+			    	if(_.isNull(values)){
+			    		$(this).html('');
+			    		return;
+			    	}
+			    	that.checkDirtyFieldForGroup(values);
+			    	if(!_.isArray(values))
+			    		values=values.toString().split(',');
+			    	var valArr = [];
+		    		var valArr = _.map(values, function(val){
+		    			var obj = _.findWhere(that.groupArr,{id:val});
+		    			return "<span class='label label-inverse'>" + obj.text + "</span>";
+		    		});
+		    		
+		    		$(this).html(valArr.join(" "));
+		    		if(valArr.length > 0){
+		    			that.$('.field-groupIdList').removeClass('error');
+		    			that.ui.errorMsg.hide();
+		    		}else{
+		    			that.$('.field-groupIdList').addClass('error');
+		    			that.ui.errorMsg.show();
+		    		}
+			    		
+			    },
+			    success: function(response, newValue) {
+			    	console.log(newValue);
+			    	//that.model.set('group',newValue);
+			    	
+			    }
+			});
+			this.$('[id^="tags-edit-"]').click(function(e) {
+			    e.stopPropagation();
+			    e.preventDefault();
+			    $('#' + $(this).data('editable') ).editable('toggle');
+			});
+
+		},
+		/** all post render plugin initialization */
+		initializePlugins: function(){
+		},
+		checkDuplicatesInArray :function(array) {
+		    var valuesSoFar = {};
+		    for (var i = 0; i < array.length; ++i) {
+		        var value = array[i];
+		        if (Object.prototype.hasOwnProperty.call(valuesSoFar, value)) {
+		            return true;
+		        }
+		        valuesSoFar[value] = true;
+		    }
+		    return false;
+		},
+		getSelect2Options :function(){
+			var that = this;
+			return{
+				closeOnSelect : true,
+				placeholder : 'Select Group',
+			//	maximumSelectionSize : 1,
+				width :'220px',
+				tokenSeparators: [",", " "],
+				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});
+					});
+					callback(data);
+				},
+				/*createSearchChoice: function(term, data) {
+					if ($(data).filter(function() {
+						return this.text.localeCompare(term) === 0;
+					}).length === 0) {
+						return {
+							id : term,
+							text: term
+						};
+					}
+				},*/
+				ajax: { 
+					url: "service/xusers/groups",
+					dataType: 'json',
+					data: function (term, page) {
+						return {name : term};
+					},
+					results: function (data, page) { 
+						var results = [],selectedVals = [];
+						if(!_.isEmpty(that.$('.tags').data('editable').input.$input.val()))
+							selectedVals = that.$('.tags').data('editable').input.$input.val().split(',');
+						if(data.resultSize != "0"){
+							//if(data.vXGroups.length > 1){
+								results = data.vXGroups.map(function(m, i){	return {id : (m.id).toString(), text: m.name};	});
+								if(!_.isEmpty(selectedVals))
+									results = XAUtil.filterResultByIds(results, selectedVals);
+				//				console.log(results.length);
+								return {results : results};
+					//		}
+						//	results = [{id : (data.vXGroups.id)+"", text: data.vXGroups.name}];
+						//	return {results : results};
+						}
+						return {results : results};
+					}
+				},	
+				formatResult : function(result){
+					return result.text;
+				},
+				formatSelection : function(result){
+					return result.text;
+				},
+				formatNoMatches: function(result){
+					return 'No group found.';
+				}
+			};
+		},
+		checkDirtyFieldForGroup : function(changeValues){
+			var groupIdList = [];
+			if(!_.isArray(changeValues))
+				changeValues = [changeValues];
+			changeValues = _.map(changeValues, function(val){return parseInt(val);});
+			if(!_.isUndefined(this.model.get('groupIdList')))
+				groupIdList = this.model.get('groupIdList'); 
+			XAUtil.checkDirtyField(groupIdList, changeValues, this.$el);
+		},
+		
+		/** on close */
+		onClose: function(){
+		}
+
+	});
+
+	return AddGroup;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js b/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js
new file mode 100644
index 0000000..8001a8b
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js
@@ -0,0 +1,63 @@
+/**
+ * 
+ * BreadCrumbs Veiw  
+ * BreadCrumbs is directly accessible through App object .But can also create a instance of it.
+ * @array 
+ */
+
+define(function(require) {
+	var Marionette	= require('backbone.marionette');
+	var tmpl		= require('hbs!tmpl/common/breadcrumbs');
+//	var Vent		= new Backbone.Wreqr.EventAggregator();
+	var App		= require('App');
+
+	var BreadCrumbs = Marionette.ItemView.extend({
+		template : tmpl,
+		templateHelpers : function(){
+			return {
+				breadcrumb : this.setLast(this.breadcrumb)
+			};
+		},
+		initialize : function(options){
+			this.breadcrumb = [];
+			if(typeof options !== 'undefined'){
+				this.breadcrumb = options.breadcrumb;
+			}
+			//In docs the breadcrubs region stays constant only inner content changes
+	/*		this.listenTo(Vent,'draw:docs:breadcrumbs',function(breads){
+				this.breadcrumb = breads;
+				this.reRenderBookmarks();
+			},this);*/
+		},
+		onRender : function(){
+
+		},
+		reRenderBookmarks : function(){
+			this.breadcrumb = this.setLast(this.breadcrumb);
+			this.render();
+		},
+		setLast : function(breadcrumb){
+			if(breadcrumb.length > 0){
+				//breadcrumb[breadcrumb.length -1].isLast = true;
+				breadcrumb[breadcrumb.length -1] = _.extend({},breadcrumb[breadcrumb.length -1],{isLast : true});
+			}
+			return breadcrumb;
+		},
+		// showBreadCrumbs : function(view,breadcrumb){
+			// var brRgn = view.$el.find('#brdCrumbs');
+			// if(brRgn){
+				// $(brRgn).html(Marionette.Renderer.render(tmpl,{breadcrumb : this.setLast(breadcrumb)}));	
+			// }/*else{*/
+			   // ////throw new Error('This view does not have a  #brdCrumbs id'); 
+			// /*}*/
+		// },
+		onClose : function(){       
+			console.log('OnItemClosed called of BreadCrumbs');
+		//	this.stopListening(Vent);
+		}
+	});
+
+	App.BreadCrumbs = new BreadCrumbs();	
+
+	return BreadCrumbs;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/common/DashboardLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/common/DashboardLayout.js b/security-admin/src/main/webapp/scripts/views/common/DashboardLayout.js
new file mode 100644
index 0000000..6c5c961
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/common/DashboardLayout.js
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+	var Communicator	= require('communicator');
+	var XALinks 			= require('modules/XALinks');
+	var DashboardlayoutTmpl = require('hbs!tmpl/dashboard/DashboardLayout_tmpl');
+
+	var DashboardLayout = Backbone.Marionette.Layout.extend(
+	/** @lends DashboardLayout */
+	{
+		_viewName : name,
+		
+    	template: DashboardlayoutTmpl,
+    	breadCrumbs : [XALinks.get('Dashboard')],
+        
+		/** Layout sub regions */
+    	regions: {},
+
+    	/** ui selector cache */
+    	ui: {},
+
+		/** ui events hash */
+		events: {},
+
+    	/**
+		* intialize a new DashboardLayout Layout 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a DashboardLayout Layout");
+
+			_.extend(this, _.pick(options, ''));
+			
+			this.bindEvents();
+		},
+
+		/** 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(){
+		},
+
+		/** on close */
+		onClose: function(){
+		}
+
+	});
+	
+	return DashboardLayout;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/common/ErrorView.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/common/ErrorView.js b/security-admin/src/main/webapp/scripts/views/common/ErrorView.js
new file mode 100644
index 0000000..837f7f2
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/common/ErrorView.js
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+	var Communicator	= require('communicator');
+	
+	var ErrorView_tmpl = require('hbs!tmpl/common/ErrorView_tmpl'); 
+	
+	var ErrorView = Backbone.Marionette.ItemView.extend(
+	/** @lends ErrorView */
+	{
+		_viewName : ErrorView,
+		
+    	template: ErrorView_tmpl,
+        templateHelpers :function(){
+        	return {
+        		restrictedAccess :this.restrictedAccess || false,
+        		pageNotFound :this.pageNotFound || false
+        	};
+        },
+    	/** ui selector cache */
+    	ui: {
+    		'goBackBtn' : 'a[data-id="goBack"]',
+    		'home' 		: 'a[data-id="home"]'
+    	},
+
+		/** ui events hash */
+		events: function() {
+			var events = {};
+			//events['change ' + this.ui.input]  = 'onInputChange';
+			events['click ' + this.ui.goBackBtn]  = 'goBackClick';
+			return events;
+		},
+
+    	/**
+		* intialize a new ErrorView ItemView 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a ErrorView ItemView");
+
+			_.extend(this, _.pick(options, 'restrictedAccess','pageNotFound'));
+
+			this.bindEvents();
+		},
+
+		/** 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();
+			$('#r_breadcrumbs').hide();
+		},
+		goBackClick : function(){
+			
+		},
+
+		/** all post render plugin initialization */
+		initializePlugins: function(){
+		},
+		/** on close */
+		onClose: function(){
+			$('#r_breadcrumbs').show();
+		}
+
+	});
+
+	return ErrorView;
+});

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7defc061/security-admin/src/main/webapp/scripts/views/common/Footer.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/common/Footer.js b/security-admin/src/main/webapp/scripts/views/common/Footer.js
new file mode 100644
index 0000000..f37fc56
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/common/Footer.js
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014 XASecure
+ * All rights reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * XASecure. ("Confidential Information").  You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with XASecure.
+ */
+
+define(function(require){
+    'use strict';
+
+	var Backbone		= require('backbone');
+	var Communicator	= require('communicator');
+
+	var Footer_tmpl = require('hbs!tmpl/common/Footer_tmpl'); 
+	
+	var Footer = Backbone.Marionette.ItemView.extend(
+	/** @lends Footer */
+	{
+		_viewName : Footer,
+		
+    	template: Footer_tmpl,
+        
+    	/** ui selector cache */
+    	ui: {},
+
+		/** ui events hash */
+		events: function() {
+			var events = {};
+			//events['change ' + this.ui.input]  = 'onInputChange';
+			return events;
+		},
+
+    	/**
+		* intialize a new Footer ItemView 
+		* @constructs
+		*/
+		initialize: function(options) {
+			console.log("initialized a Footer ItemView");
+
+			_.extend(this, _.pick(options, ''));
+
+			this.bindEvents();
+		},
+
+		/** 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(){
+		},
+
+		/** on close */
+		onClose: function(){
+			
+		}
+
+	});
+
+	return Footer;
+});


Mime
View raw message