mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-07 10:18:57 +00:00
Pending updates
This commit is contained in:
parent
07d2072dee
commit
c88fe8b114
@ -317,7 +317,6 @@ function discoverController(
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////// WAZUH ///////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
console.log("updating", queryFilter.getFilters());
|
||||
$rootScope.$broadcast('updateVis', $state.query, queryFilter.getFilters());
|
||||
$rootScope.$broadcast('fetch');
|
||||
if($location.search().tab != 'configuration') {
|
||||
@ -920,7 +919,6 @@ function discoverController(
|
||||
// Watch for changes in the location
|
||||
$scope.$on('$routeUpdate', () => {
|
||||
if ($location.search().tabView != $scope.tabView) { // No need to change the filters
|
||||
console.log("change");
|
||||
$scope.updateQueryAndFetch($state.query);
|
||||
$scope.tabView = $location.search().tabView;
|
||||
}
|
||||
|
@ -17,33 +17,61 @@ var app = require('ui/modules').get('apps/webinar_app', [])
|
||||
let rendered = false;
|
||||
let visualization = null;
|
||||
let visHandler = null;
|
||||
let pendingUpdates = [];
|
||||
|
||||
// Listen for changes
|
||||
$scope.$on('updateVis', function (event, query, filters) {
|
||||
console.log("update, rendered", rendered);
|
||||
if (rendered) {
|
||||
if (visTitle !== 'Wazuh App Overview General Agents status') { // We don't want to filter that visualization as it uses another index-pattern
|
||||
if (query.query === '') {
|
||||
fullFilter = implicitFilter;
|
||||
}
|
||||
else {
|
||||
if (implicitFilter !== '') {
|
||||
fullFilter = implicitFilter + ' AND ' + query.query;
|
||||
}
|
||||
else {
|
||||
fullFilter = query.query;
|
||||
|
||||
if (pendingUpdates.length != 0) {
|
||||
for (let i = 0; i < pendingUpdates.length; i++) {
|
||||
for (let j = 0; j < implicitFilters.loadFilters().length; j++) {
|
||||
console.log("comparing", pendingUpdates[i].query, implicitFilters.loadFilters()[j]);
|
||||
if (pendingUpdates[i].query == implicitFilters.loadFilters()[j]) {
|
||||
console.log("this is the same", )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("updating inside", filters);
|
||||
visualization.searchSource
|
||||
.query({ language: 'lucene', query: fullFilter })
|
||||
.set('filter', filters);
|
||||
if (query != null) {
|
||||
if (query.query === '') {
|
||||
fullFilter = implicitFilter;
|
||||
}
|
||||
else {
|
||||
if (implicitFilter !== '') {
|
||||
fullFilter = implicitFilter + ' AND ' + query.query;
|
||||
}
|
||||
else {
|
||||
fullFilter = query.query;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("updating inside", visTitle,filters);
|
||||
visualization.searchSource
|
||||
.query({ language: 'lucene', query: fullFilter })
|
||||
.set('filter', filters);
|
||||
} else { // Update with pending
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pendingUpdates.push({"query": query, "filters": filters});
|
||||
console.log("pushing inside", visTitle, pendingUpdates);
|
||||
console.log("the implicits", implicitFilters.loadFilters());
|
||||
}
|
||||
});
|
||||
|
||||
var renderComplete = function() {
|
||||
rendered = true;
|
||||
|
||||
if (pendingUpdates.length != 0) {
|
||||
console.log("emitting, pending updates");
|
||||
$rootScope.$broadcast('updateVis', null, null);
|
||||
}
|
||||
|
||||
$rootScope.loadedVisualizations.push(true);
|
||||
$rootScope.loadingStatus = `Rendering visualizations... ${Math.round((100 * $rootScope.loadedVisualizations.length / $rootScope.tabVisualizations[$location.search().tab]) * 100) / 100} %`;
|
||||
if ($rootScope.loadedVisualizations.length >= $rootScope.tabVisualizations[$location.search().tab]) {
|
||||
|
Loading…
Reference in New Issue
Block a user