blob: 15fc66f5641f0ee45e695092a0dd49a52fe8d1c9 [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
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07009window.angular && (function(angular) {
10 'use strict';
Iftekharul Islam08054412017-08-25 10:29:57 -050011
Andrew Geisslerd27bb132018-05-24 11:07:27 -070012 angular.module('app.overview').controller('multiServerController', [
13 '$scope', '$window', 'APIUtils', 'dataService',
14 function($scope, $window, APIUtils, dataService) {
15 $scope.dataService = dataService;
16 $scope.customSearch = '';
17 $scope.searchTerms = [];
18 $scope.loading = false;
19 $scope.clear = function() {
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070020 $scope.customSearch = '';
21 $scope.searchTerms = [];
Andrew Geisslerd27bb132018-05-24 11:07:27 -070022 };
Iftekharul Islam08054412017-08-25 10:29:57 -050023
Andrew Geisslerd27bb132018-05-24 11:07:27 -070024 $scope.doSearchOnEnter = function(event) {
25 var search =
26 $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
27 if (event.keyCode === 13 && search.length >= 2) {
28 $scope.searchTerms = $scope.customSearch.split(' ');
29 } else {
30 if (search.length == 0) {
31 $scope.searchTerms = [];
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070032 }
Andrew Geisslerd27bb132018-05-24 11:07:27 -070033 }
34 };
Iftekharul Islam08054412017-08-25 10:29:57 -050035
Andrew Geisslerd27bb132018-05-24 11:07:27 -070036 $scope.doSearchOnClick = function() {
37 var search =
38 $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
39 if (search.length >= 2) {
40 $scope.searchTerms = $scope.customSearch.split(' ');
41 } else {
42 if (search.length == 0) {
43 $scope.searchTerms = [];
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070044 }
Andrew Geisslerd27bb132018-05-24 11:07:27 -070045 }
46 };
47 $scope.addServer = function() {
48 $scope.multi_server_add = !$scope.multi_server_add;
49 };
50 }
51 ]);
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070052})(angular);