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 |
| 7 | * @version 0.1.0 |
| 8 | */ |
| 9 | |
| 10 | window.angular && (function (angular) { |
| 11 | 'use strict'; |
| 12 | |
| 13 | angular |
| 14 | .module('app.overview') |
| 15 | .controller('multiServerController', [ |
Michael Davis | 4250f30 | 2017-09-06 11:03:52 -0500 | [diff] [blame] | 16 | '$scope', |
| 17 | '$window', |
| 18 | 'APIUtils', |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 19 | 'dataService', |
| 20 | function($scope, $window, APIUtils, dataService){ |
| 21 | $scope.dataService = dataService; |
Michael Davis | 4250f30 | 2017-09-06 11:03:52 -0500 | [diff] [blame] | 22 | $scope.customSearch = ""; |
| 23 | $scope.searchTerms = []; |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 24 | $scope.loading = false; |
Michael Davis | 4250f30 | 2017-09-06 11:03:52 -0500 | [diff] [blame] | 25 | $scope.clear = function(){ |
| 26 | $scope.customSearch = ""; |
| 27 | $scope.searchTerms = []; |
| 28 | } |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 29 | |
Michael Davis | 4250f30 | 2017-09-06 11:03:52 -0500 | [diff] [blame] | 30 | $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 | }; |
Michael Davis | 0252cd7 | 2017-09-11 16:40:07 -0500 | [diff] [blame] | 52 | $scope.addServer = function(){ |
| 53 | $scope.multi_server_add = ! $scope.multi_server_add |
| 54 | } |
Iftekharul Islam | 0805441 | 2017-08-25 10:29:57 -0500 | [diff] [blame] | 55 | } |
| 56 | ] |
| 57 | ); |
| 58 | |
| 59 | })(angular); |