blob: 6bd878310c8298ae9f94bc06dcff1eb53fa701b7 [file] [log] [blame]
Iftekharul Islam08054412017-08-25 10:29:57 -05001/**
2 * Controller for index
3 *
4 * @module app/multi-server
5 * @exports multiServerController
6 * @name multiServerController
7 * @version 0.1.0
8 */
9
10window.angular && (function (angular) {
11 'use strict';
12
13 angular
14 .module('app.overview')
15 .controller('multiServerController', [
Michael Davis4250f302017-09-06 11:03:52 -050016 '$scope',
17 '$window',
18 'APIUtils',
Iftekharul Islam08054412017-08-25 10:29:57 -050019 'dataService',
20 function($scope, $window, APIUtils, dataService){
21 $scope.dataService = dataService;
Michael Davis4250f302017-09-06 11:03:52 -050022 $scope.customSearch = "";
23 $scope.searchTerms = [];
Iftekharul Islam08054412017-08-25 10:29:57 -050024 $scope.loading = false;
Michael Davis4250f302017-09-06 11:03:52 -050025 $scope.clear = function(){
26 $scope.customSearch = "";
27 $scope.searchTerms = [];
28 }
Iftekharul Islam08054412017-08-25 10:29:57 -050029
Michael Davis4250f302017-09-06 11:03:52 -050030 $scope.doSearchOnEnter = function (event) {
31 var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
32 if (event.keyCode === 13 &&
33 search.length >= 2) {
34 $scope.searchTerms = $scope.customSearch.split(" ");
35 }else{
36 if(search.length == 0){
37 $scope.searchTerms = [];
38 }
39 }
40 };
41
42 $scope.doSearchOnClick = function() {
43 var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
44 if (search.length >= 2) {
45 $scope.searchTerms = $scope.customSearch.split(" ");
46 }else{
47 if(search.length == 0){
48 $scope.searchTerms = [];
49 }
50 }
51 };
Iftekharul Islam08054412017-08-25 10:29:57 -050052 }
53 ]
54 );
55
56})(angular);