AMBARI-17706. Event history implementation without using 3rd party libraries. 
(Dharmesh Makwana via oleewere)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a53b2c8d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a53b2c8d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a53b2c8d

Branch: refs/heads/trunk
Commit: a53b2c8d9caac0dbb2154c1e9da3c32587bae584
Parents: 0458940
Author: oleewere <[email protected]>
Authored: Fri Jul 15 14:20:07 2016 +0200
Committer: oleewere <[email protected]>
Committed: Fri Jul 15 15:43:46 2016 +0200

----------------------------------------------------------------------
 .../src/main/webapp/scripts/utils/Globals.js    |    3 +-
 .../src/main/webapp/scripts/utils/Tour.js       |    6 +-
 .../src/main/webapp/scripts/utils/Utils.js      |    9 +-
 .../scripts/views/common/EventHistoryLayout.js  |  479 ++++
 .../views/dialog/ApplySearchFilterView.js       |    8 +-
 .../views/dialog/SaveSearchFilterView.js        |    2 +-
 .../scripts/views/graphs/GraphLayoutView.js     |   10 +-
 .../views/tabs/HierarchyTabLayoutView.js        |    5 +-
 .../src/main/webapp/styles/style.css            | 2682 +++++++++++-------
 .../common/EventHistoryItemView_tmpl.html       |   32 +
 .../common/EventHistoryLayout_tmpl.html         |   44 +
 11 files changed, 2244 insertions(+), 1036 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a53b2c8d/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
index 7c93d12..212846b 100644
--- 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
@@ -63,7 +63,8 @@ define(['require','App'], function(require, App){
                eMessage:{label:'Exclude Message'},
                time:{label:''},
                includeQuery : {label:"Include Column"},
-               excludeQuery : {label:"Exclude Column"}
+               excludeQuery : {label:"Exclude Column"},
+               dateRangeLabel : {label : "Date Range"}
        };
 
        Globals.graphType =  {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a53b2c8d/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Tour.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Tour.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Tour.js
index cb28576..7d99c26 100644
--- 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Tour.js
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Tour.js
@@ -166,9 +166,9 @@ define(['require', 'tour'], function(require, TourJs) {
             $('.tour-step-backdrop:first').find('.finger').css(options.css);
         };
 
-        // var overlay = document.createElement('div');
-        // overlay.setAttribute('class', 'overlayIntro');
-        // $('body').append(overlay);
+        var overlay = document.createElement('div');
+        overlay.setAttribute('class', 'overlayIntro');
+        $('body').append(overlay);
     };
 
     TourJs.bindEvent = function(tour) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a53b2c8d/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
index 3d2657d..4e7b348 100644
--- 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Utils.js
@@ -336,11 +336,10 @@ define(['require',
         *            params - The params
         */
        Utils.alertPopup = function(params) {
-               if (params.callback == undefined) {
-                       bootbox.alert(params.msg);
-               } else {
-                       bootbox.alert(params.msg, params.callback);
-               }
+               var obj = _.extend({
+                               message : params.msg    
+               },params);
+               bootbox.alert(obj);
        };
 
        /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/a53b2c8d/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
new file mode 100644
index 0000000..470f1f2
--- /dev/null
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
@@ -0,0 +1,479 @@
+/**
+* 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/VEventHistoryList',
+    'models/VCommonModel',
+    'hbs!tmpl/common/EventHistoryLayout_tmpl',
+    'hbs!tmpl/common/EventHistoryItemView_tmpl',
+    'moment'
+],function(require,Backbone,Globals,Utils,VEventHistoryList,VCommonModel,EventHistoryLayout_tmpl,
 EventHistoryItemView_tmpl,moment){
+    'use strict';
+       
+    var EventView = Backbone.Marionette.ItemView.extend({
+       tagName:"li",
+       template : EventHistoryItemView_tmpl,
+       ui : {
+               content : "[data-id='content']",
+               flagWrap : ".flagWrap"
+       },
+       /** ui events hash */
+               events: function() {
+                       var events = {};
+                       events["click "+this.ui.flagWrap] = 'onFlagClick';
+                       events["click .infoBtn"] = 'onInfoClick';
+                       events["click .removeFlag"] = 'onRemoveFlagClick';
+                       events["click .saveBtn"] = 'onSaveClick';
+                       return events;
+               },
+       initialize: function(options) {
+               _.extend(this, _.pick(options,'eventVent','vent'));
+               this.bindEvents();
+       },
+       bindEvents : function(){
+               this.listenTo(this.model, "event:highlight", function($el) {
+                               this.highlightli($el);
+                       }, this);
+               this.listenTo(this.model, "event:fireReinitialize", function() {
+                               this.fireReinitialize();
+                       }, this);
+       },
+       onRender : function(){
+               this.ui.content.text(this.getLabel());
+       },
+       getLabel : function(){
+               var text = "",param = this.model.get("newParam"),key = 
_.keys(this.model.get("newParam"))[0];
+               if(param){
+                       var preText = "Value:";
+                       if(param.dateRangeLabel){
+                               return param.dateRangeLabel;
+                       }
+                       if(key === "includeQuery"){
+                               preText = "IColumn :";
+                       }
+                       if(key === "excludeQuery"){
+                               preText = "EColumn :";
+                       }
+                       if(key === "level"){
+                               preText = "Level :";
+                       }
+                       if(key === "mustBe"){
+                               preText = "IC :";
+                       }
+                       if(key === "mustNot"){
+                               preText = "EC :";
+                       }
+                       if(key === "mustNot"){
+                               preText = "EC :";
+                       }
+                       if(key === "from" || key === "to"){
+                               preText = param.dateRangeLabel;
+                       }
+                       if(key === "filtername"){
+                               preText = "Filter :";
+                       }
+                       return preText + " 
"+this.model.get("newParam")[_.keys(this.model.get("newParam"))[0]];
+               }
+               return text;
+       },
+       onFlagClick : function(e){
+               var that = this;
+               this.fireReinitialize();
+               setTimeout(function(){
+                       that.highlightli(that.$el.children("[data-id]"))
+               },10);
+       },
+       highlightli : function($el){
+               //$el is the flag container
+               
$el.parents("li").siblings("li").find(".showFlag").removeClass("flagActive");
+               $el.addClass("flagActive");
+               
this.eventVent.trigger("event:position:center",$el.parents("li"));
+       },
+       onInfoClick : function(e){
+               var html = "<table class='table eventTable 
table-hover'><thead><th>Name</th><th>Value</th></thead>",that=this;
+               _.each(this.model.get("params"), function(value, key) {
+                       if ( (! _.isEmpty(value)) && ( key != "bundleId" && key 
!= "start_time" && 
+                               key != "end_time" && key != "q" && key != 
"unit" && key != "query" && key != "type" && 
+                               key != "time" && key != "dateRangeLabl" && key 
!= "advanceSearch" && !_.isUndefined(Globals.paramsNameMapping[key]) )){
+                               html += '<tr class="' + key + '"><td>' + 
Globals.paramsNameMapping[key].label + '</td><td>' + 
that.getHtmlForParam(key,value) + '</td><tr>'
+                       }
+               });
+               html += "</table>";
+               Utils.alertPopup({msg : html,className:"bootBoxSmall"});
+       },
+       getHtmlForParam : function(key,value){
+               if(key === "from" || key === "to"){
+                       value = moment(value).format('MM/DD/YYYY,HH:mm:ss,SSS');
+               }
+               return value;
+       },
+       onRemoveFlagClick : function(e){
+               e.stopImmediatePropagation();e.stopPropagation();
+               var siblings = this.$el.siblings(),that=this;
+               if(siblings.length > 0){
+                       var focusLi = $(siblings[siblings.length 
-1]).children("[data-id]");
+                       this.collection.remove(this.model);
+                       this.close();
+                       focusLi.find(".flagWrap").click();
+               }
+               
+        },
+        fireReinitialize: function() {
+            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", _.extend({
+                mustNot: null,
+                mustBe: null,
+                query: null,
+                includeQuery: null,
+                excludeQuery: null
+            }, this.model.get('params')));
+        },
+        onSaveClick : function(e){
+               var that = this;
+            require(['views/dialog/SaveSearchFilterView'], 
function(SaveSearchFilterView) {
+               var view = new SaveSearchFilterView({
+                    selectedCollectionObject: that.model
+                });
+               that.setupDialog({
+                    title: "Save Search Filter",
+                    content: view,
+                    viewType: 'Save',
+                    width: 850,
+                    height: 500,
+                    buttons: [{
+                        id: "okBtn",
+                        text: "Save",
+                        "class": "btn btn-primary",
+                        click: function() {
+                            that.onDialogSubmitted();
+                        }
+                    }, {
+                        id: "cancelBtn",
+                        text: "Close",
+                        "class": "btn btn-default",
+                        click: function() {
+                            that.onDialogClosed();
+                        }
+                    }]
+                });
+            });
+        },
+        setupDialog: function(options) {
+            var that = this;
+            require(['views/common/JBDialog'], function(JBDialog) {
+                var opts = _.extend({
+                    appendTo: 'body',
+                    modal: true,
+                    resizable: false
+                }, options);
+                var dialog = that.dialog = new JBDialog(opts).render().open();
+            })
+        },
+        onDialogSubmitted: function() {
+            var content = this.dialog.options.content;
+            if (content.$('form')[0].checkValidity && 
!content.$('form')[0].checkValidity()) {
+                content.$('form').addClass('has-error');
+                if (content.$('form')[0].reportValidity) {
+                    if (!content.$('form')[0].reportValidity()) {
+                        return;
+                    }
+                }
+                return;
+            } else {
+                if(_.isEmpty(content.ui.filterName.val().trim())){
+                    if(content.$('form')[0].reportValidity){
+                        content.ui.filterName.val('')
+                        content.$('form')[0].reportValidity();
+                        return;
+                    }
+                    return;
+                }else{
+                    content.$('form').removeClass('has-error');  
+                }
+            }
+            var timeType = 
content.$("input[name='radio']:checked").parents("[data-id]").data('id'),
+            params = content.selectedCollectionObject.get("params");
+            if(timeType === "absolute"){
+                params["dateRangeLabel"] = "Custom Range";
+            }
+            params["time"] = timeType;
+            var postObject = {
+                userName: "admin",
+                filtername: content.ui.filterName.val().trim(),
+                rowType: "history",
+                values: JSON.stringify(params)
+            }
+            content.trigger("toggle:okBtn");
+            this.saveEventHistory(postObject);
+        },
+        saveEventHistory: function(postObject) {
+            var that = this
+            this.collection.saveEventHistory(postObject, {
+                success: function(data, textStatus, jqXHR) {
+                    Utils.notifySuccess({
+                        content: "Event History saved successfully."
+                    });
+                    that.onDialogClosed();
+                },
+                error: function(jqXHR, textStatus, errorThrown) {
+                    Utils.notifyError({
+                        content: JSON.parse(jqXHR.responseText).msgDesc || 
"There is some problem in Event History, Please try again later."
+                    });
+                    that.dialog.options.content.trigger("toggle:okBtn",true);
+                },
+                complete: function() {
+                }
+            });
+        },
+        onDialogClosed: function() {
+            if (this.dialog) {
+                this.dialog.close && this.dialog.close();
+                this.dialog.remove && this.dialog.remove();
+                this.dialog = null;
+            }
+        }
+    });
+    
+    
+    
+       return Backbone.Marionette.CompositeView.extend(
+       /** @lends EventHistoryLayout */
+       {
+               _viewName : 'EventHistoryLayout_tmpl',
+
+               template: EventHistoryLayout_tmpl,
+               
+               itemViewContainer : "#events",
+               
+               itemView : EventView,
+               
+               itemViewOptions : function(){
+                       return {
+                               collection : this.collection,
+                               eventVent : this.eventVent,
+                               vent : this.vent
+                       }
+               },
+
+               /** Layout sub regions */
+               regions: {
+               },
+
+               /** ui selector cache */
+               ui: {
+                       loaderEvent : "#loaderEvent",
+                       eventsCont : "#eventsCont",
+                       events : "#events"
+               },
+
+               /** ui events hash */
+               events: function() {
+                       var events = {};
+                       events["change "+this.ui.mainCheck] = 
'onMainCheckboxClick';
+                       events["click .slideArrow a"] = 'slideArrowClick';
+                       events['click .apply-link'] = 'onEventHistoryLoadClick';
+                       events["click .collapse-link"] = 'onCollapseBoxClick';
+                       return events;
+               },
+
+               /**
+                * intialize a new EventHistoryLayout Layout
+                * @constructs
+                */
+               initialize: function(options) {
+                       _.extend(this, 
_.pick(options,'vent','globalVent','params'));
+                       this.eventVent = new Backbone.Wreqr.EventAggregator();
+                       this.searchParmas = (this.params) ? this.params : {};
+                       this.collection = new VEventHistoryList();
+                       this.bindEvents();
+               },
+               bindEvents: function() {
+                       this.listenTo(this.vent, "level:filter type:mustNot 
type:mustBe search:include:exclude " +
+                    "logtime:filter " + 
Globals.eventName.serviceLogsIncludeColumns + " " + 
Globals.eventName.serviceLogsExcludeColumns,
+                    function(value) {
+                               if(this.collection.last()){
+                                       var params = 
_.extend({},this.searchParmas, value);//,id=this.getNewIndex();
+                                       this.addFlag(params,value);
+                                       var leftOffset = 
this.ui.events.offset();
+                                       (leftOffset.left < 0) ? 
this.$('.slideArrow').show() : this.$('.slideArrow').hide();
+                               }
+                               
+                       }, this);
+                       
+                       this.listenTo(this.collection, "add remove reset", 
function() {
+                this.$("[data-id='count']").text(this.collection.length);
+                
this.$("[data-id='totalCount']").text(this.collection.totalCount);
+                this.limitTheFlags();
+            }, this);
+                       
+                       this.listenTo(this.eventVent, "event:position:center", 
function($li) {
+                               this.scrollToElement($li);
+                       }, this);
+               },
+               onRender : function(){
+                       if(this.params){
+                               
this.collection.add(this.collection.model({id:this.getNewIndex(),
+                                       params:_.extend({},this.params),
+                                       newParam:{level:this.params.level
+                               }}));
+                               this.$(".removeFlag").remove();
+                       }
+               },
+               onShow : function(){
+                       this.flagDraggable();
+               },
+               addFlag : function(params, showParam){
+                       var id=this.getNewIndex();
+                       var model = new this.collection.model({
+                               id : id,
+                               params : params,
+                               newParam : showParam
+                       });
+                       this.collection.add(model);
+                       
model.trigger("event:highlight",this.ui.events.find("[data-id='"+id+"']"));
+                       return model;
+               },
+               limitTheFlags : function(){
+                       if(this.collection.length == 26){
+                               this.collection.remove(this.collection.at(1));
+                       }
+               },
+               flagDraggable: function() {
+                       var that = this;
+            this.ui.events.draggable({
+                axis: "x",
+                stop : function(){
+                       that.toggleSlideArrow();
+                }
+            });
+            
+        },
+        toggleSlideArrow : function(){
+               var that = this;
+               that.leftDistance = that.ui.events.offset();
+            if(that.timeLineWidth <= that.leftDistance.left){
+                //this.$('.slideArrow').hide();
+            }else{
+                that.$('.slideArrow').show();
+            }
+        },
+               getNewIndex : function(){
+                       if(this.lastIndex){
+                               this.lastIndex++;
+                       }else{
+                               this.lastIndex = 1;
+                       }
+                       return this.lastIndex;
+               },
+               scrollToElement : function($li){
+                       var flagIndex = $li.index();
+            var options = { duration: 200 };
+            this.timeLineWidth = this.ui.eventsCont.width() / 2;
+                
+            this.ui.events.animate({ 'left': this.timeLineWidth - (flagIndex * 
$li.outerWidth()) + 'px' }, options);
+
+               },
+               slideArrowClick : function(e){
+            e.preventDefault();
+            var leftDistance = this.ui.events.offset();
+            if($(e.currentTarget).hasClass('arrowLeft')){              
+                this.ui.events.animate({ 'left': leftDistance.left - 140 + 
'px' }, 200) ;
+            }else{
+                this.ui.events.animate({ 'left': leftDistance.left + 140 + 
'px' }, 200);
+            }                          
+        },
+        onEventHistoryLoadClick: function() {
+            var that = this;
+            require(['views/dialog/ApplySearchFilterView'], 
function(ApplySearchFilterView) {
+                var view = new ApplySearchFilterView({
+                    collection: new VEventHistoryList([], {
+                        state: {
+                            firstPage: 0,
+                            pageSize: 10 // have to pass max pageSize value or
+                                // else it will take default pageSize
+                        }
+                    })
+                })
+                that.setupDialog({
+                    title: "Apply Filter",
+                    content: view,
+                    viewType: 'Save',
+                    width: 850,
+                    height: 500,
+                    buttons: [{
+                        id: "cancelBtn",
+                        text: "Close",
+                        "class": "btn btn-default",
+                        click: function() {
+                            that.onDialogClosed();
+                        }
+                    }]
+                });
+                view.on("apply:filter",function(model){
+                       var params = JSON.parse(model.get("values"));
+                    if (params.time === "relative") {
+                        var rangeNew = 
Utils.dateUtil.getRelativeDateFromString(params.dateRangeLabel);
+                        if (_.isArray(rangeNew)) {
+                            params.from = rangeNew[0].toJSON();
+                            params.to = rangeNew[1].toJSON();
+                        }
+                    }
+                    var newModel = 
that.addFlag(params,{filtername:model.get("filtername")});
+                    newModel.trigger("event:fireReinitialize");
+                    that.onDialogClosed();
+                })
+            });
+        },
+        setupDialog: function(options) {
+            var that = this;
+            require(['views/common/JBDialog'], function(JBDialog) {
+                var opts = _.extend({
+                    appendTo: 'body',
+                    modal: true,
+                    resizable: false
+                }, options);
+                var dialog = that.dialog = new JBDialog(opts).render().open();
+            })
+        },
+        onDialogClosed: function() {
+            if (this.dialog) {
+                this.dialog.close && this.dialog.close();
+                this.dialog.remove && this.dialog.remove();
+                this.dialog = null;
+            }
+        },
+        onCollapseBoxClick : function(e){
+               if($(e.currentTarget).find("i").hasClass("fa-chevron-down")){
+                       var $el = this.ui.events.find(".flagActive");
+                       if($el.length){
+                               var model = this.collection.get($el.data("id"));
+                               setTimeout(function(){
+                                       model.trigger("event:highlight",$el);
+                               },1000);
+                       }
+               }
+        }
+       });
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/a53b2c8d/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/ApplySearchFilterView.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/ApplySearchFilterView.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/ApplySearchFilterView.js
index c8e8895..16a37ad 100644
--- 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/ApplySearchFilterView.js
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/ApplySearchFilterView.js
@@ -147,10 +147,8 @@ define(['require',
                      '<i class="fa 
fa-times"></i></button><strong>Range:</strong>' + (this.createInnerSpan(params, 
"from")) +
                     '<strong>&nbsp:To:&nbsp:</strong>' + 
(this.createInnerSpan(params, "to")) +
                     '<br><strong>Level:</strong>' + 
(this.createInnerSpan(params, "level")) +
-                    '<br><strong>Include Component:</strong>' + 
(this.createInnerSpan(params, "mustBe")) +
+                    '<br><strong>Include Components:</strong>' + 
(this.createInnerSpan(params, "mustBe")) +
                     '<br><strong>Exclude Components:</strong>' + 
(this.createInnerSpan(params, "mustNot")) +
-                    '<br><strong>Include message:</strong>' + 
(this.createInnerSpan(params, "iMessage")) +
-                    '<br><strong>Exclude message:</strong>' + 
(this.createInnerSpan(params, "eMessage")) +
                     '<br><strong>Include Columns:</strong>' + 
(this.createInnerSpan(params, "includeQuery")) +
                     '<br><strong>Exclude Columns:</strong>' + 
(this.createInnerSpan(params, "excludeQuery")) + '</pre>';
                 
@@ -173,10 +171,10 @@ define(['require',
                 return ((typeString.length == 0) ? ("-") : ((type == "level") 
? ((typeString).slice(0, -1)) : (typeString)))
             },
             onApplyClick: function(e) {
-                this.apllyedModel = this.collection.findWhere({
+                this.selectedModel = this.collection.findWhere({
                     id: 
""+parseInt($(arguments[0].currentTarget).attr('data-nameId'))
                 });
-                $(this.el).parents().find('#cancelBtn').click();
+                this.trigger("apply:filter",this.selectedModel);
             },
             onDeleteClick: function(e) {
                 var that = this;

http://git-wip-us.apache.org/repos/asf/ambari/blob/a53b2c8d/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/SaveSearchFilterView.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/SaveSearchFilterView.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/SaveSearchFilterView.js
index 2ef2f94..6f3812c 100644
--- 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/SaveSearchFilterView.js
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/SaveSearchFilterView.js
@@ -80,7 +80,7 @@ define(['require',
                     that = this;
 
                 _.each(this.params, function(value, key) {
-                    if ((key != "from" && value != "" && key != "to" && key != 
"bundleId" && key != "start_time" && 
+                    if ((key != "from" && (! _.isEmpty(value) || value != 
"[]") && key != "to" && key != "bundleId" && key != "start_time" && 
                                key != "end_time" && key != "q" && key != 
"unit" && key != "query" && key != "type" && 
                                key != "time" && key != "dateRangeLabel" && key 
!= "advanceSearch" && !_.isUndefined(Globals.paramsNameMapping[key]) )) {
                         tableSting += '<tr class="' + key + '"><td>' + 
Globals.paramsNameMapping[key].label + '</td><td>' + 
(that.createInnerSpan(key)) + '</td><tr>'

http://git-wip-us.apache.org/repos/asf/ambari/blob/a53b2c8d/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
index cc0eafb..6144f9d 100644
--- 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
@@ -479,10 +479,12 @@ define(['require',
                                'to': 
that.dateUtil.getMomentObject(that.brushValue[1])
                            });
                        } else {*/
-                    that.vent.trigger("date:setDate", {
-                        'from': 
that.dateUtil.getMomentObject(that.brushValue[0]),
-                        'to': that.dateUtil.getMomentObject(that.brushValue[1])
-                    });
+                    if 
(!moment(that.brushValue[0]).isSame(that.brushValue[1])){
+                        that.vent.trigger("date:setDate", {
+                                'from': 
that.dateUtil.getMomentObject(that.brushValue[0]),
+                                'to': 
that.dateUtil.getMomentObject(that.brushValue[1])
+                          });          
+                     }
                     /*}*/
 
                 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a53b2c8d/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 8c2fc8f..d9ad79b 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
@@ -155,6 +155,7 @@ define(['require',
                        this.fetchServiceLogsColumns();
                        this.renderBubbleTableView();
                        this.renderLogLevel();
+                       this.renderEventHistory();
                        this.renderHistogram();
                        this.renderDatePicker();
                        //this.renderVSSearch();
@@ -347,7 +348,7 @@ define(['require',
                },
                renderEventHistory:function(){
                        var that = this;
-                       
require(['views/tabs/EventHistoryLayoutView'],function(EventHistoryLayoutView){
+                       
require(['views/common/EventHistoryLayout'],function(EventHistoryLayoutView){
                                that.REventHistory.show(new 
EventHistoryLayoutView({
                                        vent : that.vent,
                                        globalVent:that.globalVent,
@@ -409,7 +410,7 @@ define(['require',
                        formatResult: function(item){
                                return item[textKey];
                                }
-                       }).on("change",function(e){
+                       }).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);

Reply via email to