window.angular && (function (angular) {
    'use strict';

    angular
        .module('app.common.directives')
        .directive('logSearchControl', ['APIUtils', function (APIUtils) {
            return {
                'restrict': 'E',
                'templateUrl': 'common/directives/log-search-control.html',
                'controller': ['$rootScope', '$scope','dataService', '$location', function($rootScope, $scope, dataService, $location){
                    $scope.dataService = dataService;
                    $scope.doSearchOnEnter = function (event) {
                        var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
                        if (event.keyCode === 13 &&
                            search.length >= 2) {
                            $scope.clearSearchItem();
                            $scope.addSearchItem(search);
                        }else{
                            if(search.length == 0){
                                $scope.clearSearchItem();
                            }
                        }
                    };

                    $scope.doSearchOnClick = function() {
                        var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
                        if (search.length >= 2) {
                            $scope.clearSearchItem();
                            $scope.addSearchItem(search);
                        }else{
                            if(search.length == 0){
                                $scope.clearSearchItem();
                            }
                        }
                    }
                }]
            };
        }]);
})(window.angular);
