Add event log search and filter capabilities
Change-Id: I9dc891e0f1e30abe488d401c57e1cf4f5656c3af
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/app/common/directives/log-search-control.js b/app/common/directives/log-search-control.js
new file mode 100644
index 0000000..1fa268c
--- /dev/null
+++ b/app/common/directives/log-search-control.js
@@ -0,0 +1,39 @@
+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);