You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2016/09/13 10:42:04 UTC

[47/51] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal code - part 3 (oleewere)

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js
index 4fb9b51..988c593 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js
@@ -57,28 +57,9 @@ define(['require',
 
 		/** ui events hash */
 		events: function() {
-//			var that=this,
 			var events = {};
-//			events["mouseenter .logTime"] = function(e){
-//				$(e.currentTarget).find("a").removeClass("hidden");
-//			};
-//			events["mouseleave .logTime"] = function(e){
-//				$(e.currentTarget).find("a").addClass("hidden");
-//			};
-//			events["click .logTime a[data-type='C']"] = 'onNewTabIconClick';
 			events['click [data-id="refresh-tab"]']  = 'onTabRefresh';
 			events['change ' + this.ui.viewType]  = 'onViewTypeChange';
-//			events["mouseenter .logTime"] = function(e){
-//				var $el = $(e.currentTarget);
-//				$el.append(dropdownMenu);
-//				$el.find('.quickMenu li').click(function(e){
-//					that.onQuickMenuClick(e);
-//				});
-//			};
-//			events["mouseleave .logTime"] = function(e){
-//				var $el = $(e.currentTarget);
-//				//$el.find(".quickMenu").remove();
-//			};
 			events['click .quickMenu li']  = 'onQuickMenuClick';
 			return events;
 		},
@@ -109,11 +90,7 @@ define(['require',
 			this.listenTo(this.collection, "backgrid:refresh",function(){
 				$(".contextMenuBody [data-id='F']").show();
             	$(".contextMenuBody").hide();
-            	//this.$("#loaderGraph").hide();
 				this.$(".loader").hide();
-            	//this.ui.find.trigger("keyup");
-//            	if (this.quickHelp)
-//            		this.initializeContextMenu();
             },this);
 			this.listenTo(this.collection, 'request', function(){
 				this.$("#loader").show();
@@ -126,23 +103,6 @@ define(['require',
             	this.fetchAllTogether(value);
             	this.selectionText="";
             });
-//            this.listenTo(this.vent,"tree:search",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"level:filter",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"type:mustNot",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"type:mustBe",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"logtime:filter",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"search:include:exclude",function(value){
-//            	this.fetchAllTogether(value);
 //            });
             this.listenTo(this.vent,"reinitialize:filter:bubbleTable",function(value){
             	this.reinitializeBubbleTableFilter(value);
@@ -151,12 +111,6 @@ define(['require',
                 this.fetchAllTogether(value);
             }, this);
             this.listenTo(this.vent, "timer:end", function(value) {
-            	//timer should start only after log table fetch is complete.
-//            	var arr = Utils.dateUtil.getRelativeDateFromString(this.params.dateRangeLabel);
-//            	if(_.isArray(arr)){
-//            		this.params.from = arr[0].toJSON();
-//                	this.params.to = arr[1].toJSON();
-//            	}
             	ViewUtils.setLatestTimeParams(this.params);
             	this.vent.trigger("tab:refresh",this.params);
             	var that = this;
@@ -180,30 +134,18 @@ define(['require',
 			var that = this;
 			this.fetchTableData((this.params) ? this.params : {q:"*:*"});
 			this.renderComponentList();
-			this.collection.getServiceLogFields({},{
-				success : function(data){
-					that.serverColumns = data;
-				},
-				complete : function(){
-					that.renderTable();
-				}
-			});
-			//this.renderTable();
-			this.renderHostList();
-			this.renderTimer();
-			if(this.quickHelp){
-				this.initializeContextMenu();
-				this.bindContextMenuClick();
-			}
+      this.renderTable();
+      this.renderHostList();
+      this.renderTimer();
+      if(this.quickHelp){
+        this.initializeContextMenu();
+        this.bindContextMenuClick();
+      }
 		},
 		onShow : function(){
 			//this.fetchGraphData((this.params) ? this.params : {q:"*:*"});
 		},
 		onTabRefresh : function(){
-//			this.fetchAllTogether({});
-//			if(this.RHostList.currentView){
-//				this.RHostList.currentView.fetchHosts({});
-//			}
 			ViewUtils.setLatestTimeParams(this.params);
 			this.vent.trigger("tab:refresh",this.params);
 		},
@@ -215,8 +157,8 @@ define(['require',
 				id = $el.data("id");
 				that.globalVent.trigger("render:tab",{
 					params:_.extend({},{
-						host :  host,
-						component : component,
+						host_name :  host,
+						component_name : component,
 						sourceLogId: id
 					},that.graphParams,{treeParams:null}),
 					globalVent : that.globalVent
@@ -292,16 +234,9 @@ define(['require',
 			var timeZone = moment().zoneAbbr(),
 			 	cols = {},
 			 	that = this;
-			_.each(this.columns,function(value,col){
-				cols[col] = {
-						label:value,
-						cell: "String",
-						sortType: 'toggle',
-						editable: false,
-				}
-			});
 			var columns = {
 					logtime : {
+            name: "logtime",
 						label: "Log Time "+(! _.isEmpty(timeZone) ? "("+timeZone+")":""),
 						cell: "html",
 						editable: false,
@@ -319,9 +254,7 @@ define(['require',
 								if(model.get("type"))
 									str += "<p style='margin-left:20px'>"+(model.get("level") ? "<label class='label label-"+model.get("level")+"'>"+model.get("level")+"</label>" : "")+
 											"<strong>"+model.get("type")+"</strong>" +
-											"</p><!--a  style='width:9%' title='Open logs in new tab' data-type='C' data-host='"+model.get("host")+"' data-node='"+model.get("type")+"' data-id='"+model.get("id")+"' href='javascript:void(0)' class='pull-right hidden'><i class='fa fa-share'></i></a-->";
-//								if(model.get("level"))
-//									str += "<p style='float:left;'><label class='label label-"+model.get("level")+"'>"+model.get("level")+"</label></p>";
+											"</p>";
 								str += '<div class="dropdown quickMenu">' +
 								  '<a class="btn btn-success btn-xs btn-quickMenu" data-toggle="dropdown">' +
 								  '<i class="fa fa-ellipsis-v"></i></span></a>' +
@@ -335,38 +268,13 @@ define(['require',
 							}
 						})
 					},
-					/*type: {
-						label: "Type",
-						cell: "String",
-						editable: false,
-						sortType: 'toggle',
-						sortable : false,
-						orderable : true,
-						displayOrder :2,
-						width : 11
-					},
-					level : {
-						label: "Level",
-						cell: "html",
-						editable: false,
-						sortType: 'toggle',
-						sortable : true,
-						orderable : false,
-						width : "6",
-						displayOrder :3,
-						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-							fromRaw: function(rawValue, model){
-								return "<span class='"+rawValue+"'>"+rawValue+"</span>";
-							}
-						})
-					},*/
 					log_message : {
+            name: "log_message",
 						label: "Message",
 						cell: "html",
 						editable: false,
 						sortType: 'toggle',
 						sortable : false,
-						//width : "50",
 						orderable : true,
 						displayOrder :4,
 						className : "logMessage",
@@ -418,15 +326,23 @@ define(['require',
 					}
 
 			};
-			_.each(cols,function(c,k){
-				if(columns[k] == undefined){
-					columns[k] = c;
-				}else{
-					if(columns[k] && columns[k].label){
-						columns[k].label = c.label;
-					}
-				}
-			});
+      _.each(this.columns, function(value){
+        var name = Globals.invertedServiceLogMappings[value];
+        if (columns[name] === undefined) {
+          var columnObj = {
+            name: Globals.invertedServiceLogMappings[value],
+            label:value,
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          };
+          columns[name] = columnObj;
+        } else {
+          if (columns[name] && columns[name].label) {
+            columns[name].label = value;
+          }
+        }
+      });
 			return this.collection.constructor.getTableCols(columns, this.collection);
 		},
 		fetchTableData : function(params){
@@ -461,7 +377,6 @@ define(['require',
 		},
 		fetchGraphData : function(params){
 			var that = this;
-			//that.$("#loaderGraph").show();
 			that.$(".loader").show();
 			this.graphModel.fetch({
 				dataType:"json",
@@ -472,7 +387,6 @@ define(['require',
 				error : function(){
 				},
 				complete : function(){
-					//that.$("#loaderGraph").hide();
 					that.$(".loader").hide();
 				}
 			});
@@ -512,14 +426,6 @@ define(['require',
 		},
 		initializeContextMenu : function(){
 			var that = this;
-//			$('body').on("mouseup",function(e){
-//				console.log(e);
-//				if(! $(".contextMenuBody").is(":hidden")){
-//					if(! $(e.target).parents(".contextMenuBody").length > 0){
-//						$(".contextMenuBody").hide();
-//					}
-//				}
-//			})
 			$('body').on("mouseup.contextMenu",function(e){
 				var selection;
 				if (window.getSelection) {
@@ -572,13 +478,6 @@ define(['require',
 		onDropDownMenuClick : function(e){
 			var $el = $(e.currentTarget),type=$el.data("id");
 			if(! _.isEmpty(this.selectionText)){
-//				if(type == "F"){
-////					this.ui.find.val(this.selectionText);
-////					this.ui.find.trigger("keyup");
-//				}else{
-//					//this.vent.trigger("add:include:exclude",{type:type,value:this.selectionText});
-//					this.vent.trigger("toggle:facet",{viewName:((type === "I") ? "include" : "exclude") +"ServiceColumns",key:Globals.serviceLogsColumns["log_message"],value:this.selectionText});
-//				}
 				if(type === "I" || type === "E"){
 					this.vent.trigger("toggle:facet",{viewName:((type === "I") ? "include" : "exclude") +"ServiceColumns",
 						key:Globals.serviceLogsColumns["log_message"],value:this.selectionText});
@@ -637,7 +536,6 @@ define(['require',
             })
             $('body').css('overflow', 'hidden');
 		},
-		/** closing the movable/resizable popup */
         onDialogClosed: function() {
             if (this.dialog) {
                 this.dialog.close && this.dialog.close();
@@ -715,8 +613,8 @@ define(['require',
 				if (d3.event.shiftKey && d.depth == 2) {
 					that.globalVent.trigger("render:tab",/*new LogFileView(*/{
 						params : _.extend({
-							host :  d.parent.name,
-							component : d.name,
+							host_name :  d.parent.name,
+							component_name : d.name,
 //							level : that.collection.queryParams.level,
 //							iMessage : that.collection.queryParams.iMessage,
 //							eMessage : that.collection.queryParams.eMessage,

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
index 2afb4e1..2d3b289 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
@@ -189,8 +189,8 @@ define(['require',
 					component = $el.data("type");
 					that.globalVent.trigger("render:tab",{
 						params:_.extend({},{
-							host :  host,
-							component : component
+							host_name :  host,
+							component_name : component
 						},that.searchParams,{treeParams:null}),
 						globalVent : that.globalVent
 					});

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js
index 35814ba..461e132 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js
@@ -95,10 +95,6 @@ define(['require',
 		setupSelect2Fields: function(col, idKey, textKey, selectTagId){
 			var that = this, data = [];
 			data = _.pluck(col.models, 'attributes');
-//			data = data.map(function(obj){
-//				return {id : obj[idKey], text : obj[textKey]}
-//			})
-			//data.unshift({'id': null, 'text': null});
 
 			this.ui[selectTagId].select2({
 				placeholder: 'Select',

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js
index 7f169c1..b8c11d8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js
@@ -248,8 +248,8 @@ define(['require',
 					component = $el.data("node");
 					that.globalVent.trigger("render:tab",{
 						params:_.extend({},{
-							host :  host,
-							component : component
+							host_name :  host,
+							component_name : component
 						},that.searchParams,{treeParams:null}),
 						globalVent : that.globalVent
 					});

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
index 66593c4..aa79ead 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
@@ -87,13 +87,6 @@ define(['require',
 		 */
 		initialize: function(options) {
 			_.extend(this, _.pick(options,'globalVent'));
-//			this.collection = new VLogList([], {
-//                state: {
-//                    firstPage: 0,
-//                    pageSize: 50
-//                }
-//            });
-//			this.collection.url = Globals.baseURL + "service/logs";
 			this.vent = new Backbone.Wreqr.EventAggregator();
 			this.dateUtil = Utils.dateUtil;
 			this.bindEvents();
@@ -137,8 +130,8 @@ define(['require',
 			if(params.host_name && params.component_name){
 				this.globalVent.trigger("render:tab",{
 					params:_.extend({},{
-						host :  params.host_name,
-						component : params.component_name
+						host_name :  params.host_name,
+						component_name : params.component_name
 					},params),
 					globalVent : this.globalVent
 				});
@@ -147,7 +140,7 @@ define(['require',
 		renderLogFileTab : function(view){
 			var that = this;
 			require(['views/tabs/LogFileView'], function(LogFileView){
-				var tabName = (view.params.host + view.params.component).replace(/\./g,"_");
+				var tabName = (view.params.host_name + view.params.component_name).replace(/\./g,"_");
 				if(_.isUndefined(that[tabName])){
 					var region = {};
 					region[tabName] = '#' + tabName;
@@ -160,7 +153,7 @@ define(['require',
 					var region = that.getRegion(tabName);
 					region.show(new LogFileView(view));
 					that.$(".nav.nav-tabs").append('<li data-id="'+tabName+'" role="presentation">'+
-							'<a data-id="'+tabName+'" data-host="'+view.params.host+'" data-component="'+view.params.component+'" href="#'+tabName+'" aria-controls="profile" role="tab" data-toggle="tab" title="'+view.params.host.split(".")[0]+' >> '+view.params.component+' ">'+view.params.host.split(".")[0]+'<b> >> </b>'+view.params.component+'</a>'+
+							'<a data-id="'+tabName+'" data-host="'+view.params.host_name+'" data-component="'+view.params.component_name+'" href="#'+tabName+'" aria-controls="profile" role="tab" data-toggle="tab" title="'+view.params.host_name.split(".")[0]+' >> '+view.params.component_name+' ">'+view.params.host_name.split(".")[0]+'<b> >> </b>'+view.params.component_name+'</a>'+
 	//						'<span class="air air-top-right">'+
 								'<button data-tab-id="'+tabName+'" class="btn-closeTab"><i class="fa fa-times-circle"></i></button>'+
 								'<div class="compareClick" title="Compare"><i class="fa fa-square-o"></i></div>');

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js
index 5570a31..689bacd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js
@@ -68,8 +68,8 @@ define(['require',
             onRender: function() {
             	var that = this;
             	this.fetchLogs({
-            		host : this.model.get("host"),
-            		component : this.model.get("type"),
+            		host_name : this.model.get("host"),
+            		component_name : this.model.get("type"),
             		numberRows : this.defaultRecords,
             		id : this.model.get("id")
             	},{

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
index 9bdf0fa..2c7f0aa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
@@ -211,10 +211,10 @@ define(['require',
             onEditHost : function(e){
             	var $el = $(e.currentTarget);
             	$el.hide();
-            	if($el.data("type") == "host"){
-            		this.showHostSelect2($el.data("component"));
+            	if($el.data("type") == "host_name"){
+            		this.showHostSelect2($el.data("component_name"));
                 }else{
-            		this.showExpiry($el.data("component"));
+            		this.showExpiry($el.data("component_name"));
                 }
             },
             hideHostSelect2 : function(forComponent){

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js
index f922087..7c50cbb 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js
@@ -27,7 +27,6 @@ define(['require',
     'use strict';
 
     return Backbone.Marionette.Layout.extend(
-        /** @lends ComparisonView */
         {
             _viewName: 'ComparisonView',
 
@@ -80,8 +79,8 @@ define(['require',
             onRender: function() {
                 if (this.params) {
                     this.fetchCollection(this.params);
-                    if (this.params.component && this.params.host) {
-                        this.ui.tabTitle.html(this.params.host + ' <i class="fa fa-angle-double-right"></i> ' + this.params.component)
+                    if (this.params.component_name && this.params.host_name) {
+                        this.ui.tabTitle.html(this.params.host_name + ' <i class="fa fa-angle-double-right"></i> ' + this.params.component_name)
                     }
                 } else {
                     this.fetchCollection({
@@ -91,9 +90,6 @@ define(['require',
                 this.renderVisualSearch();
                 this.renderDatePicker();
                 this.renderTable();
-                /* if (this.params.from && this.params.to) {
-                     this.setDateText(this.dateUtil.getMomentObject(this.params.from), this.dateUtil.getMomentObject(this.params.to));
-                 }*/
 
             },
             renderVisualSearch: function() {
@@ -151,7 +147,6 @@ define(['require',
                         },
                         gridOpts: {
                             header: CustomBackgrid,
-                            //row: IdRow,
                             emptyText: 'No records found!'
                         },
                         filterOpts: {},
@@ -179,10 +174,7 @@ define(['require',
                                     str += "<p>" + moment(rawValue).format("YYYY-MM-DD HH:mm:ss,SSS") + "</p>";
                                 if (model.get("type"))
                                     str += "<p style='float:left;width:90%'>" + (model.get("level") ? "<label class='label label-" + (""+model.get("level")).toUpperCase() + "'>" + (""+model.get("level")).toUpperCase() + "</label>" : "") +
-                                    /* "<strong>" + model.get("type") + "</strong>" +*/
                                     "</p><a  style='width:9%' title='Open logs in new tab' data-type='C' data-host='" + model.get("host") + "' data-node='" + model.get("type") + "' href='javascript:void(0)' class='pull-right hidden'><i class='fa fa-share'></i></a>";
-                                //                              if(model.get("level"))
-                                //                                  str += "<p style='float:left;'><label class='label label-"+model.get("level")+"'>"+model.get("level")+"</label></p>";
                                 return str;
                             }
                         })
@@ -193,7 +185,6 @@ define(['require',
                         editable: false,
                         sortType: 'toggle',
                         sortable: false,
-                        //width : "50",
                         orderable: true,
                         displayOrder: 4,
                         className: "logMessage",
@@ -243,7 +234,7 @@ define(['require',
                 this.ui.dateRange.data('daterangepicker').setStartDate(start);
                 this.ui.dateRange.data('daterangepicker').setEndDate(end);
 
-            },
+            }
 
         });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
index e4d327c..43ee5db 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
@@ -1,488 +1,429 @@
 /**
-* 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.
-*/
+ * 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(['require',
-    'backbone',
-    'utils/Globals',
-    'utils/Utils',
-    'moment',
-    'utils/ViewUtils',
-    'collections/VLogList',
-    'collections/VGroupList',
-    'hbs!tmpl/tabs/HierarchyTabLayoutView_tmpl'
-],function(require,Backbone,Globals,Utils,moment,ViewUtils,VLogList,VGroupList,HierarchyTabLayoutViewTmpl){
-    'use strict';
+  'backbone',
+  'utils/Globals',
+  'utils/Utils',
+  'moment',
+  'utils/ViewUtils',
+  'collections/VLogList',
+  'collections/VGroupList',
+  'hbs!tmpl/tabs/HierarchyTabLayoutView_tmpl'
+], function (require, Backbone, Globals, Utils, moment, ViewUtils, VLogList, VGroupList, HierarchyTabLayoutViewTmpl) {
+  'use strict';
 
-	return Backbone.Marionette.Layout.extend(
-	/** @lends LogLevelView */
-	{
-		_viewName : 'HierarchyTabLayoutView',
+  return Backbone.Marionette.Layout.extend(
+    /** @lends LogLevelView */
+    {
+      _viewName: 'HierarchyTabLayoutView',
 
-		template: HierarchyTabLayoutViewTmpl,
+      template: HierarchyTabLayoutViewTmpl,
 
-		/** Layout sub regions */
-		regions: {
-			RTreeView : "#r_TreeView",
-			RBubbleTable : "#r_BubbleTable",
-			RLogLevel	: "#r_LogLevel",
-			RHistogram  : "#r_Histogram",
-			RVisualSearch : "#r_vsSearch",
-			REventHistory : "#r_EventHistory",
-			RVisualSearchIncCol : "#r_vsSearchIncCol",
-			RVisualSearchExCol : "#r_vsSearchExCol",
-			RDatePicker:"#r_DatePicker",
-			RLogSnapShot:"#r_LogSnapShot",
-			RAdvanceSearch:"#r_AdvanceSearch"
-		},
+      /** Layout sub regions */
+      regions: {
+        RTreeView: "#r_TreeView",
+        RBubbleTable: "#r_BubbleTable",
+        RLogLevel: "#r_LogLevel",
+        RHistogram: "#r_Histogram",
+        RVisualSearch: "#r_vsSearch",
+        REventHistory: "#r_EventHistory",
+        RVisualSearchIncCol: "#r_vsSearchIncCol",
+        RVisualSearchExCol: "#r_vsSearchExCol",
+        RDatePicker: "#r_DatePicker",
+        RLogSnapShot: "#r_LogSnapShot",
+        RAdvanceSearch: "#r_AdvanceSearch"
+      },
 
-		/** ui selector cache */
-		ui: {
-			applySearch : '#applySearch',
-			searchBoxBtn : '[data-id="hierarchySearchBtn"]',
-			searchBox : '[data-id="hierarchySearch"]',
-			excludeComponents : "#excludeComponents",
-			includeComponents : "#includeComponents",
-			basicSearch:'[data-id="basicSearch"]',
-			advanceSearch:'[data-id="advanceSearch"]',
-			toggleTableAccessLog:'[data-id="toggleTableAccessLog"]'
-		},
+      /** ui selector cache */
+      ui: {
+        applySearch: '#applySearch',
+        searchBoxBtn: '[data-id="hierarchySearchBtn"]',
+        searchBox: '[data-id="hierarchySearch"]',
+        excludeComponents: "#excludeComponents",
+        includeComponents: "#includeComponents",
+        basicSearch: '[data-id="basicSearch"]',
+        advanceSearch: '[data-id="advanceSearch"]',
+        toggleTableAccessLog: '[data-id="toggleTableAccessLog"]'
+      },
 
-		/** ui events hash */
-		events: function() {
-			var events = {};
-			events["click "+this.ui.applySearch] = 'applySearchBtn';
-			events["click "+this.ui.searchBoxBtn] = 'onSearchLogClick';
-			events["click .server-info a"] = 'onLogLevelClick';
-			events["change "+ this.ui.toggleTableAccessLog] = 'onSearchSwitch';
+      /** ui events hash */
+      events: function () {
+        var events = {};
+        events["click " + this.ui.applySearch] = 'applySearchBtn';
+        events["click " + this.ui.searchBoxBtn] = 'onSearchLogClick';
+        events["click .server-info a"] = 'onLogLevelClick';
+        events["change " + this.ui.toggleTableAccessLog] = 'onSearchSwitch';
 
-			return events;
-		},
+        return events;
+      },
 
-		/**
-		 * intialize a new LogLevelView Layout
-		 * @constructs
-		 */
-		initialize: function(options) {
-			_.extend(this, _.pick(options,'globalVent'));
-//			this.logLevelList = new VLogLevelList();
-//			this.logLevelList.url = Globals.baseURL + "service/logs/levels/counts/namevalues";
-//			this.logLevelList.modelAttrName = "vNameValues";
-			this.columnCollection = new VLogList([],{
-				state: {
-                    firstPage: 0,
-                    pageSize: 99999
-                }
-			});
-			this.componentsList = new VGroupList([],{
-				state: {
-                    firstPage: 0,
-                    pageSize: 99999
-                }
-			});
-			this.componentsList.url = Globals.baseURL + "service/logs/components";
-			this.vent = new Backbone.Wreqr.EventAggregator();
-
-			this.defaultParams = ViewUtils.getDefaultParamsForHierarchy();
-			this.bindEvents();
-		},
-		applyParamsDate:function(date){
-			if (date) {
-				var dateString  = date.split(',');
-				 if(dateString.length){
-				 	var checkDate = Utils.dateUtil.getMomentUTC(dateString[0]);
-				 	if(checkDate.isValid()){
-				 		if(dateString[1]){
-				 			checkDate.millisecond(dateString[1])
-				 		}else{
-				 			checkDate.millisecond('000')
-				 		}
-				 		return  checkDate.toJSON();
-				 	}
-				 }
-			}
-		},
-		bindEvents : function(){
-//			this.listenTo(this.logLevelList,"reset",function(){
-//				this.renderLogLevelCounts();
-//			},this);
-//			this.listenTo(this.vent,"main:search",function(value){
-//				this.fetchLogLevelCounts(value);
-//			},this);
-//			this.listenTo(this.vent,"tree:search",function(value){
-//            	this.fetchLogLevelCounts(value);
-//            });
-//			this.listenTo(this.vent,"type:mustNot",function(value){
-//            	this.fetchLogLevelCounts(value);
-//            });
-			this.listenTo(this.componentsList, "reset", function(col, abc){
-				this.setupSelect2Fields(col,"type", 'type', 'excludeComponents', 'Exclude Components');
-				this.setupSelect2Fields(col,"type", 'type', 'includeComponents', 'Include Components');
-			}, this);
-			this.listenTo(this.vent,"reinitialize:filter:mustBe",function(value){
-            	this.reinitializeFilterMustBe(value);
-            },this);
-			this.listenTo(this.vent,"reinitialize:filter:mustNot",function(value){
-            	this.reinitializeFilterMustNot(value);
-            },this);
-			this.listenTo(this.vent,"add:include:exclude",function(value){
-				//this.$(".vs-box").find(".fa-chevron-down").click();
-			},this);
-			this.listenTo(this.vent,"tab:refresh",function(params){
-				this.reRenderComponents(params);
-			},this);
+      /**
+       * intialize a new LogLevelView Layout
+       * @constructs
+       */
+      initialize: function (options) {
+        _.extend(this, _.pick(options, 'globalVent'));
+        this.columnCollection = new VLogList([], {
+          state: {
+            firstPage: 0,
+            pageSize: 99999
+          }
+        });
+        this.componentsList = new VGroupList([], {
+          state: {
+            firstPage: 0,
+            pageSize: 99999
+          }
+        });
+        this.componentsList.url = Globals.baseURL + "service/logs/components";
+        this.vent = new Backbone.Wreqr.EventAggregator();
 
-			this.listenTo(this.globalVent,"reinitialize:serviceLogs",function(options){
-            	this.vent.trigger("reinitialize:filter:tree reinitialize:filter:include:exclude reinitialize:filter:bubbleTable"+
-            			" reinitialize:filter:mustNot reinitialize:filter:mustBe reinitialize:filter:level reinitialize:filter:logtime",options);
-            },this);
-		},
-		onRender : function(){
-			//this.renderTreeView();
-			this.fetchServiceLogsColumns();
-			this.renderLogLevel();
-			this.renderEventHistory();
-			this.renderHistogram();
-			this.renderDatePicker();
-			//this.renderVSSearch();
-			this.renderLogSnapShot();
-//			this.fetchLogLevelCounts({q:"*:*"});
-			this.componentsList.fetch({reset:true});
-		},
-		onShow:function(){
+        this.defaultParams = ViewUtils.getDefaultParamsForHierarchy();
+        this.bindEvents();
+      },
+      applyParamsDate: function (date) {
+        if (date) {
+          var dateString = date.split(',');
+          if (dateString.length) {
+            var checkDate = Utils.dateUtil.getMomentUTC(dateString[0]);
+            if (checkDate.isValid()) {
+              if (dateString[1]) {
+                checkDate.millisecond(dateString[1])
+              } else {
+                checkDate.millisecond('000')
+              }
+              return checkDate.toJSON();
+            }
+          }
+        }
+      },
+      bindEvents: function () {
+        this.listenTo(this.componentsList, "reset", function (col, abc) {
+          this.setupSelect2Fields(col, "type", 'type', 'excludeComponents', 'Exclude Components');
+          this.setupSelect2Fields(col, "type", 'type', 'includeComponents', 'Include Components');
+        }, this);
+        this.listenTo(this.vent, "reinitialize:filter:mustBe", function (value) {
+          this.reinitializeFilterMustBe(value);
+        }, this);
+        this.listenTo(this.vent, "reinitialize:filter:mustNot", function (value) {
+          this.reinitializeFilterMustNot(value);
+        }, this);
+        this.listenTo(this.vent, "add:include:exclude", function (value) {
+          //this.$(".vs-box").find(".fa-chevron-down").click();
+        }, this);
+        this.listenTo(this.vent, "tab:refresh", function (params) {
+          this.reRenderComponents(params);
+        }, this);
 
-			//this.REventHistory.currentView.genrateTimeline();
+        this.listenTo(this.globalVent, "reinitialize:serviceLogs", function (options) {
+          this.vent.trigger("reinitialize:filter:tree reinitialize:filter:include:exclude reinitialize:filter:bubbleTable" +
+            " reinitialize:filter:mustNot reinitialize:filter:mustBe reinitialize:filter:level reinitialize:filter:logtime", options);
+        }, this);
+      },
+      onRender: function () {
+        this.fetchServiceLogsColumns();
+        this.renderLogLevel();
+        this.renderEventHistory();
+        this.renderHistogram();
+        this.renderDatePicker();
+        this.renderLogSnapShot();
+        this.componentsList.fetch({reset: true});
+      },
+      onShow: function () {
 
-		},
-		fetchServiceLogsColumns : function(){
-			var that = this;
-			this.columnCollection.getServiceLogSchemaFields({},{
-//				beforeSend : function(){
-//					that.$("#loaderAudit").show();
-//				},
-				success : function(data){
-					Globals.serviceLogsColumns = data;
-				},
-				error : function(error,data,status){
-					var obj = JSON.parse(error.responseText);
-					if(obj)
-						Utils.notifyError({content:obj.msgDesc});
-				},
-				complete : function(){
-					that.renderServiceColumnsVSSearch();
-					that.renderBubbleTableView();
-				}
-			});
-		},
-//		fetchLogLevelCounts : function(params){
-//			$.extend(this.logLevelList.queryParams,params);
-//			this.logLevelList.fetch({reset:true});
-//		},
-		renderTreeView : function(){
-			var that = this;
-			require(['views/tabs/TreeView'],function(TreeView){
-    			that.RTreeView.show(new TreeView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams
-				}));
-            });
-		},
-		renderBubbleTableView : function(){
-			var that = this;
-			require(['views/dashboard/BubbleGraphTableLayoutView'],function(BubbleTableLayoutView){
-    			that.RBubbleTable.show(new BubbleTableLayoutView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-					columns:Globals.serviceLogsColumns,
-					quickHelp : true
-				}));
-            });
-		},
-		renderLogLevel : function(){
-			var that = this;
-			require(['views/dashboard/LogLevelBoxView'],function(LogLevelBoxView){
-	    		that.RLogLevel.show(new LogLevelBoxView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams
-				}));
-            });
-		},
-		renderHistogram : function(){
-			var that = this;
-			require(['views/graphs/GraphLayoutView'],function(GraphLayoutView){
-	    		that.RHistogram.show(new GraphLayoutView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-					showUnit : true,
-					futureDate : true
-				}));
-            });
-		},
-		renderDatePicker:function(){
-			var that = this;
-			require(['views/common/DatePickerLayout'],function(DatePickerLayout){
-	    		that.RDatePicker.show(new DatePickerLayout({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-					datePickerPosition:'left',
-					rangeLabel: true,
-					parentEl: that.$el.find('.topLevelFilter')
-				}));
-            });
-		},
-		renderLogSnapShot:function(){
-			var that = this;
-			require(['views/common/LogSnapShotLayout'],function(LogSnalShopLayout){
-	    		that.RLogSnapShot.show(new LogSnalShopLayout({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-				}));
-            });
-		},
-		renderAdvanceSearch:function(){
-			var that = this;
-			require(['views/common/AdvanceSearchLayout'],function(AdvanceSearchLayout){
-	    		that.RAdvanceSearch.show(new AdvanceSearchLayout({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-				}));
-            });
+      },
+      fetchServiceLogsColumns: function () {
+        var that = this;
+        this.columnCollection.getServiceLogSchemaFields({}, {
+          success: function (data) {
+            Globals.serviceLogsColumns = ViewUtils.getLogSchemaFields(data, Globals.defaultServiceLogMappings, Globals.defaultServiceLogExcludes);
+          },
+          error: function (error, data, status) {
+            var obj = JSON.parse(error.responseText);
+            if (obj)
+              Utils.notifyError({content: obj.msgDesc});
+          },
+          complete: function () {
+            that.renderServiceColumnsVSSearch();
+            that.renderBubbleTableView();
+          }
+        });
+      },
+      renderTreeView: function () {
+        var that = this;
+        require(['views/tabs/TreeView'], function (TreeView) {
+          that.RTreeView.show(new TreeView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
+      },
+      renderBubbleTableView: function () {
+        var that = this;
+        require(['views/dashboard/BubbleGraphTableLayoutView'], function (BubbleTableLayoutView) {
+          that.RBubbleTable.show(new BubbleTableLayoutView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams,
+            columns: Globals.serviceLogsColumns,
+            quickHelp: true
+          }));
+        });
+      },
+      renderLogLevel: function () {
+        var that = this;
+        require(['views/dashboard/LogLevelBoxView'], function (LogLevelBoxView) {
+          that.RLogLevel.show(new LogLevelBoxView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
+      },
+      renderHistogram: function () {
+        var that = this;
+        require(['views/graphs/GraphLayoutView'], function (GraphLayoutView) {
+          that.RHistogram.show(new GraphLayoutView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams,
+            showUnit: true,
+            futureDate: true
+          }));
+        });
+      },
+      renderDatePicker: function () {
+        var that = this;
+        require(['views/common/DatePickerLayout'], function (DatePickerLayout) {
+          that.RDatePicker.show(new DatePickerLayout({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams,
+            datePickerPosition: 'left',
+            rangeLabel: true,
+            parentEl: that.$el.find('.topLevelFilter')
+          }));
+        });
+      },
+      renderLogSnapShot: function () {
+        var that = this;
+        require(['views/common/LogSnapShotLayout'], function (LogSnalShopLayout) {
+          that.RLogSnapShot.show(new LogSnalShopLayout({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
+      },
+      renderAdvanceSearch: function () {
+        var that = this;
+        require(['views/common/AdvanceSearchLayout'], function (AdvanceSearchLayout) {
+          that.RAdvanceSearch.show(new AdvanceSearchLayout({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
 
 
-		},
-		renderVSSearch : function(){
-			var that = this;
-			require(['views/tabs/VisualSearchView'],function(VisualSearchView){
-	    		that.RVisualSearch.show(new VisualSearchView({
-					viewName : "includeExclude",
-					vent : that.vent,
-					globalVent:that.globalVent,
-					eventName : "search:include:exclude",
-					myFormatData : function(query,searchCollection){
-						var include = [],exclude=[];
-						searchCollection.each(function(m){
-								if(m.get("category") === "Exclude"){
-									(! _.isEmpty(m.get("value"))) ? exclude.push(m.get("value")):'';
-								}
-								else{
-									(! _.isEmpty(m.get("value"))) ? include.push(m.get("value")):'';
-								}
-							});
-							return {
-								iMessage : Utils.encodeIncludeExcludeStr(include,true),
-								eMessage : Utils.encodeIncludeExcludeStr(exclude,true),
-								query : query
-							};
-						}
+      },
+      renderVSSearch: function () {
+        var that = this;
+        require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
+          that.RVisualSearch.show(new VisualSearchView({
+            viewName: "includeExclude",
+            vent: that.vent,
+            globalVent: that.globalVent,
+            eventName: "search:include:exclude",
+            myFormatData: function (query, searchCollection) {
+              var include = [], exclude = [];
+              searchCollection.each(function (m) {
+                if (m.get("category") === "Exclude") {
+                  (!_.isEmpty(m.get("value"))) ? exclude.push(m.get("value")) : '';
+                }
+                else {
+                  (!_.isEmpty(m.get("value"))) ? include.push(m.get("value")) : '';
+                }
+              });
+              return {
+                iMessage: Utils.encodeIncludeExcludeStr(include, true),
+                eMessage: Utils.encodeIncludeExcludeStr(exclude, true),
+                query: query
+              };
+            }
 
-				}));
-            });
-		},
-		renderServiceColumnsVSSearch : function(){
-			//Columns include exclude
-			var that = this;
-			require(['views/tabs/VisualSearchView'],function(VisualSearchView){
-				var data = _.values(Globals.serviceLogsColumns);
-				var columns = _.without( data, _.findWhere( data, "logtime"));
-				that.RVisualSearchIncCol.show(new VisualSearchView({
-					viewName : "includeServiceColumns",
-					placeholder : "Include Search",
-					vent : that.vent,
-					globalVent:that.globalVent,
-					customOptions : columns,
-					eventName : Globals.eventName.serviceLogsIncludeColumns,
-					myFormatData : function(query,searchCollection){
-						var obj=[];
-						searchCollection.each(function(m){
-							var data = {};
-							data[m.get("category")] = m.get("value");
-							obj.push(data);
-						});
-						return {
-							includeQuery : JSON.stringify(obj),
-							query : query
-						}
-					}
-				}));
-				that.RVisualSearchExCol.show(new VisualSearchView({
-					viewName : "excludeServiceColumns",
-					placeholder : "Exclude Search",
-					vent : that.vent,
-					globalVent:that.globalVent,
-					customOptions :  columns,
-					eventName : Globals.eventName.serviceLogsExcludeColumns,
-					myFormatData : function(query,searchCollection){
-						var obj=[];
-						searchCollection.each(function(m){
-							var data = {};
-							data[m.get("category")] = m.get("value");
-							obj.push(data);
-						});
-						return {
-							excludeQuery : JSON.stringify(obj),
-							query : query
-						}
-					}
-				}));
-			});
-		},
-		renderEventHistory:function(){
-			var that = this;
-			require(['views/common/EventHistoryLayout'],function(EventHistoryLayoutView){
-				that.REventHistory.show(new EventHistoryLayoutView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams
-				}));
-			});
-		},
-		fetchCollection : function(params){
-			$.extend(this.collection.queryParams, params);
-			this.collection.fetch({reset:true});
-		},
-		onSearchLogClick : function(){
-			var value = this.ui.searchBox.val();
-			if(_.isEmpty(value)){
-				this.ui.searchBox.val("*:*");
-				value = "*:*";
-			}
-			this.vent.trigger("main:search",{q:value});
-		},
-//		renderLogLevelCounts : function(){
-//			var that = this;
-//			this.logLevelList.each(function(model){
-//				that.$("[data-total='"+model.get("name")+"']").text(model.get("value"));
-//			});
-//		},
-//		onLogLevelClick : function(e){
-//			var $el = $(e.currentTarget);
-//			if($el.hasClass("active")){
-//				$el.removeClass("active");
-//			}else{
-//				$el.addClass("active");
-//			}
-//			var params = [];
-//			_.each(this.$(".server-info a.active"),function(e){
-//				params.push($(e).find("strong").data("total"));
-//			});
-//			this.vent.trigger("level:filter",{level:params.toString()});
-//		},
-		setupSelect2Fields : function(col, idKey, textKey, selectTagId, placeHolder){
-			var that = this, data = [];
-			data = _.pluck(col.models, 'attributes');
-//			data = data.map(function(obj){
-//				return {id : obj[idKey], text : obj[textKey]}
-//			})
-			//data.unshift({'id': null, 'text': null});
-			for(var i=0;i < data.length;i++){
-				data[i].id = data[i].type;
-			}
-			this.ui[selectTagId].select2({
-				dropdownParent: that.$el,
-				placeholder: (placeHolder) ? placeHolder :'Select',
-				tags:true,
-				allowClear : true,
-				width: '100%',
-				data: { results: data, text: textKey},
-				formatSelection: function(item){
-					return item[textKey];
-				},
-    			formatResult: function(item){
-    				return item[textKey];
-				}
-			}).off("change").on("change",function(e){
-				var data = that.ui[selectTagId].select2("data").map(function(d){return d.type});
-				if(selectTagId === "excludeComponents"){
-					that.vent.trigger("tree:strike:component",data);
-					that.vent.trigger("type:mustNot",{mustNot:data.toString()});
-				}
-				if(selectTagId === "includeComponents")
-					that.vent.trigger("type:mustBe",{mustBe:data.toString()});
-			});
-		},
-		reinitializeFilterMustBe : function(values){
-			if(values.mustBe)
-				this.ui.includeComponents.select2('val',values.mustBe.split(","));
-			else
-				this.ui.includeComponents.select2('val',[]);
-		},
-		reinitializeFilterMustNot : function(values){
-			if(values.mustNot)
-				this.ui.excludeComponents.select2('val',values.mustNot.split(","));
-			else
-				this.ui.excludeComponents.select2('val',[]);
+          }));
+        });
+      },
+      renderServiceColumnsVSSearch: function () {
+        var that = this;
+        require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
+          var data = _.values(Globals.serviceLogsColumns);
+          var columns = _.without(data, _.findWhere(data, "logtime"));
+          that.RVisualSearchIncCol.show(new VisualSearchView({
+            viewName: "includeServiceColumns",
+            placeholder: "Include Search",
+            vent: that.vent,
+            globalVent: that.globalVent,
+            customOptions: columns,
+            eventName: Globals.eventName.serviceLogsIncludeColumns,
+            myFormatData: function (query, searchCollection) {
+              var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
+              return {
+                includeQuery: JSON.stringify(obj),
+                query: query
+              }
+            }
+          }));
+          that.RVisualSearchExCol.show(new VisualSearchView({
+            viewName: "excludeServiceColumns",
+            placeholder: "Exclude Search",
+            vent: that.vent,
+            globalVent: that.globalVent,
+            customOptions: columns,
+            eventName: Globals.eventName.serviceLogsExcludeColumns,
+            myFormatData: function (query, searchCollection) {
+              var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
+              return {
+                excludeQuery: JSON.stringify(obj),
+                query: query
+              }
+            }
+          }));
+        });
+      },
+      renderEventHistory: function () {
+        var that = this;
+        require(['views/common/EventHistoryLayout'], function (EventHistoryLayoutView) {
+          that.REventHistory.show(new EventHistoryLayoutView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
+      },
+      fetchCollection: function (params) {
+        $.extend(this.collection.queryParams, params);
+        this.collection.fetch({reset: true});
+      },
+      onSearchLogClick: function () {
+        var value = this.ui.searchBox.val();
+        if (_.isEmpty(value)) {
+          this.ui.searchBox.val("*:*");
+          value = "*:*";
+        }
+        this.vent.trigger("main:search", {q: value});
+      },
+      setupSelect2Fields: function (col, idKey, textKey, selectTagId, placeHolder) {
+        var that = this, data = [];
+        data = _.pluck(col.models, 'attributes');
+        for (var i = 0; i < data.length; i++) {
+          data[i].id = data[i].type;
+        }
+        this.ui[selectTagId].select2({
+          dropdownParent: that.$el,
+          placeholder: (placeHolder) ? placeHolder : 'Select',
+          tags: true,
+          allowClear: true,
+          width: '100%',
+          data: {results: data, text: textKey},
+          formatSelection: function (item) {
+            return item[textKey];
+          },
+          formatResult: function (item) {
+            return item[textKey];
+          }
+        }).off("change").on("change", function (e) {
+          var data = that.ui[selectTagId].select2("data").map(function (d) {
+            return d.type
+          });
+          if (selectTagId === "excludeComponents") {
+            that.vent.trigger("tree:strike:component", data);
+            that.vent.trigger("type:mustNot", {mustNot: data.toString()});
+          }
+          if (selectTagId === "includeComponents")
+            that.vent.trigger("type:mustBe", {mustBe: data.toString()});
+        });
+      },
+      reinitializeFilterMustBe: function (values) {
+        if (values.mustBe)
+          this.ui.includeComponents.select2('val', values.mustBe.split(","));
+        else
+          this.ui.includeComponents.select2('val', []);
+      },
+      reinitializeFilterMustNot: function (values) {
+        if (values.mustNot)
+          this.ui.excludeComponents.select2('val', values.mustNot.split(","));
+        else
+          this.ui.excludeComponents.select2('val', []);
 
-		},
-		reRenderComponents : function(params){
-			var iComponents = this.ui.includeComponents.val(),eComponents = this.ui.excludeComponents.val(),that=this;
-			this.componentsList.fetch({
-				reset : true,
-				complete : function(){
-					that.ui.includeComponents.select2('val',iComponents.split(","));
-					that.ui.excludeComponents.select2('val',eComponents.split(","));
-				}
-			});
-		},
-		onSearchSwitch:function(e){
-			var obj = {}
-			if(e.target.checked){
-				this.ui.advanceSearch.show();
-				this.ui.applySearch.show();
-				this.ui.basicSearch.hide();
-				obj.advanceSearch = this.RAdvanceSearch.currentView.ui.searchArea.val();
-				obj.includeQuery = null;
-				obj.excludeQuery = null;
-			} else{
-				this.ui.advanceSearch.hide();
-				this.ui.applySearch.hide();
-				this.ui.basicSearch.show();
-				obj = this.getIncludeExcludeColValues();
-				obj.advanceSearch = null;
-			}
+      },
+      reRenderComponents: function (params) {
+        var iComponents = this.ui.includeComponents.val(), eComponents = this.ui.excludeComponents.val(), that = this;
+        this.componentsList.fetch({
+          reset: true,
+          complete: function () {
+            that.ui.includeComponents.select2('val', iComponents.split(","));
+            that.ui.excludeComponents.select2('val', eComponents.split(","));
+          }
+        });
+      },
+      onSearchSwitch: function (e) {
+        var obj = {};
+        if (e.target.checked) {
+          this.ui.advanceSearch.show();
+          this.ui.applySearch.show();
+          this.ui.basicSearch.hide();
+          obj.advanceSearch = this.RAdvanceSearch.currentView.ui.searchArea.val();
+          obj.includeQuery = null;
+          obj.excludeQuery = null;
+        } else {
+          this.ui.advanceSearch.hide();
+          this.ui.applySearch.hide();
+          this.ui.basicSearch.show();
+          obj = this.getIncludeExcludeColValues();
+          obj.advanceSearch = null;
+        }
 
-			this.vent.trigger('main:search',obj);
+        this.vent.trigger('main:search', obj);
 
-		},
-		applySearchBtn : function(){
-			var obj = {}
-			obj.advanceSearch = this.RAdvanceSearch.currentView.ui.searchArea.val();
+      },
+      applySearchBtn: function () {
+        var obj = {};
+        obj.advanceSearch = this.RAdvanceSearch.currentView.ui.searchArea.val();
 
-				this.vent.trigger('main:search',obj);
+        this.vent.trigger('main:search', obj);
 
-		},
-		getIncludeExcludeColValues : function(){
-			return _.extend(this.RVisualSearchIncCol.currentView.formatData(this.RVisualSearchIncCol.currentView.visualSearch.searchBox.value(),this.RVisualSearchIncCol.currentView.visualSearch.searchQuery),
-			           this.RVisualSearchExCol.currentView.formatData(this.RVisualSearchExCol.currentView.visualSearch.searchBox.value(),this.RVisualSearchExCol.currentView.visualSearch.searchQuery));
-		},
-		toggleSearchBackToBasicSearch : function(options){
-			if(! this.ui.advanceSearch.is(":hidden")){
-				this.ui.advanceSearch.hide();
-				this.ui.basicSearch.show();
-				this.ui.toggleTableAccessLog[0].checked = false;
-				_.extend(options,this.getIncludeExcludeColValues(),{advanceSearch:null});
-			}
-		}
-	});
+      },
+      getIncludeExcludeColValues: function () {
+        return _.extend(this.RVisualSearchIncCol.currentView.formatData(this.RVisualSearchIncCol.currentView.visualSearch.searchBox.value(), this.RVisualSearchIncCol.currentView.visualSearch.searchQuery),
+          this.RVisualSearchExCol.currentView.formatData(this.RVisualSearchExCol.currentView.visualSearch.searchBox.value(), this.RVisualSearchExCol.currentView.visualSearch.searchQuery));
+      },
+      toggleSearchBackToBasicSearch: function (options) {
+        if (!this.ui.advanceSearch.is(":hidden")) {
+          this.ui.advanceSearch.hide();
+          this.ui.basicSearch.show();
+          this.ui.toggleTableAccessLog[0].checked = false;
+          _.extend(options, this.getIncludeExcludeColValues(), {advanceSearch: null});
+        }
+      }
+    });
 
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
index 0b32237..3740716 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
@@ -478,14 +478,6 @@ define(['require',
                 var timeZone = moment().zoneAbbr(),
                     that = this,
                     cols = {};
-                _.each(Globals.serviceLogsColumns, function(value, col) {
-                    cols[col] = {
-                        label: value,
-                        cell: "String",
-                        sortType: 'toggle',
-                        editable: false,
-                    }
-                });
                 this.cols = {
                     logtime: {
                         label: "Log Time " + (!_.isEmpty(timeZone) ? "(" + timeZone + ")" : ""),
@@ -509,30 +501,6 @@ define(['require',
                             }
                         })
                     },
-                    /*type: {
-                    	//label: "Type",
-                    	cell: "String",
-                    	editable: false,
-                    	sortType: 'toggle',
-                    	orderable : true,
-                    	displayOrder :2
-                    },*/
-                    /*level : {
-                    	label: "Level",
-                    	cell: "html",
-                    	editable: false,
-                    	sortType: 'toggle',
-                    	sortable : true,
-                    	orderable : true,
-                    	width : "5",
-                    	displayOrder :3,
-                    	formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-                    		fromRaw: function(rawValue, model){
-                    			if(rawValue)
-                    				return "<span class='"+rawValue+"'>"+rawValue+"</span>";
-                    		}
-                    	})
-                    },*/
                     log_message: {
                         label: "Message",
                         cell: "html",
@@ -569,31 +537,24 @@ define(['require',
                         displayOrder: 6,
                         width: 6
                     }
-                    /*host : {
-                    	label: "Host",
-                    	cell: "String",
-                    	editable: false,
-                    	sortType: 'toggle',
-                    	orderable : true,
-                    	displayOrder :5
-                    },
-                    logger_name : {
-                    	cell: "String",
-                    	editable: false,
-                    	sortType: 'toggle',
-                    	orderable : true,
-                    	displayOrder :6
-                    }*/
 
                 };
-                _.each(cols, function(c, k) {
-                    if (that.cols[k] == undefined) {
-                        that.cols[k] = c;
-                    } else {
-                        if (that.cols[k] && that.cols[k].label) {
-                            that.cols[k].label = c.label;
-                        }
+                _.each(this.columns, function(value){
+                  var name = Globals.invertedServiceLogMappings[value];
+                  if (columns[name] === undefined) {
+                    var columnObj = {
+                      name: Globals.invertedServiceLogMappings[value],
+                      label:value,
+                      cell: "String",
+                      sortType: 'toggle',
+                      editable: false
+                    };
+                    columns[name] = columnObj;
+                  } else {
+                    if (columns[name] && columns[name].label) {
+                      columns[name].label = value;
                     }
+                  }
                 });
                 return this.logFileCollection.constructor.getTableCols(this.cols, this.logFileCollection);
             },
@@ -666,8 +627,8 @@ define(['require',
                 }
             },
             setHostName: function() {
-                this.$("[data-id='hostName']").text(this.params.host);
-                this.$("[data-id='componentName']").text(this.params.component);
+                this.$("[data-id='hostName']").text(this.params.host_name);
+                this.$("[data-id='componentName']").text(this.params.component_name);
             },
             getFindValue: function() {
                 return this.ui.find.val();

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js
index bcd2c80..c395495 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js
@@ -79,8 +79,6 @@ define(['require',
 		 */
 		initialize: function(options) {
 			_.extend(this, _.pick(options,'vent','globalVent','params'));
-//			this.collection = new VLogLevel();
-//			this.collection.url = Globals.baseURL+"service/logs/components/count";
 			this.treeModel = new VCommonModel();
 			this.searchParams = (this.params)? this.params :{};
 			this.bindEvents();
@@ -311,8 +309,8 @@ define(['require',
 				component = $el.data("node");
 				that.globalVent.trigger("render:tab",/*new LogFileView(*/{
 					params:_.extend({},{
-						host :  host,
-						component : component
+						host_name :  host,
+						component_name : component
 					},that.searchParams,{treeParams:null}),
 					globalVent : that.globalVent
 				}/*)*/);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js
index 24e0211..8bfb85f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js
@@ -1,255 +1,202 @@
 /**
-* 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.
-*/
+ * 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(['require',
-    'backbone',
-    'utils/Globals',
-    'utils/Utils',
-    'collections/VLogLevelList',
-    'hbs!tmpl/tabs/VisualSearchView_tmpl',
-    'select2'
-],function(require,Backbone,Globals,Utils,VLogLevel,LogLevelTmpl){
-    'use strict';
+  'backbone',
+  'utils/Globals',
+  'utils/Utils',
+  'collections/VLogLevelList',
+  'hbs!tmpl/tabs/VisualSearchView_tmpl',
+  'select2'
+], function (require, Backbone, Globals, Utils, VLogLevel, LogLevelTmpl) {
+  'use strict';
 
-	return Backbone.Marionette.Layout.extend(
-	/** @lends VisualSearchView */
-	{
-		_viewName : 'VisualSearchView',
+  return Backbone.Marionette.Layout.extend(
+    {
+      _viewName: 'VisualSearchView',
 
-		template: LogLevelTmpl,
+      template: LogLevelTmpl,
 
-		/** Layout sub regions */
-		regions: {
-		},
+      /** Layout sub regions */
+      regions: {},
 
-		/** ui selector cache */
-		ui: {
-			vsContainer : "#vs_container",
-		},
+      /** ui selector cache */
+      ui: {
+        vsContainer: "#vs_container",
+      },
 
-		/** ui events hash */
-		events: function() {
-			var events = {};
-			events['click #searchLog'] = 'onSearchLogClick';
-			return events;
-		},
+      /** ui events hash */
+      events: function () {
+        var events = {};
+        events['click #searchLog'] = 'onSearchLogClick';
+        return events;
+      },
 
-		/**
-		 * intialize a new VisualSearchView Layout
-		 * @constructs
-		 */
-		initialize: function(options) {
-			_.extend(this, _.pick(options,'vent','globalVent','params','customOptions','eventName','myFormatData','placeholder', 'viewName'));
-			this.bindEvents();
-		},
-		onRender : function(){
-			var query="";
-//			if(this.customOptions){
-//				
-//			}
-//			if(this.params && this.params.query){
-//				query = this.params.query;
-//			}
-			this.initializeSearch(this.formQueryDataFromParams(this.params));
-		},
-		bindEvents : function(){
-			this.listenTo(this.vent,"reinitialize:filter:include:exclude",function(value){
-            	this.reinitializeFilter(value);
-            });
-			this.listenTo(this.vent,"add:include:exclude",function(value){
-            	this.addIncludeExclude(value);
-            });
-			this.listenTo(this.vent,"toggle:facet",function(obj){
-            	this.toggleFacet(obj);
+      initialize: function (options) {
+        _.extend(this, _.pick(options, 'vent', 'globalVent', 'params', 'customOptions', 'eventName', 'myFormatData', 'placeholder', 'viewName'));
+        this.bindEvents();
+      },
+      onRender: function () {
+        this.initializeSearch(this.formQueryDataFromParams(this.params));
+      },
+      bindEvents: function () {
+        this.listenTo(this.vent, "reinitialize:filter:include:exclude", function (value) {
+          this.reinitializeFilter(value);
+        });
+        this.listenTo(this.vent, "add:include:exclude", function (value) {
+          this.addIncludeExclude(value);
+        });
+        this.listenTo(this.vent, "toggle:facet", function (obj) {
+          this.toggleFacet(obj);
+        });
+      },
+      initializeSearch: function (query) {
+        var opts = (this.customOptions) ? this.customOptions : ["Include", "Exclude"], that = this;
+        this.visualSearch = VS.init({
+          placeholder: (!this.placeholder) ? "Search String" : this.placeholder,
+          container: this.ui.vsContainer,
+          query: query,
+          remainder: false,
+          callbacks: {
+            search: function (query, searchCollection) {
+              var eventName = (!that.eventName) ? "search:include:exclude" : that.eventName;
+              that.vent.trigger(eventName, that.formatData(query, searchCollection));
+            },
+            facetMatches: function (callback) {
+              callback(opts, {preserveOrder: true});
+            },
+            valueMatches: function (facet, searchTerm, callback) {
+            }
+          }
+        });
+      },
+      formatData: function (query, searchCollection) {
+        if (_.isFunction(this.myFormatData)) {
+          return this.myFormatData(query, searchCollection);
+        }
+        var include = [], exclude = [], obj = [], that = this;
+        searchCollection.each(function (m) {
+          if (!that.customOptions) {
+            if (m.get("category") === "Exclude") {
+              (!_.isEmpty(m.get("value"))) ? exclude.push(m.get("value")) : '';
+            }
+            else {
+              (!_.isEmpty(m.get("value"))) ? include.push(m.get("value")) : '';
+            }
+          } else {
+            var data = {};
+            data[m.get("category")] = m.get("value");
+            obj.push(data);
+          }
+
+        });
+        if (!this.customOptions) {
+          return {
+            iMessage: Utils.encodeIncludeExcludeStr(include, true),
+            eMessage: Utils.encodeIncludeExcludeStr(exclude, true),
+            query: query
+          };
+        } else {
+          return {
+            columnQuery: JSON.stringify(obj),
+            query: query
+          }
+        }
+
+
+      },
+      reinitializeFilter: function (values) {
+        var query = "";
+        if (this.viewName) {
+          query = this.formQueryDataFromParams(values);
+        }
+        if (!_.isUndefined(query)) {
+          this.initializeSearch(query);
+        }
+      },
+      addIncludeExclude: function (value) {
+        if (this.customOptions)
+          return;
+        if (value) {
+          var e = $.Event("keydown");
+          e.keyCode = 13;
+          this.visualSearch.searchBox.addFacet((value.type == "I") ? "Include" : "Exclude", value.value);
+          this.visualSearch.options.callbacks.search(this.visualSearch.searchBox.value(), this.visualSearch.searchQuery);
+        }
+      },
+      toggleFacet: function (obj) {
+        if (_.isObject(obj)) {
+          if (obj.viewName == this.viewName) {
+            var view = _.find(this.visualSearch.searchBox.facetViews, function (v) {
+              return v.model.get("category") === obj.key && v.model.get("value") === obj.value;
             });
-		},
-		initializeSearch : function(query) {
-			var that = this;
-			var opts = (this.customOptions) ? this.customOptions : [ "Include", "Exclude" ],that=this;
-			this.visualSearch = VS.init({
-				placeholder : (!this.placeholder) ? "Search String" : this.placeholder,
-				container : this.ui.vsContainer,
-				query : query,
-				remainder : false,
-				callbacks : {
-					search : function(query, searchCollection) {
-						var eventName = (! that.eventName) ? "search:include:exclude" : that.eventName;  
-//						if(! that.customOptions)
-//							that.vent.trigger("search:include:exclude",that.formatData(query,searchCollection));
-//						else
-//							that.vent.trigger("search:audit:query",that.formatData(query,searchCollection));
-						that.vent.trigger(eventName,that.formatData(query,searchCollection));
-					},
-					facetMatches : function(callback) {
-//						var searchOptTemp = $.extend(true, [], opts);
-//						that.visualSearch.searchQuery.each(function(m) {
-//							if ($.inArray(m.get('category'), searchOptTemp) >= 0) {
-//								searchOptTemp.splice($.inArray(m.get('category'),
-//										searchOptTemp), 1);
-//							}
-//						});
-//						callback(searchOptTemp,{preserveOrder: true});
-						callback(opts,{preserveOrder: true});
-					},
-					valueMatches : function(facet, searchTerm, callback) {
-//						that.$('vsLoader').show();
-//						$.ajax({
-//							url: '/service/dashboard/getSuggestoins?fieldName='+facet+'&valueToSuggest='+searchTerm+'',
-//							type: 'GET',
-//							success: function(result){
-//								console.log(result);
-//								callback(result,{preserveOrder: false});
-//							},
-//							error:function(){},
-//							complete:function(){
-//								//that.$('vsLoader').hide();
-//							}
-//						});
-					}
-				}
-			});
-		},
-		formatData : function(query,searchCollection){
-			if(_.isFunction(this.myFormatData)){
-				return this.myFormatData(query,searchCollection);
-			}
-			var include = [],exclude=[],obj=[],that=this;
-			searchCollection.each(function(m){
-				if(! that.customOptions){
-					if(m.get("category") === "Exclude"){
-						(! _.isEmpty(m.get("value"))) ? exclude.push(m.get("value")):'';
-					}
-					else{
-						(! _.isEmpty(m.get("value"))) ? include.push(m.get("value")):'';
-					}
-				}else{
-					var data = {};
-					data[m.get("category")] = m.get("value");
-					obj.push(data);
-				}
-				
-			});
-			if(! this.customOptions){
-				return {
-					iMessage : Utils.encodeIncludeExcludeStr(include,true),
-					eMessage : Utils.encodeIncludeExcludeStr(exclude,true),
-					query : query
-				};
-			}else{
-				return {
-					columnQuery : JSON.stringify(obj),
-					query : query
-				}
-			}
-				
-					
-		},
-		reinitializeFilter : function(values){
-			var query = "";
-			if(this.viewName){
-				query = this.formQueryDataFromParams(values);
-			}
-			if(! _.isUndefined(query)){
-				this.initializeSearch(query);
-				//this.vent.trigger("search:include:exclude",values);
-			}
-		},
-		addIncludeExclude : function(value){
-			//If this view is running for options other then Include/Exclude than return
-			if(this.customOptions)
-				return
-			if(value){
-				var e = $.Event("keydown");
-				e.keyCode = 13;
-				this.visualSearch.searchBox.addFacet((value.type == "I") ? "Include" : "Exclude",value.value);
-				this.visualSearch.options.callbacks.search(this.visualSearch.searchBox.value(), this.visualSearch.searchQuery);
-//				this.visualSearch.searchBox.searchEvent(e);
-//				this.visualSearch.searchBox.removeFocus();
-			}
-		},
-		toggleFacet : function(obj){
-			if(_.isObject(obj)){
-				if(obj.viewName == this.viewName){
-//					var e = $.Event("click");
-//					e.keyCode = 13;
-//					var model = _.find(this.visualSearch.searchQuery.models,function(m){
-//							return m.get("category") === obj.key && m.get("value") === obj.value;
-//					});
-					//obj.value = obj.value.replace(/:/, '\\\\:').replace(/\"/g, '\\"').replace(/\n/g, "\\n");
-					var view = _.find(this.visualSearch.searchBox.facetViews,function(v){
-						return v.model.get("category") === obj.key && v.model.get("value") === obj.value;
-					});
-					if(view){
-						var e = $.Event("click");
-						e.keyCode = 13;
-						view.model.set("value",undefined);
-						view.remove(e);
-					}else
-						this.visualSearch.searchBox.addFacet(obj.key,obj.value);
-//					var keypress = $.Event("keydown");
-//					keypress.keyCode = 13;
-//					this.visualSearch.searchBox.searchEvent(keypress);
-//					this.visualSearch.searchBox.removeFocus();
-					this.visualSearch.options.callbacks.search(this.visualSearch.searchBox.value(), this.visualSearch.searchQuery);
-				}
-			}
-		},
-		formQueryDataFromParams : function(values){
-			if(!values)
-				return
-			var query = "";
-			try{
-				var arr;
-				if(this.viewName == "includeServiceColumns" && values.includeQuery){
-					arr = JSON.parse(values.includeQuery);
-				}else if(this.viewName == "excludeServiceColumns" && values.excludeQuery){
-					arr = JSON.parse(values.excludeQuery);
-				}
-				if(_.isArray(arr)){
-					for(var i=0; i<arr.length; i++){
-						var key = _.keys(arr[i])[0]; 
-						query += "'"+key+ "':'" +arr[i][key] +"' ";
-					}
-				}
-				if(this.viewName === "includeExclude" && (values.iMessage || values.eMessage)){
-					var valuesArr,key;
-					if(values.iMessage){
-						valuesArr = values.iMessage.split(Globals.splitToken);
-						key = "Include: ";
-						for(var i=0; i<valuesArr.length; i++){
-							query += key+ '"'+valuesArr[i]+'" ';
-						}
-					}
-					if(values.eMessage){
-						valuesArr = values.eMessage.split(Globals.splitToken);
-						key = "Exclude: ";
-						for(var i=0; i<valuesArr.length; i++){
-							query += key+ '"'+valuesArr[i]+'" ';
-						}
-					}
-					
-					
-				}
-			}catch(e){
-				console.log("Error",e);
-			}
-			return query;
-		}
-	});
-	
-	
+            if (view) {
+              var e = $.Event("click");
+              e.keyCode = 13;
+              view.model.set("value", undefined);
+              view.remove(e);
+            } else
+              this.visualSearch.searchBox.addFacet(obj.key, obj.value);
+            this.visualSearch.options.callbacks.search(this.visualSearch.searchBox.value(), this.visualSearch.searchQuery);
+          }
+        }
+      },
+      formQueryDataFromParams: function (values) {
+        if (!values)
+          return;
+        var query = "";
+        try {
+          var arr;
+          if (this.viewName == "includeServiceColumns" && values.includeQuery) {
+            arr = JSON.parse(values.includeQuery);
+          } else if (this.viewName == "excludeServiceColumns" && values.excludeQuery) {
+            arr = JSON.parse(values.excludeQuery);
+          }
+          if (_.isArray(arr)) {
+            for (var i = 0; i < arr.length; i++) {
+              var key = _.keys(arr[i])[0];
+              query += "'" + key + "':'" + arr[i][key] + "' ";
+            }
+          }
+          if (this.viewName === "includeExclude" && (values.iMessage || values.eMessage)) {
+            var valuesArr, key;
+            if (values.iMessage) {
+              valuesArr = values.iMessage.split(Globals.splitToken);
+              key = "Include: ";
+              for (var i = 0; i < valuesArr.length; i++) {
+                query += key + '"' + valuesArr[i] + '" ';
+              }
+            }
+            if (values.eMessage) {
+              valuesArr = values.eMessage.split(Globals.splitToken);
+              key = "Exclude: ";
+              for (var i = 0; i < valuesArr.length; i++) {
+                query += key + '"' + valuesArr[i] + '" ';
+              }
+            }
+          }
+        } catch (e) {
+          console.log("Error", e);
+        }
+        return query;
+      }
+
+
+    });
+
+
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9814bfcf/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
new file mode 100644
index 0000000..8620c11
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
@@ -0,0 +1,71 @@
+{
+  "serviceLogMappings": {
+    "log_message": "Message",
+    "bundle_id": "Bundle Id",
+    "case_id": "Case Id",
+    "cluster": "Cluster",
+    "event_count": "Event Count",
+    "file": "File",
+    "host": "Host",
+    "id": "Id",
+    "ip": "Ip",
+    "level": "Level",
+    "line_number": "Line Number",
+    "logtype": "Log Type",
+    "logfile_line_number": "Logfile Line Number",
+    "logger_name": "Logger Name",
+    "logtime": "logtime",
+    "method": "Method",
+    "path": "Path",
+    "rowtype": "Row Type",
+    "thread_name": "Thread",
+    "type": "Type"
+  },
+  "serviceLogExcludes": ["tags", "text", "message", "seq_num"],
+  "auditLogMappings": {
+    "enforcer": "Access Enforcer",
+    "access": "Access Type",
+    "action": "Action",
+    "agent": "Agent",
+    "agentHost": "Agent Host",
+    "authType": "Auth Type",
+    "bundle_id": "Bundle Id",
+    "case_id": "Case Id",
+    "cliIP": "Client Ip",
+    "cliType": "Client Type",
+    "cluster": "Cluster",
+    "dst": "DST",
+    "event_count": "Event Count",
+    "evtTime": "Event Time",
+    "file": "File",
+    "host": "Host",
+    "id": "Id",
+    "ip": "IP",
+    "level": "Level",
+    "log_message": "Log Message",
+    "logType": "Log Type",
+    "logfile_line_number": "Logfile Line Number",
+    "logger_name": "Logger Name",
+    "logtime": "logtime",
+    "path": "Path",
+    "perm": "Perm",
+    "policy": "Policy",
+    "proxyUsers": "Proxy Users",
+    "reason": "Reason",
+    "repo": "Repo",
+    "repoType": "Repo Type",
+    "req_caller_id": "Req Caller Id",
+    "reqContext": "Req Context",
+    "reqData": "Req Data",
+    "req_self_id": "Req Self Id",
+    "resType": "Res Type",
+    "resource": "Resource",
+    "result": "Result",
+    "sess": "Sess",
+    "text": "Text",
+    "type": "Type",
+    "ugi": "UGI",
+    "reqUser": "User"
+  },
+  "auditLogExcludes": ["tags","tags_str", "seq_num"]
+}
\ No newline at end of file