Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Controller for index |
| 3 | * |
| 4 | * @module app/multi-server |
| 5 | * @exports multiServerController |
| 6 | * @name multiServerController |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | window.angular && (function (angular) { |
| 10 | 'use strict'; |
| 11 | |
| 12 | angular |
| 13 | .module('app.overview') |
| 14 | .controller('multiServerController', [ |
Michael Davis | 4250f30 | 2017-09-06 11:03:52 -0500 | [diff] [blame] | 15 | '$scope', |
| 16 | '$window', |
| 17 | 'APIUtils', |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 18 | 'dataService', |
| 19 | function($scope, $window, APIUtils, dataService){ |
| 20 | $scope.dataService = dataService; |
Michael Davis | 4250f30 | 2017-09-06 11:03:52 -0500 | [diff] [blame] | 21 | $scope.customSearch = ""; |
| 22 | $scope.searchTerms = []; |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 23 | $scope.loading = false; |
Michael Davis | 4250f30 | 2017-09-06 11:03:52 -0500 | [diff] [blame] | 24 | $scope.clear = function(){ |
| 25 | $scope.customSearch = ""; |
| 26 | $scope.searchTerms = []; |
| 27 | } |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 28 | |
Michael Davis | 4250f30 | 2017-09-06 11:03:52 -0500 | [diff] [blame] | 29 | $scope.doSearchOnEnter = function (event) { |
| 30 | var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,''); |
| 31 | if (event.keyCode === 13 && |
| 32 | search.length >= 2) { |
| 33 | $scope.searchTerms = $scope.customSearch.split(" "); |
| 34 | }else{ |
| 35 | if(search.length == 0){ |
| 36 | $scope.searchTerms = []; |
| 37 | } |
| 38 | } |
| 39 | }; |
| 40 | |
| 41 | $scope.doSearchOnClick = function() { |
| 42 | var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,''); |
| 43 | if (search.length >= 2) { |
| 44 | $scope.searchTerms = $scope.customSearch.split(" "); |
| 45 | }else{ |
| 46 | if(search.length == 0){ |
| 47 | $scope.searchTerms = []; |
| 48 | } |
| 49 | } |
| 50 | }; |
Michael Davis | 0252cd7 | 2017-09-11 16:40:07 -0500 | [diff] [blame] | 51 | $scope.addServer = function(){ |
| 52 | $scope.multi_server_add = ! $scope.multi_server_add |
| 53 | } |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 54 | } |
| 55 | ] |
| 56 | ); |
| 57 | |
| 58 | })(angular); |