mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 18:05:20 +00:00
Merge pull request #974 from wazuh/issue-973
Fix race condition with the Wazuh filters
This commit is contained in:
commit
473ceadfce
@ -567,7 +567,28 @@ function discoverController(
|
||||
.catch(notify.error);
|
||||
};
|
||||
|
||||
const filtersAreReady = () => {
|
||||
const currentUrlPath = $location.path();
|
||||
if (currentUrlPath && !currentUrlPath.includes('wazuh-discover')) {
|
||||
let filters = queryFilter.getFilters();
|
||||
filters = Array.isArray(filters)
|
||||
? filters.filter(
|
||||
item =>
|
||||
item &&
|
||||
item.$state &&
|
||||
item.$state.store &&
|
||||
item.$state.store === 'appState'
|
||||
)
|
||||
: [];
|
||||
if (!filters || !filters.length) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$scope.opts.fetch = $scope.fetch = function() {
|
||||
// Wazuh filters are not ready yet
|
||||
if(!filtersAreReady()) return;
|
||||
|
||||
// ignore requests to fetch before the app inits
|
||||
if (!init.complete) return;
|
||||
|
||||
@ -593,20 +614,9 @@ function discoverController(
|
||||
/*if ($state.query.language && $state.query.language !== query.language) {
|
||||
$state.filters = [];
|
||||
}*/
|
||||
const currentUrlPath = $location.path();
|
||||
if (currentUrlPath && !currentUrlPath.includes('wazuh-discover')) {
|
||||
let filters = queryFilter.getFilters();
|
||||
filters = Array.isArray(filters)
|
||||
? filters.filter(
|
||||
item =>
|
||||
item &&
|
||||
item.$state &&
|
||||
item.$state.store &&
|
||||
item.$state.store === 'appState'
|
||||
)
|
||||
: [];
|
||||
if (!filters || !filters.length) return;
|
||||
}
|
||||
// Wazuh filters are not ready yet
|
||||
if(!filtersAreReady()) return;
|
||||
|
||||
discoverPendingUpdates.removeAll();
|
||||
discoverPendingUpdates.addItem($state.query, queryFilter.getFilters());
|
||||
$rootScope.$broadcast('updateVis');
|
||||
|
@ -174,7 +174,7 @@
|
||||
<!-- End Discover search bar section -->
|
||||
|
||||
<!-- Loading status section -->
|
||||
<div layout="column" layout-align="center center" ng-if="(tab !== 'welcome') && (tab !== 'configuration') && tab !== 'syscollector'" ng-show="resultState === 'ready' && tabView === 'panels' && !rendered">
|
||||
<div layout="column" layout-align="center center" ng-if="tab !== 'welcome' && tab !== 'configuration' && tab !== 'syscollector'" ng-show="resultState === 'ready' && tabView === 'panels' && !rendered">
|
||||
<div class="percentage"><i class="fa fa-fw fa-spin fa-spinner" aria-hidden="true"></i></div>
|
||||
<div class="percentage">{{loadingStatus}}</div>
|
||||
</div>
|
||||
@ -199,6 +199,6 @@
|
||||
<!-- No results section -->
|
||||
|
||||
<!-- Loading ring -->
|
||||
<div class='uil-ring-css' ng-show="load && tab !== 'configuration'">
|
||||
<div class='uil-ring-css' ng-show="load && tab !== 'configuration' && tabView === 'panels'">
|
||||
<div></div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user