http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/Utils.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/Utils.js 
b/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/Utils.js
deleted file mode 100644
index 15322ef..0000000
--- 
a/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/Utils.js
+++ /dev/null
@@ -1,1241 +0,0 @@
-/**
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-define(['require',
-    'utils/Enums',
-    'utils/LangSupport',
-    'moment',
-    'utils/Globals',
-    'bootbox'
-],function(require,XAEnums,localization,moment,Globals,bootbox) {
-    'use strict';
-
-
-    var prevNetworkErrorTime = 0;
-    var Utils = {};
-
-    require(['noty'],function(){
-        $.extend($.noty.defaults,{
-            timeout : 5000,
-            layout : "topRight",
-            theme : "relax",
-            closeWith: ['click','button'],
-             animation   : {
-                 open  : 'animated flipInX',
-                 close : 'animated flipOutX',
-                 easing: 'swing',
-                 speed : 500
-             }
-            
-        });
-    });
-
-    // ///////////////////////////////////////////////////////
-    // Enum utility methods
-    // //////////////////////////////////////////////////////
-    /**Utils
-     * Get enum for the enumId
-     * 
-     * @param {integer}
-     *            enumId - The enumId
-     */
-    Utils.getEnum = function(enumId) {
-        if (!enumId || enumId.length < 1) {
-            return "";
-        }
-        // check if the enums are loaded
-        if (!XAEnums[enumId]) {
-            return "";
-        }
-        return XAEnums[enumId];
-    };
-
-    /**
-     * Get enum by Enum and value
-     * 
-     * @param {Object}
-     *            myEnum - The enum
-     * @param {integer}
-     *            value - The value
-     */
-    Utils.enumElementByValue = function(myEnum, value) {
-        var element = _.detect(myEnum, function(element) {
-            return element.value == value;
-        });
-        return element;
-    };
-
-    /**
-     * Get enum by Enum and name, value
-     * 
-     * @param {Object}
-     *            myEnum - The enum
-     * @param {string}
-     *            propertyName - The name of key
-     * @param {integer}
-     *            propertyValue - The value
-     */
-    Utils.enumElementByPropertyNameValue = function(myEnum, propertyName,
-            propertyValue) {
-        for ( var element in myEnum) {
-            if (myEnum[element][propertyName] == propertyValue) {
-                return myEnum[element];
-            }
-        }
-        return null;
-    };
-
-    /**
-     * Get enum value for given enum label
-     * 
-     * @param {Object}
-     *            myEnum - The enum
-     * @param {string}
-     *            label - The label to search for in the Enum
-     */
-    Utils.enumLabelToValue = function(myEnum, label) {
-        var element = _.detect(myEnum, function(element) {
-            return element.label == label;
-        });
-        return (typeof element === "undefined") ? "--" : element.value;
-    };
-
-    /**
-     * Get enum label for given enum value
-     * 
-     * @param {Object}
-     *            myEnum - The enum
-     * @param {integer}
-     *            value - The value
-     */
-    Utils.enumValueToLabel = function(myEnum, value) {
-        var element = _.detect(myEnum, function(element) {
-            return element.value == value;
-        });
-        return (typeof element === "undefined") ? "--" : element.label;
-    };
-
-    /**
-     * Get enum label tt string for given Enum value
-     * 
-     * @param {Object}
-     *            myEnum - The enum
-     * @param {integer}
-     *            value - The value
-     */
-    Utils.enumValueToLabeltt = function(myEnum, value) {
-        var element = _.detect(myEnum, function(element) {
-            return element.value == value;
-        });
-        return (typeof element === "undefined") ? "--" : element.tt;
-    };
-
-    /**
-     * Get NVpairs for given Enum to be used in Select
-     * 
-     * @param {Object}
-     *            myEnum - The enum
-     */
-    Utils.enumToSelectPairs = function(myEnum) {
-        return _.map(myEnum, function(o) {
-            return {
-                val : o.value,
-                label : o.label
-            };
-        });
-    };
-
-    /**
-     * Get NVpairs for given Enum
-     * 
-     * @param {Object}
-     *            myEnum - The enum
-     */
-    Utils.enumNVPairs = function(myEnum) {
-        var nvPairs = {
-            ' ' : '--Select--'
-        };
-
-        for ( var name in myEnum) {
-            nvPairs[myEnum[name].value] = myEnum[name].label;
-        }
-
-        return nvPairs;
-    };
-
-    /**
-     * Get array NV pairs for given Array
-     * 
-     * @param {Array}
-     *            myArray - The eArraynum
-     */
-    Utils.arrayNVPairs = function(myArray) {
-        var nvPairs = {
-            ' ' : '--Select--'
-        };
-        _.each(myArray, function(val) {
-            nvPairs[val] = val;
-        });
-        return nvPairs;
-    };
-
-    Utils.notifyInfo = function(options) {
-        noty({
-            type:"information",
-            text : "<i class='fa fa-exclamation-circle'></i> 
"+(options.content || "Info message.")
-        });
-    };
-    Utils.notifyWarn = function(options) {
-        noty({
-            type:"warning",
-            text : "<i class='fa fa-times-circle'></i> "+(options.content || 
"Info message.")
-        });
-    };
-
-    Utils.notifyError = function(options) {
-        noty({
-            type:"error",
-            text : "<i class='fa fa-times-circle'></i> "+(options.content || 
"Error occurred.")
-        });
-    };
-
-    Utils.notifySuccess = function(options) {
-        noty({
-            type:"success",
-            text : "<i class='fa fa-check-circle-o'></i> "+(options.content || 
"Error occurred.")
-        });
-    };
-
-    /**
-     * Convert new line to <br />
-     * 
-     * @param {string}
-     *            str - the string to convert
-     */
-    Utils.nl2br = function(str) {
-        if (!str)
-            return '';
-        return str.replace(/\n/g, '<br/>').replace(/[\r\t]/g, " ");
-    };
-
-    /**
-     * Convert <br />
-     * to new line
-     * 
-     * @param {string}
-     *            str - the string to convert
-     */
-    Utils.br2nl = function(str) {
-        if (!str)
-            return '';
-        return str.replace(/\<br(\s*\/|)\>/gi, '\n');
-    };
-
-    /**
-     * Escape html chars
-     * 
-     * @param {string}
-     *            str - the html string to escape
-     */
-    Utils.escapeHtmlChar = function(str) {
-        if (!str)
-            return '';
-        str = str.replace(/&/g, "&amp;");
-        str = str.replace(/>/g, "&gt;");
-        str = str.replace(/</g, "&lt;");
-        str = str.replace(/\"/g, "&quot;");
-        str = str.replace(/'/g, "&#039;");
-        return str;
-    };
-
-    /**
-     * nl2br and Escape html chars
-     * 
-     * @param {string}
-     *            str - the html string
-     */
-    Utils.nl2brAndEscapeHtmlChar = function(str) {
-
-        if (!str)
-            return '';
-        var escapedStr = escapeHtmlChar(str);
-        var finalStr = nl2br(str);
-        return finalStr;
-    };
-
-    /**
-     * prevent navigation with msg and call callback
-     * 
-     * @param {String}
-     *            msg - The msg to show
-     * @param {function}
-     *            callback - The callback to call
-     */
-    Utils.preventNavigation = function(msg, $form) {
-        window._preventNavigation = true;
-        window._preventNavigationMsg = msg;
-        $("body a, i[class^='icon-']").on("click.blockNavigation", function(e) 
{
-            Utils.preventNavigationHandler.call(this, e, msg, $form);
-        });
-    };
-
-    /**
-     * remove the block of preventNavigation
-     */
-    Utils.allowNavigation = function() {
-        window._preventNavigation = false;
-        window._preventNavigationMsg = undefined;
-        $("body a, i[class^='icon-']").off('click.blockNavigation');
-    };
-
-    Utils.preventNavigationHandler = function(e, msg, $form) {
-        var formChanged = false;
-        var target = this;
-        if (!_.isUndefined($form))
-            formChanged = $form.find('.dirtyField').length > 0 ? true : false;
-        if (!$(e.currentTarget).hasClass("_allowNav") && formChanged) {
-
-            e.preventDefault();
-            e.stopImmediatePropagation();
-            bootbox.dialog(msg, [ {
-                "label" : localization.tt('btn.stayOnPage'),
-                "class" : "btn-success btn-small",
-                "callback" : function() {
-                }
-            }, {
-                "label" : localization.tt('btn.leavePage'),
-                "class" : "btn-danger btn-small",
-                "callback" : function() {
-                    Utils.allowNavigation();
-                    target.click();
-                }
-            } ]);
-            return false;
-        }
-    };
-
-    /**
-     * Bootbox wrapper for alert
-     * 
-     * @param {Object}
-     *            params - The params
-     */
-    Utils.alertPopup = function(params) {
-        var obj = _.extend({
-                message : params.msg
-        },params);
-        bootbox.alert(obj);
-    };
-
-    /**
-     * Bootbox wrapper for confirm
-     * 
-     * @param {Object}
-     *            params - The params
-     */
-    Utils.confirmPopup = function(params) {
-        bootbox.confirm(params.msg, function(result) {
-            if (result) {
-                params.callback();
-            }
-        });
-    };
-
-    Utils.bootboxCustomDialogs = function(params) {
-        bootbox.dialog({
-            title: params.title,
-            message: params.msg,
-            buttons: {
-                cancel: {
-                    label: "Cancel",
-                    className: "btn-secondary"
-                },
-                Ok: {
-                    className: "btn-primary",
-                    callback: params.callback
-                }
-            }
-        });
-    };
-
-    Utils.filterResultByIds = function(results, selectedVals) {
-        return _.filter(results, function(obj) {
-            if ($.inArray(obj.id, selectedVals) < 0)
-                return obj;
-
-        });
-    };
-    Utils.filterResultByText = function(results, selectedVals) {
-        return _.filter(results, function(obj) {
-            if ($.inArray(obj.text, selectedVals) < 0)
-                return obj;
-
-        });
-    };
-    Utils.scrollToField = function(field) {
-        $("html, body").animate({
-            scrollTop : field.position().top - 80
-        }, 1100, function() {
-            field.focus();
-        });
-    };
-    Utils.blockUI = function(options) {
-        var Opt = {
-            autoUnblock : false,
-            clickUnblock : false,
-            bgPath : 'images/',
-            content : '<img src="images/blockLoading.gif" > Please wait..',
-            css : {}
-        };
-        options = _.isUndefined(options) ? Opt : options;
-        $.msg(options);
-    };
-    var errorShown = false;
-    Utils.defaultErrorHandler = function(model, error) {
-        if (error.status == 500) {
-            try {
-                if (!errorShown) {
-                    errorShown = true;
-                    var errorMessage = "Some issues on server, Please try 
again later."
-                    if (error != null && error.responseText != null) {
-                      var errorObj = JSON.parse(error.responseText);
-                      if (errorObj.hasOwnProperty('msgDesc')) {
-                        errorMessage = errorObj.msgDesc;
-                      }
-                    }
-                    Utils.notifyError({
-                      content: errorMessage
-                    });
-                    setTimeout(function() {
-                        errorShown = false;
-                    }, 3000);
-                }
-            } catch (e) {}
-        }
-        else if (error.status == 400) {
-            try {
-                if (!errorShown) {
-                    errorShown = true;
-                    Utils.notifyError({
-                        content: JSON.parse(error.responseText).msgDesc
-                    });
-                    setTimeout(function() {
-                        errorShown = false;
-                    }, 3000);
-                }
-            } catch (e) {}
-        } else if (error.status == 401) {
-            window.location = 'login.html' + window.location.search;
-            // App.rContent.show(new vError({
-            //     status : error.status
-            // }));
-
-        } else if (error.status == 419) {
-            window.location = 'login.html' + window.location.search;
-
-        } else if (error.status == "0") {
-            var diffTime = (new Date().getTime() - prevNetworkErrorTime);
-            if (diffTime > 3000) {
-                prevNetworkErrorTime = new Date().getTime();
-                if(error.statusText === "abort"){
-                    Utils.notifyInfo({ content: "You have canceled the 
request"});
-                }else{
-                     Utils.notifyError({
-                        content: "Network Connection Failure : " +
-                            "It seems you are not connected to the internet. 
Please check your internet connection and try again"
-                    });
-                }
-            }
-        }
-        // require(['views/common/ErrorView','App'],function(vError,App){
-
-        // });
-    };
-    Utils.select2Focus = function(event) {
-        if (/^select2-focus/.test(event.type)) {
-            $(this).select2('open');
-        }
-    };
-
-    Utils.checkDirtyField = function(arg1, arg2, $elem) {
-        if (_.isEqual(arg1, arg2)) {
-            $elem.removeClass('dirtyField');
-        } else {
-            $elem.addClass('dirtyField');
-        }
-    };
-    Utils.checkDirtyFieldForToggle = function($el) {
-        if ($el.hasClass('dirtyField')) {
-            $el.removeClass('dirtyField');
-        } else {
-            $el.addClass('dirtyField');
-        }
-    };
-    Utils.checkDirtyFieldForSelect2 = function($el, dirtyFieldValue, that) {
-        if ($el.hasClass('dirtyField')
-                && _.isEqual($el.val(), dirtyFieldValue.toString())) {
-            $el.removeClass('dirtyField');
-        } else if (!$el.hasClass('dirtyField')) {
-            $el.addClass('dirtyField');
-            dirtyFieldValue = !_.isUndefined(that.value.values) ? 
that.value.values
-                    : '';
-        }
-        return dirtyFieldValue;
-    };
-    Utils.enumToSelectLabelValuePairs = function(myEnum) {
-        return _.map(myEnum, function(o) {
-            return {
-                label : o.label,
-                value : o.value + ''
-            // category :'DHSS',
-            };
-        });
-    };
-    Utils.hackForVSLabelValuePairs = function(myEnum) {
-        return _.map(myEnum, function(o) {
-            return {
-                label : o.label,
-                value : o.label + ''
-            // category :'DHSS',
-            };
-        });
-    };
-    Utils.addVisualSearch = function(searchOpt, serverAttrName, collection,
-            pluginAttr) {
-        var visualSearch;
-        var search = function(searchCollection, serverAttrName, searchOpt,
-                collection) {
-            var params = {};
-            searchCollection.each(function(m) {
-                var serverParamName = _.findWhere(serverAttrName, {
-                    text : m.attributes.category
-                });
-                var extraParam = {};
-                if (_.has(serverParamName, 'multiple')
-                        && serverParamName.multiple) {
-                    extraParam[serverParamName.label] = Utils
-                            .enumLabelToValue(serverParamName.optionsArr, m
-                                    .get('value'));
-                    ;
-                    $.extend(params, extraParam);
-                } else {
-                    if (!_.isUndefined(serverParamName)) {
-                        extraParam[serverParamName.label] = m.get('value');
-                        $.extend(params, extraParam);
-                    }
-                }
-            });
-            collection.queryParams = $.extend(collection.queryParams, params);
-            collection.state.currentPage = collection.state.firstPage;
-            collection.fetch({
-                reset : true,
-                cache : false
-            // data : params,
-            });
-        };
-        // var searchOpt = ['Event Time','User','Resource Name','Resource
-        // ID','Resource Type','Repository Name','Repository
-        // Type','Result','Client IP','Client Type','Access Type','Access
-        // Enforcer','Audit Type','Session ID'];
-
-        var callbackCommon = {
-            search : function(query, searchCollection) {
-                collection.VSQuery = query;
-                search(searchCollection, serverAttrName, searchOpt, 
collection);
-            },
-            clearSearch : function(callback) {
-                _.each(serverAttrName, function(attr) {
-                    delete collection.queryParams[attr.label];
-                });
-                callback();
-            },
-            facetMatches : function(callback) {
-                // console.log(visualSearch);
-                var searchOptTemp = $.extend(true, [], searchOpt);
-                visualSearch.searchQuery.each(function(m) {
-                    if ($.inArray(m.get('category'), searchOptTemp) >= 0) {
-                        searchOptTemp.splice($.inArray(m.get('category'),
-                                searchOptTemp), 1);
-                    }
-                });
-                // visualSearch.options.readOnly = searchOptTemp.length <= 0 ?
-                // true : false;
-                callback(searchOptTemp, {
-                    preserveOrder : false
-                });
-            },
-            removedFacet : function(removedFacet, searchCollection, indexObj) {
-                // console.log(removedFacet);
-
-                var removedFacetSeverName = _.findWhere(serverAttrName, {
-                    text : removedFacet.get('category')
-                });
-                if (!_.isUndefined(removedFacetSeverName)) {
-                    delete collection.queryParams[removedFacetSeverName.label];
-                    collection.state.currentPage = collection.state.firstPage;
-                    collection.fetch({
-                        reset : true,
-                        cache : false
-                    });
-                }
-                // TODO Added for Demo to remove datapicker popups
-                if (!_.isUndefined(visualSearch.searchBox.$el))
-                    visualSearch.searchBox.$el.parents('body').find(
-                            '.datepicker').remove();
-            }
-        // we can also add focus, blur events callback here..
-        };
-        pluginAttr.callbacks = $.extend(callbackCommon, pluginAttr.callbacks);
-        // Initializing VisualSearch Plugin....
-        visualSearch = VS.init($.extend(pluginAttr, {
-            remainder : false
-        }));
-
-        if (visualSearch.searchQuery.length > 0) // For On Load Visual Search
-            search(visualSearch.searchQuery, serverAttrName, searchOpt,
-                    collection);
-
-        return visualSearch;
-    };
-
-    Utils.displayDatepicker = function($el, facet, $date, callback) {
-        var input = $el
-                .find('.search_facet.is_editing input.search_facet_input');
-        $el.parents('body').find('.datepicker').hide();
-        input.datepicker({
-            autoclose : true,
-            dateFormat : 'yy-mm-dd'
-        }).on('changeDate', function(ev) {
-            callback(ev.date);
-            input.datepicker("hide");
-            var e = jQuery.Event("keydown");
-            e.which = 13; // Enter
-            $(this).trigger(e);
-        });
-        if (!_.isUndefined($date)) {
-            if (facet == 'Start Date') {
-                input.datepicker('setEndDate', $date);
-            } else {
-                input.datepicker('setStartDate', $date);
-            }
-        }
-        input.datepicker('show');
-        input.on('blur', function(e) {
-            input.datepicker("hide");
-            // $('.datepicker').remove();
-
-        });
-        // input.attr("readonly", "readonly");
-        input.on('keydown', function(e) {
-            if (e.which == 9 && e.shiftKey) {
-                input.datepicker('setValue', new Date());
-                input.trigger('change');
-                input.datepicker("hide");
-            }
-            if (e.which == 13) {
-                var e1 = jQuery.Event("keypress");
-                e1.which = 13; // Enter
-                $(this).trigger(e1);
-
-            }
-        });
-        return input;
-    };
-    
-    Utils.capitaliseFirstLetter = function(string) {
-        return string.charAt(0).toUpperCase() + string.slice(1);
-    };
-    Utils.lowerCaseFirstLetter = function(string) {
-        return string.charAt(0).toLowerCase() + string.slice(1);
-    };
-    Utils.toUpperCase = function(string) {
-        return (""+string).toUpperCase();
-    };
-    
-    Utils.bindDraggableEvent = function($el){
-        //
-        //  Function maked all .box selector is draggable, to disable for 
concrete element add class .no-drop
-        //
-        $el
-        .draggable({
-            revert: true,
-            zIndex: 2000,
-            cursor: "crosshair",
-            handle: '.box-name',
-            opacity: 0.8
-        })
-        .droppable({
-            tolerance: 'pointer',
-            drop: function( event, ui ) {
-                var draggable = ui.draggable;
-                var droppable = $(this);
-                var dragPos = draggable.position();
-                var dropPos = droppable.position();
-                draggable.swap(droppable);
-                setTimeout(function() {
-                    var dropmap = droppable.find('[id^=map-]');
-                    var dragmap = draggable.find('[id^=map-]');
-                    if (dragmap.length > 0 || dropmap.length > 0){
-                        dragmap.resize();
-                        dropmap.resize();
-                    }
-                    else {
-                        draggable.resize();
-                        droppable.resize();
-                    }
-                }, 50);
-                setTimeout(function() {
-                    draggable.find('[id^=map-]').resize();
-                    droppable.find('[id^=map-]').resize();
-                }, 250);
-            }
-        });
-    };
-    
-    Utils.scrollToSearchString = function(results, type, counter, adjPx,$el){
-        if(results.length > 0){
-            if(type === 'next'){
-                if(counter > 0 && results.length == counter){
-                    counter = 0;
-                }
-            } else if (type === 'prev') {
-                if(counter < 0){
-                    counter = results.length - 1;
-                } else if(counter === results.length){
-                    counter = counter - 2;
-                }
-            }
-            results.removeClass("active");
-            $(results[counter]).addClass("active");
-            if(_.isUndefined($el)){
-                $('html,body').animate({
-                    scrollTop: $(results[counter]).offset().top  - adjPx
-                }, 100);
-            }else{
-                $el.animate({
-                    scrollTop: $(results[counter]).offset().top  - adjPx
-                }, 100);
-            }
-            
-            counter = (type === 'prev') ? counter - 1 : counter + 1;
-        }
-        return counter;
-    };
-    //date should be javascript date
-    Utils.convertDateToUTC  = function (date) {
-        return new Date(date.getUTCFullYear(), date.getUTCMonth(), 
date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), 
date.getUTCSeconds());
-    }
-    Utils.randomNumber = function(){
-        var date = new Date();
-        var id = new Number();
-        return ((Math.random()*date.getTime())/2).toFixed(0)
-    }
-    /**
-     * GET data from form
-     * @param {object} title -serializeArray
-     */
-    Utils.getFormData = function(serializeArray) {
-        var formJson = {};
-        _.each(serializeArray, function(fValues) {
-            formJson[fValues.name] = fValues.value;
-
-        });
-        return formJson;
-    };
-    Utils.getQueryParams = function(qs) {
-        qs = qs.split('+').join(' ');
-
-        var params = {},
-            tokens,
-            re = /[?&]?([^=]+)=([^&]*)/g;
-        try {
-            while (tokens = re.exec(qs)) {
-                params[decodeURIComponent(tokens[1])] = 
decodeURIComponent(tokens[2]);
-            }
-        } catch (exception) {
-            console.error(exception);
-            Utils.notifyError({
-                content: exception
-            });
-        }
-        return params;
-    };
-    /**
-     * [converDate description]
-     * @param  {[type]} option [pass String or momnet object]
-     * @return {[type]}        [it is string]
-     */
-    Utils.dateUtil = new function() {
-        var that = this;
-
-        this.getTimeZone = function(string, format) {
-            return moment(string).format((format || Globals.dateFormat));
-        };
-        this.getJSON = function(string) {
-            return moment(string).toJSON();
-        };
-        this.getMomentUTC = function(string) {
-            return moment.utc(string)
-        };
-        this.getMomentObject = function(string) {
-            return moment(string)
-        }
-        this.getLocalTimeZoneDateObject = function(date,offset) {
-            return new Date(date.setMinutes(-(date.getTimezoneOffset() + 
(offset))))
-        }
-        this.getTimeZoneDateObject = function(string) {
-            return new Date(string)
-        }
-        /**
-         * [getTimeZoneMomentDateObject it will return ]
-         * @param  {[type]} option [require moment tz object]
-         * @return {[type]}        [description]
-         */
-        this.getTimeZoneFromMomentObject = function(momentO) {
-            if(momentO.isValid()){
-                var date = 
momentO.format('MM/DD/YYYY,HH:mm:ss.SSS').split(',');
-                var dateObjectWithMilisecond ="";
-                if(date[0] && date[1]){
-                    var milliseconds = date[1].split('.');
-                    if(milliseconds[0] && milliseconds[1] ){
-                        dateObjectWithMilisecond =  new Date( date[0] +" " 
+milliseconds[0]);
-                        
dateObjectWithMilisecond.setMilliseconds(milliseconds[1]);
-                    }else{
-                        dateObjectWithMilisecond =  new Date(date[0]);
-                    }
-                    return dateObjectWithMilisecond;
-                }
-            }else{
-                this.getLocalTimeZoneDateObject( 
((momentO.toDate())?(momentO.toDate()):(new Date(momentO))));
-            }
-        }
-        this.getTimeDiff = function(option) {
-            // If You have time more then 24 hours so moment returns 0 for 
HH:MM:SS so using this 3 line we get perfect time gap
-            var self = this;
-            var ms = moment(option[1], "DD/MM/YYYY 
HH:mm:ss").diff(moment(option[0], "DD/MM/YYYY HH:mm:ss"));
-            var d = moment.duration(ms);
-            var s = Math.floor(d.asHours()) + 
that.getMomentUTC(ms).format(":mm:ss");
-            this.splitedValue = s.split(':');
-
-            this.getHourDiff = function() {
-                return parseInt(self.splitedValue[0]);
-            };
-            this.getMinuteDiff = function() {
-                return parseInt(self.splitedValue[1]);
-            };
-            this.getSecondDiff = function() {
-                return parseInt(self.splitedValue[2]);
-            };
-        }
-        this.setTimeZone =function(zone){
-            moment.tz.setDefault(zone)
-        }
-        this.getRelativeDateString =function(){}
-        this.getLast1HourRange = function() {
-            var m = moment()
-            return [moment().hour(m.hours() - 
1).minute(m.minutes()).seconds(m.seconds()).milliseconds(m.milliseconds() + 1), 
moment().hour(m.hours()).minute(m.minutes()).seconds(m.seconds()).milliseconds(m.milliseconds())];
-        }
-        this.getLast24HourRange = function() {
-          var m = moment()
-          return [moment().hour(m.hours() - 
24).minute(m.minutes()).seconds(m.seconds()).milliseconds(m.milliseconds() + 
1), 
moment().hour(m.hours()).minute(m.minutes()).seconds(m.seconds()).milliseconds(m.milliseconds())];
-      }
-        this.getTodayRange = function() {
-            return 
[moment().hour('0').minute('0').seconds('0').milliseconds("000"), 
moment().hour('23').minute('59').seconds('59').milliseconds("999")];
-        }
-        this.getYesterdayRange = function() {
-            return [moment().subtract(1, 
'days').hour('0').minute('0').seconds('0').milliseconds("000"), 
moment().subtract(1, 
'days').hour('23').minute('59').seconds('59').milliseconds("999")];
-        }
-        this.getLast7DaysRange = function() {
-            return [moment().subtract(6, 
'days').hour('0').minute('0').seconds('0').milliseconds("000"), 
moment().hour('23').minute('59').seconds('59').milliseconds("999")];
-        }
-        this.getLast30DaysRange = function() {
-            return [moment().subtract(29, 
'days').hour('0').minute('0').seconds('0').milliseconds("000"), 
moment().hour('23').minute('59').seconds('59').milliseconds("999")];
-        }
-        this.getThisMonthRange = function() {
-            return 
[moment().startOf('month').hour('0').minute('0').seconds('0').milliseconds("000"),
 
moment().endOf('month').hour('23').minute('59').seconds('59').milliseconds("999")];
-        }
-        this.getLastMonthRange = function() {
-            return [moment().subtract(1, 
'month').startOf('month').hour('0').minute('0').seconds('0').milliseconds("000"),
 moment().subtract(1, 
'month').endOf('month').hour('23').minute('59').seconds('59').milliseconds("999")];
-        }
-        this.getOneDayTimeDiff = function(checkTime) {
-            var hourDiff = checkTime.getHourDiff();
-            var seconDiff = checkTime.getSecondDiff();
-            var minuteDiff = checkTime.getMinuteDiff();
-            if (hourDiff <= 2) {
-
-                if (hourDiff == 0) {
-                    if (minuteDiff == 0) {
-                        if (seconDiff == 0) {
-                            return "+100MILLISECOND";
-                        } else {
-                            if (seconDiff > 30) {
-                                return "+2SECOND";
-                            } else if (seconDiff < 30 && seconDiff > 1) {
-                                return "+500MILLISECOND";
-                            } else {
-                                return "+100MILLISECOND";
-                            }
-                        }
-
-                    } else {
-                        if (minuteDiff > 30) {
-                            return "+2MINUTE";
-                        } else if (minuteDiff < 30 || minuteDiff > 1) {
-                            return "+1MINUTE";
-                        }
-                    }
-
-                } else {
-                    if (hourDiff == 1) {
-                        return "+2MINUTE";
-                    } else if (hourDiff == 2) {
-                        return "+5MINUTE";
-                    }
-                }
-            } else if (hourDiff <= 6) {
-                return "+5MINUTE";
-            } else if (hourDiff <= 10) {
-                return "+10MINUTE";
-            } else {
-                return "+1HOUR";
-            }
-        }
-        this.getMonthDiff = function(startDate, endDate, dayGap, checkTime) {
-            var dayDiff = (moment(endDate).diff(startDate, 'days'));
-            if (dayDiff <= dayGap) {
-                if (dayDiff == 0) {
-                    return this.getOneDayTimeDiff(checkTime)
-                } else {
-                    return "+" + (moment(endDate).diff(startDate, 'days')) + 
"HOUR"
-                }
-            } else {
-                return "+1DAY"
-            }
-        }
-        this.calculateUnit =function(picker){
-                var dayGap = 10,
-                startDate = new Date(picker.startDate.format('MM/DD/YYYY')),
-                endDate = new Date(picker.endDate.format('MM/DD/YYYY')),
-                now = new Date(moment().format('MM/DD/YYYY'));
-
-            var checkTime = new 
that.getTimeDiff([picker.startDate.format('MM/DD/YYYY HH:mm:ss'), 
picker.endDate.format('MM/DD/YYYY HH:mm:ss')]);
-
-            if ((moment(startDate).isSame(endDate)) && 
(moment(startDate).isSame(now))) {
-                //console.log("today")
-                return that.getOneDayTimeDiff(checkTime);
-            } else if ((moment(startDate).isSame(endDate)) && 
(moment(startDate).isBefore(now))) {
-                //console.log("yesterday")
-                return that.getOneDayTimeDiff(checkTime);
-
-            } else if ((moment(startDate).isBefore(now)) || 
(moment(now).diff(startDate, 'days'))) {
-                if ((moment(now).diff(startDate, 'days')) === 6) {
-                    //console.log("last 7 days");
-                    return "+8HOUR";
-                } else if ((moment(now).diff(startDate, 'days') === 29) || 
(moment(now).diff(startDate, 'days') === 28) || (moment(now).diff(startDate, 
'days') === 30)) {
-                    //console.log("Last 30 days");
-                    return that.getMonthDiff(startDate, endDate, dayGap, 
checkTime);
-                } else if ((moment(now).diff(startDate, 'month') === 1) && 
(moment(now).diff(startDate, 'days') > 30) && 
(moment(startDate).isSame(endDate, 'month'))) {
-                    //console.log("Last Month");
-                    return that.getMonthDiff(startDate, endDate, dayGap, 
checkTime);
-                } else if ((moment(startDate).isSame(endDate, 'month')) && 
((moment(now).diff(startDate, 'days') === 29) || (moment(now).diff(startDate, 
'days') === 30) || (moment(now).diff(startDate, 'days') === 28))) {
-                    //console.log("this Month");
-                    return that.getMonthDiff(startDate, endDate, dayGap, 
checkTime);
-                } else if ((moment(endDate).diff(startDate, 'days') >= 28) && 
(moment(endDate).diff(startDate, 'days') <= 30)) {
-                    //console.log("Last 30 days");
-                    return that.getMonthDiff(startDate, endDate, dayGap, 
checkTime);
-                } else if ((moment(endDate).diff(startDate, 'month') > 3)) {
-                    return "+1MONTH";
-                } else if ((moment(endDate).diff(startDate, 'month') < 3)) {
-                    if ((moment(endDate).diff(startDate, 'month')) === 0) {
-                        return that.getMonthDiff(startDate, endDate, dayGap, 
checkTime);
-                    } else {
-                        return "+1MONTH"
-                    }
-
-                } else {
-                    return "+1MONTH";
-                }
-            } else {
-                if ((moment(endDate).diff(startDate, 'days') < 10)) {
-                    return "+2HOUR";
-                } else if ((moment(endDate).diff(startDate, 'days') >15)) {
-                    return "+8HOUR";
-                } else if ((moment(endDate).diff(startDate, 'days') <= 30)) {
-                    return "+1DAY";
-                } else {
-                    return "+1MONTH";
-                }
-            }
-            
-        }
-        this.getRelativeDateFromString = function(string){
-            var obj =  _.findWhere(Utils.relativeDates, { text : string})
-            if(obj)
-                return obj.fn && obj.fn();
-        }
-
-    };
-    Utils.relativeDates = {
-            last1Hour : {text : "Last 1 
Hour",fn:Utils.dateUtil.getLast1HourRange},
-            last24Hour: {text : "Last 24 
Hour",fn:Utils.dateUtil.getLast24HourRange},
-            today     : {text : "Today",fn:Utils.dateUtil.getTodayRange},
-            yesterday : {text : 
"Yesterday",fn:Utils.dateUtil.getYesterdayRange},
-            last7Days : {text : "Last 7 
Days",fn:Utils.dateUtil.getLast7DaysRange},
-            last30Days: {text : "Last 30 
Days",fn:Utils.dateUtil.getLast30DaysRange},
-            thisMonth : {text : "This 
Month",fn:Utils.dateUtil.getThisMonthRange},
-            lastMonth : {text : "Last 
Month",fn:Utils.dateUtil.getLastMonthRange}
-    };
-
-    /*
-     * Converting Include Exclude string
-     */
-    Utils.encodeIncludeExcludeStr = function(arrOrStr,doEncode,token){
-        var token = token  || Globals.splitToken;
-        if(doEncode && _.isArray(arrOrStr)){
-            return arrOrStr.join(token);
-        }else if(_.isString(arrOrStr)){
-            return arrOrStr.split(token);
-        }
-    };
-
-    Utils.localStorage = {
-        checkLocalStorage:function(key,value){
-            if (typeof(Storage) !== "undefined") {
-                return this.getLocalStorage(key,value);
-            } else {
-                console.log('Sorry! No Web Storage support');
-                Utils.cookie.checkCookie(key,value);
-            }
-        },
-        setLocalStorage:function(key,value){
-            localStorage.setItem(key,value);
-            return {found:false,'value':value};
-        },
-        getLocalStorage:function(key,value){
-            var keyValue = localStorage.getItem(key)
-            if(!keyValue || keyValue == "undefined"){
-                return this.setLocalStorage(key,value);
-            }else{
-                return {found:true,'value':keyValue};
-            }
-        }
-        
-    }
-    Utils.cookie ={
-        setCookie:function(cname,cvalue) {
-            //var d = new Date();
-            //d.setTime(d.getTime() + (exdays*24*60*60*1000));
-            //var expires = "expires=" + d.toGMTString();
-            document.cookie = cname+"="+cvalue+"; "
-            return {found:false,'value':cvalue};
-        },
-        getCookie:function(findString) {
-            var search = findString + "=";
-            var ca = document.cookie.split(';');
-            for(var i=0; i<ca.length; i++) {
-                var c = ca[i];
-                while (c.charAt(0)==' ') c = c.substring(1);
-                if (c.indexOf(name) == 0) {
-                    return c.substring(name.length, c.length);
-                }
-            }
-            return "";
-        },
-        checkCookie:function(key,value) {
-            var findString = getCookie(key);
-            if (findString != "" || keyValue != "undefined") {
-                return {found:true,'value':((findString == 
"undefined")?(undefined):(findString))};
-            } else {
-                return setCookie(key,value);
-            }
-        }
-    }
-    
-    Utils.getRandomColor = function getRandomColor(str) {
-        if(!str)
-            return "#000";
-        var hashCode = function(str) {
-            var hash = 0;
-            for (var i = 0; i < str.length; i++) {
-               hash = str.charCodeAt(i) + ((hash << 5) - hash);
-            }
-            return hash;
-        };
-
-        var intToRGB = function(i){
-            var c = (i & 0x00FFFFFF)
-                .toString(16)
-                .toUpperCase();
-
-            return "00000".substring(0, 6 - c.length) + c;
-        };
-        return "#" +intToRGB(hashCode(str));
-    };
-    /**
-     * [genrateSelect2 description]
-     * @param  {[array of object]}  listOfselect2  []
-     * listOfselect2 = [
-                {
-                    id: "select2 id",
-                    placeholder: "placeholder",
-                    collection: "collection",
-                    dataText: 'display text', //in binding for appling name
-                    collectionHasCode: 'collection dosnt have id then pass 
what you want to show', // if collection dont have id ,
-                    modelAttr: 'collection attribute name',
-                    mandatory: false,
-                    nonCrud: getAuditSchemaFieldsName // pass function Name 
with params (suucess,error,etc)
-                    fetch: true,
-                    data:[] // it will not fetch from collection
-                },
-                {...}
-                ]
-                collectionFetchLov // listenTo in your view
-     * @param  {[type]} that          [scope of function or view]
-     * @return {[type]}               [description]
-     */
-    Utils.genrateSelect2 =function(listOfselect2,that){
-
-        for (var i = 0; i < listOfselect2.length; i++) {
-
-            if (listOfselect2[i]['data'] || listOfselect2[i]['attachSelect']) {
-                if(listOfselect2[i]['attachSelect']){
-                    that.ui[listOfselect2[i]['id']].select2({
-                        placeholder: listOfselect2[i]['placeholder'],
-                        width: '100%'
-                    });
-                    continue;
-                }
-
-                if(that.ui[listOfselect2[i]['id']]){
-                    that.ui[listOfselect2[i]['id']].select2({
-                        placeholder: listOfselect2[i]['placeholder'],
-                        width: '100%',
-                        data: listOfselect2[i]['data']
-                    });
-                }
-               
-                continue;
-            } else {
-                if(that.ui[listOfselect2[i]['id']]){
-                    that.ui[listOfselect2[i]['id']].select2({
-                        placeholder: listOfselect2[i]['placeholder'],
-                        width: '100%',
-                        data: []
-                    });
-                    that.ui[listOfselect2[i]['id']].select2("disable");
-                }else{
-                    continue;
-                }
-              
-            }
-
-
-            if (listOfselect2[i]['fetch']) {
-                if (listOfselect2[i].collection && typeof 
that.listOfselect2[i].collection === "object") {
-                    that.listOfselect2[i]['collectionFetchLov'] = 
that.listOfselect2[i].collection
-                } else if (listOfselect2[i].collection && typeof 
that.listOfselect2[i].collection === "string") {
-                    that.listOfselect2[i]['collectionFetchLov'] = 
that[listOfselect2[i]['collection']]
-                }
-
-            }
-            
-         }
-
-        _.each(that.listOfselect2, function(obj, i) {
-            if(obj['collectionFetchLov']){
-                   that.listenTo(obj['collectionFetchLov'], "reset", 
function(collection, response, options) {
-                    if (obj['collectionHasCode']) {
-                        for (var i = 0; i < collection.models.length; i++) {
-                            $.extend(collection.models[i].attributes, {
-                                id: 
collection.models[i].get(obj['collectionHasCode'])
-                            })
-                        }
-                    }
-                var allowClearFlag = false;
-                if(!obj['mandatory'])allowClearFlag = true
-                var data = _.pluck(collection.models, 'attributes');
-                that.ui[obj['id']].select2({
-                    placeholder: obj['placeholder'],
-                    width: '100%',
-                    data: {
-                        results: data,
-                        text: obj['dataText']
-                    },
-                    allowClear: allowClearFlag,
-                    formatSelection: function(item) {
-                        return item[obj['dataText']];
-                    },
-                    formatResult: function(item) {
-                        return item[obj['dataText']];
-                    }
-                });
-                if(!obj['disabled']){
-                    that.ui[obj['id']].select2("enable");
-                }
-                
-                if (that.model && !that.model.isNew()) {
-                    that.ui[obj['id']].select2('val', 
that.model.get(obj['modelAttr'])).trigger('change');
-                }
-            }, that);
-                 if(obj['nonCrud']){
-                    obj['nonCrud'](that.ui[obj['id']]);
-                }else{
-                    obj['collectionFetchLov'].fetch({reset:true});
-                }
-                
-            }
-        });
-    },
-
-    /* This Method for handling graph unit.
-        which seperate number from the string and again append to
-        the string by formatting it
-    
-    */
-    Utils.graphUnitParse = function(unitVal){
-        if(! unitVal){
-            return "";
-        }
-        var pattern = /(\d)\s+(?=\d)/g;
-        var number = unitVal.match(/\d+/g).map(Number);
-        var numString = number.toString().replace(pattern , '$1');
-        var str = unitVal.replace(/\d+/g, '').replace(/\+/g,'');
-        return numString +" " + Utils.getCamelCase(str) + "(s) gap";
-    },
-
-    Utils.getCamelCase = function(str){
-        if(!str){
-            return "";
-        }
-        var str = str.toLowerCase();
-        return str.replace(/(?:^|\s)\w/g, function(match) {
-            return match.toUpperCase()
-        });
-    },
-    Utils.manipulateValueForAddingAstrik = function(str){
-        if(!str){
-            return "";
-        }
-        var string = ((str.lastIndexOf('*',0) === 0)) ? str : '*'+str;
-        string = ((str.lastIndexOf('*', str.length - 1) === str.length - 1)) ? 
 string : string+'*';
-        
-        return string;
-    };
-    
-    return Utils;
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/ViewUtils.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/ViewUtils.js
 
b/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/ViewUtils.js
deleted file mode 100644
index 9934572..0000000
--- 
a/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/ViewUtils.js
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-define(['require',
-  'utils/Utils',
-  'moment',
-  'collections/VNameValueList',
-  'utils/Globals'
-], function (require, Utils, moment, VNameValueList, Globals) {
-  'use strict';
-
-  var ViewUtil = {};
-
-  ViewUtil.setdefaultParams = function () {
-    var fromSolr, toSolr, that = this;
-    var params = Utils.getQueryParams(window.location.search);
-    this.defaultParams = {
-      q: "*:*",
-      from: 
moment().hours("00").minutes("00").seconds("00").milliseconds("000").toJSON(),
-      to: 
moment().hours("23").minutes("59").seconds("59").milliseconds("999").toJSON(),
-      unit: "+1HOUR",
-      level: "FATAL,ERROR,WARN"
-    };
-    var 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();
-          }
-        }
-      }
-    }
-    if (params.bundle_id && !params.start_time && !params.end_time) {
-      var collection = new VNameValueList();
-
-      collection.url = Globals.baseURL + "service/logs/boundarydates";
-      collection.modelAttrName = "vNameValues";
-      _.extend(collection.queryParams, {
-        "bundle_id": params.bundle_id
-      });
-      collection.fetch({
-        reset: true,
-        async: false,
-        success: function (data) {
-          collection.each(function (model) {
-            if (model.get('name') == "From") {
-              fromSolr = moment(parseInt(model.get('value'))).toJSON();
-            }
-            if (model.get('name') == "To") {
-              toSolr = moment(parseInt(model.get('value'))).toJSON();
-            }
-            if (fromSolr && toSolr) {
-              that.defaultParams['dateRangeLabel'] = "Custom Range";
-            }
-          })
-
-        }
-      });
-    }
-    if (params.bundle_id) {
-      this.defaultParams['bundle_id'] = params.bundle_id;
-    }
-    if (params.start_time) {
-      var startDateString = applyParamsDate(params.start_time);
-    }
-    if (params.end_time) {
-      var endDateString = applyParamsDate(params.end_time);
-    }
-    if (params.host_name) {
-      this.defaultParams['host_name'] = params.host_name;
-    }
-    if (params.component_name) {
-      this.defaultParams['component_name'] = params.component_name;
-    }
-    if (params.file_name) {
-      this.defaultParams['file_name'] = params.file_name;
-    }
-    if (startDateString && endDateString) {
-      if (params.timezone) {
-        var timeZoneObject = worldMapTime.getTimeZoneObject(params.timezone)
-        if (timeZoneObject.length) {
-          var timeZoneName = timeZoneObject[0].timezone
-        }
-        if (timeZoneName) {
-          var startEncodeDate = params.start_time.replace(",", ".")
-          var endEncodeDate = params.end_time.replace(",", ".")
-          startDateString = moment.tz(startEncodeDate, timeZoneName).toJSON();
-          endDateString = moment.tz(endEncodeDate, timeZoneName).toJSON();
-          var timeZoneString = timeZoneName + "," + timeZoneObject[0].zoneName 
+ "," + timeZoneObject.length;
-          Utils.localStorage.setLocalStorage('timezone', timeZoneString);
-          moment.tz.setDefault(timeZoneName);
-        }
-      }
-      this.defaultParams['end_time'] = endDateString
-      this.defaultParams['start_time'] = startDateString;
-      this.defaultParams['from'] = startDateString;
-      this.defaultParams['to'] = endDateString;
-      this.defaultParams['dateRangeLabel'] = "Custom Range";
-    }
-    if (fromSolr && toSolr) {
-      this.defaultParams['from'] = fromSolr;
-      this.defaultParams['to'] = toSolr;
-      this.defaultParams['dateRangeLabel'] = "Custom Range";
-    }
-  }
-  ViewUtil.getDefaultParams = function () {
-    return $.extend(true, {}, this.defaultParams);
-  }
-  ViewUtil.getCountDistributionHTML = function (node) {
-    if (!node.logLevelCount)
-      return "";
-    return '<div data-node = "' + node.name + '" class="nodebar">' + 
ViewUtil.getLevelDistributionHTML(node) + '</div>';
-  };
-  ViewUtil.getLevelDistributionHTML = function (node) {
-    var html = "";
-    if (!_.isUndefined(node.logLevelCount) && !_.isArray(node.logLevelCount))
-      node.logLevelCount = [node.logLevelCount];
-    var toPct = ViewUtil.calculatePercentge(node.logLevelCount);
-    _.each(node.logLevelCount, function (data) {
-      //html += '<div class="node '+data.name+'" 
style="width:'+toPct(data)+'%;" data-toggle="tooltip" title="'+data.value+'" 
data-original-title="'+data.value+'"></div>';
-      html += '<div class="node ' + data.name + '" style="width:' + 
toPct(data) + '%;"></div>';
-    });
-    return html;
-  };
-  ViewUtil.calculatePercentge = function (values) {
-    var sum = 0;
-    for (var i = 0; i != values.length; ++i) {
-      sum = sum + parseInt(values[i].value, 10);
-    }
-    var scale = 100 / sum;
-    return function (x) {
-      return (parseInt(x.value, 10) * scale) /*.toFixed(5)*/;
-    };
-  };
-
-  ViewUtil.getDefaultParamsForHierarchy = function () {
-    return ViewUtil.getDefaultParams();
-  };
-
-  ViewUtil.setLatestTimeParams = function (params) {
-    if (params && params.dateRangeLabel) {
-      var arr = 
Utils.dateUtil.getRelativeDateFromString(params.dateRangeLabel);
-      if (_.isArray(arr)) {
-        params.from = arr[0].toJSON();
-        params.to = arr[1].toJSON();
-      }
-      ;
-    }
-
-  };
-
-  ViewUtil.foramtLogMessageAsLogFile = function (model, logMessageHtmlClass) {
-    var attrs = model.attributes;
-    var str = "";
-    if (attrs.logtime)
-      str += moment(attrs.logtime).format("YYYY-MM-DD HH:mm:ss,SSS") + " ";
-    if (attrs.level)
-      str += "<span class='" + ("" + attrs.level).toUpperCase() + "'>" + ("" + 
attrs.level).toUpperCase() + "</span> ";
-    if (attrs.thread_name)
-      str += $.trim(attrs.thread_name) + " ";
-    if (attrs.logger_name)
-      str += $.trim(attrs.logger_name) + " ";
-    if (attrs.file && attrs.line_number)
-      str += attrs.file + ":" + attrs.line_number + " ";
-    if (attrs.log_message)
-      str += "<span class='" + (logMessageHtmlClass ? logMessageHtmlClass : 
"logMessage") + "'>- " + Utils.escapeHtmlChar(attrs.log_message) + " </span>";
-    return str;
-  }
-
-  ViewUtil.scrollToElement = function (top, speed) {
-    if (!top)
-      return;
-    $("html, body").animate({scrollTop: (top - 200)}, (speed) ? speed : 300);
-  };
-
-  ViewUtil.formatAuditGraphData = function (collection) {
-    var mainObj = [], len = 0, that = this;
-    collection.each(function (m, index) {
-      var userName = m.get("name");
-      if (len < userName.length)
-        len = userName.length;
-      var compo = m.get("dataCount");
-      for (var i = 0; i < compo.length; i++) {
-        var b = {label: userName, value: parseInt(compo[i].value, 10)}
-        var ret = _.findWhere(mainObj, {key: compo[i].name});
-        if (ret) {
-          ret.values.push(b);
-        } else {
-          mainObj.push({
-            key: compo[i].name,
-            values: [b],
-            color: Utils.getRandomColor(compo[i].name)
-          });
-        }
-      }
-    });
-    return {
-      max: len,
-      arr: mainObj
-    }
-  };
-
-  /**
-   * Generate sorted named schema field list for service/audit logs
-   * @param data Response data
-   * @param fieldMappings Solr field - UI field mapping
-   * @param excludes Array of fields that needs to be filtered out on UI
-   * @returns sorted schema field list (human readable format)
-   */
-  ViewUtil.getLogSchemaFields = function(data, fieldMappings, excludes) {
-    var jsonData = {};
-    for (var key in data) {
-      if ($.inArray(key.toString(), excludes) == -1) {
-        if (fieldMappings.hasOwnProperty(key)) {
-          jsonData[key] = fieldMappings[key];
-        } else {
-          jsonData[key] = key;
-        }
-      }
-    }
-    return _.sortBy(jsonData, function(k, v){return k});
-  };
-
-
-  ViewUtil.replaceColumnNamesWithKeys = function (collection, nameKeyMap, 
addingAstrik) {
-    var result = [];
-    collection.each(function (m) {
-      var data = {};
-      var value = addingAstrik == true ? 
Utils.manipulateValueForAddingAstrik(m.get("value")) : m.get("value");
-      if (nameKeyMap[m.get("category")] === undefined) {
-        data[m.get("category")] = m.get("value");
-      } else {
-        data[nameKeyMap[m.get("category")]] = m.get("value");
-      }
-      result.push(data);
-    });
-    return result;
-  };
-
-  return ViewUtil;
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/XATemplateHelpers.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/XATemplateHelpers.js
 
b/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/XATemplateHelpers.js
deleted file mode 100644
index f595eff..0000000
--- 
a/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/utils/XATemplateHelpers.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- 
-       /*
-        * General guidelines while writing helpers:
-        * 
-        * - If returning HTML use return new Handlebars.SafeString();
-        * - If the helper needs optional arguments use the "hash arguments"
-        *   Eg. {{{link . "See more..." story.url class="story"}}}
-        *   NOTE: the first argument after the helper name should be . which 
will be context in the helper function
-        *   Handlebars.registerHelper('link', function(context, text, url, 
options) {
-        *      var attrs = [];
-        *              
-        *      for(var prop in options.hash) {
-        *              attrs.push(prop + '="' + options.hash[prop] + '"');
-        *      }       
-        *      return new Handlebars.SafeString("<a " + attrs.join(" ") + ">" 
+ text + "</a>");
-        *   });
-        * 
-        * 
-        * NOTE: Due to some limitations in the require-handlebars-plugin, we 
cannot have helper that takes zero arguments,
-        *       for such helpers we have to pass a "." as first argument. 
[https://github.com/SlexAxton/require-handlebars-plugin/issues/72] 
-        */
-       
-
-define(['require','Handlebars'],function(require,Handlebars){
-
-       var HHelpers = {};
-       
-       /**
-     * Convert new line (\n\r) to <br>
-     * from http://phpjs.org/functions/nl2br:480
-     */
-       Handlebars.registerHelper('nl2br', function(text) {
-        text = Handlebars.XAUtils.escapeExpression(text);
-        var nl2br = (text + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' 
+ '<br>' + '$2');
-        return new Handlebars.SafeString(nl2br);
-    });
-       
-       /*
-        * escapeHtmlChar
-        */
-       Handlebars.registerHelper("escapeHtmlChar", function(str) {
-               return Util.escapeHtmlChar(str);
-       });
-       
-       Handlebars.registerHelper("nl2brAndEscapeHtmlChar", function(str) {
-               return Util.nl2brAndEscapeHtmlChar(str);
-       });
-       
-       /*
-        * required to fetch label for enum value
-        */ 
-       Handlebars.registerHelper('convertEnumValueToLabel', function(enumName, 
enumValue) {
-               return Util.enumValueToLabel( Util.getEnum(enumName), 
enumValue);
-       });
-       
-       /*
-        * Truncate the String till n positions
-        */
-       Handlebars.registerHelper('truncStr', function(str, n, useWordBoundary) 
{
-               var len = n || 1;
-               var useWordBn = useWordBoundary || false;
-               return str.trunc(len, useWordBn);
-       });
-       
-       /*Handlebars.registerHelper('tt', function(str) {
-               return localization.tt(str);
-       });*/
-       
-       Handlebars.registerHelper('getCopyrightDate', function() {
-               return new Date().getFullYear().toString();
-       });
-       
-       Handlebars.registerHelper('if_eq', function(context, options) {
-               if (context == options.hash.compare)
-                       return options.fn(this);
-               return options.inverse(this);
-       });
-
-       Handlebars.registerHelper('if_gt', function(context, options) {
-               if (context > options.hash.compare)
-                       return options.fn(this);
-               return options.inverse(this);
-       });
-
-       Handlebars.registerHelper('ifCond', function (v1, operator, v2, 
options) {
-               switch (operator) {
-                       case '==':
-                               return (v1 == v2) ? options.fn(this) : 
options.inverse(this);
-                       break;
-                       case '===':
-                               return (v1 === v2) ? options.fn(this) : 
options.inverse(this);
-                       break;
-                       case '<':
-                               return (v1 < v2) ? options.fn(this) : 
options.inverse(this);
-                       break;
-                       case '<=':
-                               return (v1 <= v2) ? options.fn(this) : 
options.inverse(this);
-                       break;
-                       case '>':
-                               return (v1 > v2) ? options.fn(this) : 
options.inverse(this);
-                       break;
-                       case '>=':
-                               return (v1 >= v2) ? options.fn(this) : 
options.inverse(this);
-                       break;
-                       default:
-                               return options.inverse(this);     
-                       break;
-               }
-               //return options.inverse(this);
-       });
-
-
-    /**
-     * This helper provides a for i in range loop
-     *
-     * start and end parameters have to be integers >= 0 or their string 
representation. start should be <= end.
-     * In all other cases, the block is not rendered.
-     * Usage:
-     *        <ul>
-     *            {{#for 0 10}}
-     *                <li>{{this}}</li>
-     *            {{/for}}
-     *        </ul>
-     */
-    Handlebars.registerHelper('for', function(start, end, options) {
-        var fn = options.fn, inverse = options.inverse;
-        var isStartValid = (start != undefined && !isNaN(parseInt(start)) && 
start >= 0);
-        var isEndValid = (end != undefined && !isNaN(parseInt(end)) && end >= 
0);
-        var ret = "";
-
-        if (isStartValid && isEndValid && parseInt(start) <= parseInt(end)) {
-            for (var i = start; i <= end; i++) {
-                ret = ret + fn(i);
-            }
-        } else {
-            ret = inverse(this);
-        }
-
-        return ret;
-    });
-
-       Handlebars.registerHelper('dateFormat', function(context, block) {
-               if (window.moment) {
-                       var f = block.hash.format || "MMM Do, YYYY";
-                       return moment(Date(context)).format(f);
-               }else{
-                       return context;   //  moment plugin not available. 
return data as is.
-               };
-       });
-       return HHelpers;
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/02360dd5/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
 
b/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
deleted file mode 100644
index 0822051..0000000
--- 
a/ambari-logsearch/ambari-logsearch-web/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
+++ /dev/null
@@ -1,416 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations 
under
- * the License.
- */
-
-define(['require',
-       'backbone',
-       'utils/Globals',
-       'utils/Utils',
-       'utils/ViewUtils',
-       'collections/VNameValueList',
-    'moment',
-       'hbs!tmpl/audit/AuditAggregatedView_tmpl',
-    'views/common/JBDialog',
-    'views/tabs/ExportLogFileView',
-       'select2',
-       'nv'
-],function(require,Backbone,Globals,Utils,ViewUtils,VNameValueList,moment,AuditAggregatedTmpl,JBDialog,ExportLogFileView){
-    'use strict';
-
-       return Backbone.Marionette.Layout.extend(
-       /** @lends LogLevelView */
-       {
-               _viewName : 'AuditAggregatedView',
-
-               template: AuditAggregatedTmpl,
-
-               /** Layout sub regions */
-               regions: {
-                       RtableUsers : "[data-id='topUsers']",
-                       RtableResources : "[data-id='topResources']"
-               },
-
-               /** ui selector cache */
-               ui: {
-                       tableView: "[data-id='aggregatedTable']",
-                       graphView:"[data-id='aggregatedGraph']"
-               },
-
-               /** ui events hash */
-               events: function() {
-                       var events = {};
-                       events['change [data-id="toggleTableAccessLog"]']  = 
'onToggleTableAggregated';
-                       events['click [data-id="export-aggregated-text"]']  = 
'onExportAggregatedClick';
-                       return events;
-               },
-
-               /**
-                * intialize a new LogLevelView Layout
-                * 
-                * @constructs
-                */
-               initialize: function(options) {
-                       _.extend(this, _.pick(options,'vent', 'globalVent', 
'params'));
-                       this.initializeCollection();
-                       this.bindEvents();
-                       this.initializeAggregatedTable();
-               },
-               bindEvents : function(){
-                       this.listenTo(this.vent,"search:audit:query 
auditComponents:include auditComponents:exclude "+
-                                       "search:audit:include 
search:audit:exclude logtime:filter tab:refresh",function(value){
-                               this.fetchTopUsers(value);
-                               this.fetchTopResources(value);
-            },this);
-                       this.listenTo(this.topUsers,"reset",function(){
-                               this.createUsersTable();
-                               this.renderGraphUsers();
-                       },this);
-                       this.listenTo(this.topResources,"reset",function(){
-                               this.createResourceTable();
-                               this.renderGraphResources();
-                       },this);
-                       
this.listenTo(this.vent,"reinitialize:TopTenGraph",function(value){
-                               this.fetchTopUsers(value);
-                               this.fetchTopResources(value);
-            },this);
-            this.listenTo(this,"button:min:max",function(){
-               this.renderGraphUsers();
-               this.renderGraphResources();
-            },this);
-               },
-               initializeCollection : function(){
-                       this.topUsers = new VNameValueList([],{
-                               state: {
-                    firstPage: 0,
-                    pageSize: 9999
-                }
-                       });
-                       this.topUsers.url = Globals.baseURL + 
"audit/logs/resources/10";
-                       this.topUsers.modelAttrName = "graphData";
-                       this.topResources = new VNameValueList([],{
-                               state: {
-                    firstPage: 0,
-                    pageSize: 9999
-                }
-                       });
-                       this.topResources.url = Globals.baseURL + 
"audit/logs/resources/10";
-                       this.topResources.modelAttrName = "graphData";          
-                       //initialize colors
-                       this.colors = (new 
d3.scale.category20c().range().slice().reverse()).concat(new 
d3.scale.category20b().range().slice().reverse());
-               },
-               onRender : function(){
-                       //this.renderTables();
-                       this.fetchTopUsers(_.extend({field : 
"reqUser"},this.params));
-                       this.fetchTopResources(_.extend({field : 
"resource"},this.params));
-               },
-               renderTables : function(){
-                       var that = this;
-                       var opts = {
-                                       includeFilter : false,
-                                       includePagination : false,
-                                       includePageSize : false,
-                                       includeFooterRecords : false,
-                                       includeColumnManager : false,
-                                       columnOpts : {
-                                       initialColumnsVisible: 0,
-                                       saveState : false
-                                       },
-                                       gridOpts : {
-                                               className : "table m-table 
table-bordered table-hover table-heading",
-                                               emptyText : 'No records found!'
-                                       },
-                                       filterOpts : {},
-                                       paginatorOpts : {}
-                       }
-                       var cols = {
-                               name : {
-                                       label : "User",
-                                       cell: "String",
-                                       sortType: false,
-                                       editable: false,
-                                       sortable : false,
-                               },
-                               value : {
-                                       label : "Hits",
-                                       cell: "String",
-                                       sortType: false,
-                                       sortable : false,
-                                       editable: false
-                               }
-                       };
-                       require(['views/common/TableLayout'], 
function(TableLayout){
-                               var userCols = new 
Backgrid.Columns(that.topUsers.constructor.getTableCols(cols, that.topUsers));
-                               that.RTopUsers.show(new 
TableLayout(_.extend({},opts,{
-                                       columns: userCols,
-                                       collection: that.topUsers,
-                               })));
-                               cols.name.label = "Resources";
-                               var resourcesCols = new 
Backgrid.Columns(that.topResources.constructor.getTableCols(cols, 
that.topResources));
-                               that.RTopResources.show(new 
TableLayout(_.extend({},opts,{
-                                       columns: resourcesCols,
-                                       collection: that.topResources,
-                               })));
-                       });
-               },
-               fetchTopResources : function(params){
-                       var that = this;
-                       $.extend(this.topResources.queryParams, params);
-                       this.topResources.fetch({
-                               reset:true,
-                               beforeSend : function(){
-                                       
that.$("[data-id='resourcesLoader']").removeClass("hidden");
-                               },
-                               complete : function(){
-                                       
that.$("[data-id='resourcesLoader']").addClass("hidden");
-                               }
-                       });
-               },
-               fetchTopUsers : function(params){
-                       var that = this;
-                       $.extend(this.topUsers.queryParams, params);
-                       this.topUsers.fetch({
-                               reset:true,
-                               beforeSend : function(){
-                                       
that.$("[data-id='usersLoader']").removeClass("hidden");
-                               },
-                               complete : function(){
-                                       
that.$("[data-id='usersLoader']").addClass("hidden");
-                               }
-                       });
-               },
-               renderHorizontalBar : function(el,data,margin,columnKey){
-                       var that = this;
-                       nv.addGraph({generate : function() {
-                                 var chart = 
nv.models.multiBarHorizontalChart()
-                                     .x(function(d) { return d.label })
-                                     .y(function(d) { return d.value })
-                                     .margin(margin)
-                                     .showValues(true)
-                                     .valueFormat(d3.format('.0f'))
-                                     .showControls(false);
-                                 chart.tooltip.enabled();
-                                 chart.yAxis
-                                     .tickFormat(d3.format('d'));
-                                 chart.multibar.dispatch.on("elementClick", 
function(e) {
-                                         
that.vent.trigger("toggle:facet",{viewName : "includeColumns",key 
:columnKey,value :e.data.label});
-                                 });
-                                 d3.select(el)
-                                 .datum(data)
-                                   .transition().duration(500)
-                                     .call(chart);
-                                 return chart;
-                       },
-                       callback : function(graph){
-                               d3.select(el)
-                                       .selectAll("rect")
-                                       .style("cursor","pointer");
-                               that.$el.resize(function(){
-                    d3.select(el)
-//                        .attr('width', width)
-//                        .attr('height', height)
-                        .transition().duration(0)
-                        .call(graph);
-                               });
-                       }
-                       });
-               },
-               renderGraphUsers : function(){
-//                     var d= [{
-//                             "key": "Top Ten Users",
-//                             "color": "#4281DA",          
-//                     }];
-                       var obj = this.formatBarData(this.topUsers);
-                       //d[0].values = obj.arr;
-                       
this.renderHorizontalBar(this.$('[data-id="topUsersGraph"] svg')[0],obj.arr, 
{top: 5,right:10, bottom: 20,left:(obj.max * 7)+25},"reqUser");
-               },
-               renderGraphResources : function(){
-//                     var d= [{
-//                             "key": "Top Ten Res     ources",
-//                             "color": "#C7504B",          
-//                     }];
-                       var obj = this.formatBarData(this.topResources);
-                       //d[0].values = obj.arr;
-                       var marginleft = obj.max * 7;
-                       
this.renderHorizontalBar(this.$('[data-id="topResourcesGraph"] 
svg')[0],obj.arr, {top: 5,right:10, bottom: 20,left:(marginleft > 300) ? 300 : 
marginleft },"resource");
-               },
-               formatBarData : function(collection){
-//                     var obj=[],len=0;
-//                     collection.each(function(m){
-//                             var val = parseInt(m.get("value"),10)
-//                             if(len < m.get("name").length )
-//                                     len = m.get("name").length;
-//                             obj.push({
-//                                     label : m.get("name"),
-//                                     value : (_.isNaN(val)) ? 0 : val
-//                             });
-//                     });
-//                     return {
-//                             max : len,
-//                             arr : obj
-//                     }
-                       return ViewUtils.formatAuditGraphData(collection);
-               },
-
-               onToggleTableAggregated: function(e){
-                       if(e.target.checked){
-                               
this.ui.tableView.addClass("showContent").removeClass('hideContent');
-                               
this.ui.graphView.addClass("hideContent").removeClass('showContent');
-                       } else{
-                               
this.ui.tableView.addClass("hideContent").removeClass('showContent');
-                               
this.ui.graphView.addClass("showContent").removeClass('hideContent');
-                       }
-               },
-               initializeAggregatedTable: function(){
-                       var that = this;
-                       that.opts = {
-                                       includeFilter : false,
-                                       includePagination : false,
-                                       includePageSize : false,
-                                       includeFooterRecords : false,
-                                       includeColumnManager : false,
-                                       columnOpts : {
-                                       initialColumnsVisible: 0,
-                                       saveState : false
-                                       },
-                                       gridOpts : {
-                                               className : "table m-table 
table-bordered table-hover table-heading",
-                                               emptyText : 'No records found!'
-                                       },
-                                       filterOpts : {},
-                                       paginatorOpts : {}
-                       }
-                       that.cols = {
-                               name : {
-                                       label : "User",
-                                       cell: "String",
-                                       sortType: false,
-                                       editable: false,
-                                       sortable : false,
-                               },
-                               dataCount : {
-                                       label : "Components/Access",
-                                       cell: "html",
-                                       sortType: false,
-                                       editable: false,
-                                       sortable : false,
-                                       formatter: _.extend({}, 
Backgrid.CellFormatter.prototype, {
-                                               fromRaw: function(rawValue, 
model){
-                                                       var str = "<table 
class='m-table'>";
-                                                       
_.each(model.get('dataCount'),function(obj){
-                                                               str 
+="<tr><td>"+obj.name+"</td><td>"+obj.value+"</td></tr>"
-                                                       });
-                                                       return str + "</table>";
-                                               }
-                                       })
-                               },
-                       /*      value : {
-                                       label : "Access",
-                                       cell: "html",
-                                       sortType: false,
-                                       editable: false,
-                                       sortable : false,
-                                       formatter: _.extend({}, 
Backgrid.CellFormatter.prototype, {
-                                               fromRaw: function(rawValue, 
model){
-                                                       var str="";
-                                                       
_.each(model.get('dataCount'),function(obj){
-                                                               str = obj.value;
-                                                       });
-                                                       return str;
-                                               }
-                                       })
-                               },*/
-                       };
-                       
-               },
-
-               createUsersTable:function(){
-                       var that = this;
-                       require(['views/common/TableLayout'], 
function(TableLayout){
-                               that.cols.name.label = "Users";
-                               var userCols = new 
Backgrid.Columns(that.topUsers.constructor.getTableCols(that.cols, 
that.topUsers));
-                               that.RtableUsers.show(new 
TableLayout(_.extend({},that.opts,{
-                                       columns: userCols,
-                                       collection: that.topUsers,
-                               })));
-                       });
-               },
-               createResourceTable:function(){
-                       var that = this;
-                       require(['views/common/TableLayout'], 
function(TableLayout){
-                       that.cols.name.label = "Resources";
-                               var resourcesCols = new 
Backgrid.Columns(that.topResources.constructor.getTableCols(that.cols, 
that.topResources));
-                               that.RtableResources.show(new 
TableLayout(_.extend({},that.opts,{
-                                       columns: resourcesCols,
-                                       collection: that.topResources,
-                               })));
-                       });
-               },
-               onExportAggregatedClick:function(){
-                               var that = this;
-                       require(['views/common/JBDialog',],function(JBDialog){
-                               var view = new 
ExportLogFileView({viewType:"aggregatView"});
-                               var opts = _.extend({
-                                       title: "Export",
-                                       content:view,
-                                       viewType: 'Update',
-                                       appendTo: 'body',
-                                       modal: true,
-                                       resizable: false,
-                                       width: 550,
-                                       height:200,
-                                       beforeClose: function(event, ui) {
-                                               that.onDialogClosed();
-                                       },
-                                       buttons: [{
-                                               id: "okBtn",
-                                               text: "Export",
-                                               "class": "btn btn-primary",
-                                               click: function() {
-                                                       
that.onDialogSubmitted();
-                                               }
-                                       }, {
-                                               id: "cancelBtn",
-                                               text: "Cancel",
-                                               "class": "btn btn-default",
-                                               click: function() {
-                                                       that.onDialogClosed();
-                                               }
-                                       }]
-                               });
-                               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;
-            }
-        },
-        onDialogSubmitted : function(){
-                       var obj = 
Utils.getFormData(this.dialog.$(".form-horizontal").serializeArray());
-                       this.downloadAggregateFile(obj);
-               },
-               downloadAggregateFile : function(obj){
-                       obj.utcOffset = moment().utcOffset();
-                       obj.startIndex =  this.topUsers.state.currentPage * 
this.topUsers.state.pageSize;
-                       var params = 
$.param(_.extend({},this.topUsers.queryParams,obj));
-                       var url = "api/v1/audit/logs/export?"+ params;
-                       window.open(url);
-                       this.onDialogClosed();
-               }
-       });
-})
\ No newline at end of file

Reply via email to