Revert "Clear search box when selected node changes"

This reverts commit 3b4f40c473.
This commit is contained in:
Jesús Ángel 2018-10-24 13:19:13 +02:00
parent 3b4f40c473
commit 2047ac7cf2
2 changed files with 9 additions and 12 deletions

View File

@ -11,7 +11,7 @@
*/ */
import { uiModules } from 'ui/modules'; import { uiModules } from 'ui/modules';
import * as FileSaver from '../../services/file-saver'; import * as FileSaver from '../../services/file-saver';
import $ from 'jquery';
const app = uiModules.get('app/wazuh', []); const app = uiModules.get('app/wazuh', []);
class Logs { class Logs {
@ -25,7 +25,6 @@ class Logs {
this.$scope.nodeList = false; this.$scope.nodeList = false;
this.$scope.type_log = 'all'; this.$scope.type_log = 'all';
this.$scope.category = 'all'; this.$scope.category = 'all';
this.$scope.custom_search = '';
} }
/** /**
@ -45,8 +44,8 @@ class Logs {
* Event handler for the search bar. * Event handler for the search bar.
* @param {string} term Term(s) to be searched * @param {string} term Term(s) to be searched
*/ */
search() { search(term) {
this.$scope.$broadcast('wazuhSearch', { term: this.$scope.custom_search }); this.$scope.$broadcast('wazuhSearch', { term });
} }
/** /**
@ -100,8 +99,6 @@ class Logs {
async changeNode(node) { async changeNode(node) {
try { try {
this.$scope.custom_search = '';
$('#logsSearchBar').val('')
this.$scope.type_log = 'all'; this.$scope.type_log = 'all';
this.$scope.category = 'all'; this.$scope.category = 'all';
this.$scope.selectedNode = node; this.$scope.selectedNode = node;
@ -113,10 +110,10 @@ class Logs {
) )
const daemons = summary.data.data; const daemons = summary.data.data;
this.$scope.daemons = Object.keys(daemons).map(item => ({ title: item })); this.$scope.daemons = Object.keys(daemons).map(item => ({ title: item }));
if (!this.$scope.$$phase) this.$scope.$digest();
} catch(error) { } catch(error) {
this.errorHandler.handle(error, 'Logs'); this.errorHandler.handle(error, 'Logs');
} }
if (!this.$scope.$$phase) this.$scope.$digest();
} }
/** /**

View File

@ -55,9 +55,9 @@
<!-- End Filters and Realtime button section --> <!-- End Filters and Realtime button section -->
<div layout="row" flex class="md-padding" ng-if="logsPath"> <div layout="row" flex class="md-padding" ng-if="logsPath">
<input placeholder="Filter logs..." ng-model="custom_search" id="logsSearchBar" type="text" class="kuiLocalSearchInput ng-empty ng-pristine ng-scope ng-touched ng-valid" <input placeholder="Filter logs..." ng-model="custom_search" type="text" class="kuiLocalSearchInput ng-empty ng-pristine ng-scope ng-touched ng-valid"
aria-invalid="false" wz-enter="search()"> aria-invalid="false" wz-enter="search(custom_search)">
<button type="submit" aria-label="Search" class="kuiLocalSearchButton height-40" ng-click="search()"> <button type="submit" aria-label="Search" class="kuiLocalSearchButton height-40" ng-click="search(custom_search)">
<span class="fa fa-search" aria-hidden="true"></span> <span class="fa fa-search" aria-hidden="true"></span>
</button> </button>
</div> </div>