Adds little timeout to analyze agents function also fix some typos

This commit is contained in:
Jesús Ángel González 2018-05-10 17:03:10 +02:00 committed by Javier Castro
parent fe84f0fe08
commit 398d048038
5 changed files with 11 additions and 10 deletions

View File

@ -16,7 +16,7 @@ import rison from 'rison'
const app = modules.get('app/wazuh', []);
app.controller('agentsController',
function ($scope, $location, $q, $rootScope, appState, genericReq, apiReq, AgentsAutoComplete, errorHandler) {
function ($timeout, $scope, $location, $q, $rootScope, appState, genericReq, apiReq, AgentsAutoComplete, errorHandler) {
$rootScope.page = 'agents';
$scope.extensions = appState.getExtensions().extensions;
@ -373,8 +373,9 @@ app.controller('agentsController',
$location.path('/manager');
};
$scope.analizeAgents = async search => {
$scope.analyzeAgents = async search => {
try {
await $timeout(200);
$scope.agentsAutoComplete.filters = [];
await $scope.agentsAutoComplete.addFilter('search',search);

View File

@ -26,7 +26,7 @@ app.controller('rulesController', function ($timeout, $scope, $rootScope, Rules,
$scope.setRulesTab('rules');
$scope.isArray = angular.isArray;
$scope.analizeRules = async search => {
$scope.analyzeRules = async search => {
try {
if(search && search.length <= 1) return $scope.rulesAutoComplete.items;
await $timeout(200);
@ -233,7 +233,7 @@ app.controller('decodersController', function ($timeout, $scope, $rootScope, $sc
}
};
$scope.analizeDecoders = async search => {
$scope.analyzeDecoders = async search => {
try {
if(search && search.length <= 1) return $scope.decodersAutoComplete.items;
await $timeout(200);

View File

@ -19,12 +19,12 @@
md-selected-item="_swpagent"
md-selected-item-change="getAgent(_swpagent.id,true)"
md-search-text="searchTerm"
md-items="agentAutoComplete in analizeAgents(searchTerm)"
md-items="agentAutoComplete in analyzeAgents(searchTerm)"
md-item-text="agentAutoComplete.name"
md-min-length="0"
md-no-asterisk="false"
md-menu-class="autocomplete-custom-agents-bar"
md-search-text-change="analizeAgents(searchTerm)"
md-search-text-change="analyzeAgents(searchTerm)"
placeholder="Search by name, ID or IP address"
lazy-load-data="agentsAutoComplete.nextPage('')">
<md-item-template>

View File

@ -2,9 +2,9 @@
<div id="content" layout="row" layout-align="start start">
<span flex layout="row" layout-align="space-between center">
<md-autocomplete flex id="Auto" class="wz-autocomplete wz-select-input wz-margin-right-16" md-input-id="autocomplete" md-select-on-match="true" md-no-cache="noCache" md-selected-item="filter"
md-selected-item-change="decoders.addFilter('search', filter.name)" md-search-text="searchTerm" md-items="decoder in analizeDecoders(searchTerm)"
md-selected-item-change="decoders.addFilter('search', filter.name)" md-search-text="searchTerm" md-items="decoder in analyzeDecoders(searchTerm)"
md-item-text="decoder.name +' '+ decoder.file" md-min-length="0" md-no-asterisk="false" md-menu-class="autocomplete-custom-agents-bar"
md-search-text-change="analizeDecoders(searchTerm)" placeholder="Search decoders..." lazy-load-data="decodersAutoComplete.nextPage()"
md-search-text-change="analyzeDecoders(searchTerm)" placeholder="Search decoders..." lazy-load-data="decodersAutoComplete.nextPage()"
md-autofocus="" wz-enter="checkEnter(searchTerm)">
<md-item-template>
<span>

View File

@ -9,12 +9,12 @@
md-selected-item="filter"
md-selected-item-change="rules.addFilter('search', filter.description)"
md-search-text="searchTerm"
md-items="rule in analizeRules(searchTerm)"
md-items="rule in analyzeRules(searchTerm)"
md-item-text="rule.file + ' - ' + rule.description"
md-min-length="0"
md-no-asterisk="false"
md-menu-class="autocomplete-custom-agents-bar"
md-search-text-change="analizeRules(searchTerm)"
md-search-text-change="analyzeRules(searchTerm)"
placeholder="Search rules..."
lazy-load-data="rulesAutoComplete.nextPage()"
md-autofocus=""