blob: 627108f7c7ae20acb48d98627d4fc43841173b88 [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
Iftekharul Islam08054412017-08-25 10:29:57 -05007 */
8
9window.angular && (function (angular) {
10 'use strict';
11
12 angular
13 .module('app.overview')
14 .controller('multiServerController', [
Michael Davis4250f302017-09-06 11:03:52 -050015 '$scope',
16 '$window',
17 'APIUtils',
Iftekharul Islam08054412017-08-25 10:29:57 -050018 'dataService',
19 function($scope, $window, APIUtils, dataService){
20 $scope.dataService = dataService;
Michael Davis4250f302017-09-06 11:03:52 -050021 $scope.customSearch = "";
22 $scope.searchTerms = [];
Iftekharul Islam08054412017-08-25 10:29:57 -050023 $scope.loading = false;
Michael Davis4250f302017-09-06 11:03:52 -050024 $scope.clear = function(){
25 $scope.customSearch = "";
26 $scope.searchTerms = [];
27 }
Iftekharul Islam08054412017-08-25 10:29:57 -050028
Michael Davis4250f302017-09-06 11:03:52 -050029 $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 Davis0252cd72017-09-11 16:40:07 -050051 $scope.addServer = function(){
52 $scope.multi_server_add = ! $scope.multi_server_add
53 }
Iftekharul Islam08054412017-08-25 10:29:57 -050054 }
55 ]
56 );
57
58})(angular);