Skip to content
Snippets Groups Projects
Select Git revision
  • d1267ba2f812e518d1bcbbf7dc74097bc2baef98
  • master default protected
  • no_scala_DSL
3 results

search.js

Blame
  • search.js 1.02 KiB
    angular.module('searchApp', []).controller('SearchController',
      [ '$scope', '$http', function($scope, $http) {
        $scope.columns =
          { id : false
          , errLevel : true
          , errType : false
          , fileName : true
          , shortMsg : true
          , longMsg : false };
        $scope.colProps = [];
          for (k in $scope.columns) if (k != 'id') { $scope.colProps.push(k)} ;
        $scope.field = 'shortMsg';
        $scope.results = [];
        $scope.number = 0;
        $scope.maxNumber = 100;
        $scope.searchText = '';
        $scope.query = function () { return '/' + $scope.field +
            '?limit=' + $scope.maxNumber +
            '&text=' + $scope.searchText;
            };
        $scope.search = function() {
          if ($scope.searchText) {
            $http.get('search' + $scope.query()).success(function(data) {
              $scope.results = data;
            });
          };
          $scope.count();
        };
        $scope.count = function() {
            $http.get('count' + $scope.query()).success(function(data) {
              $scope.number = data[0].count;
            });
        };
      } ]);