mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 01:45:18 +00:00
Avoid the blanc page in the agent detail view
This commit is contained in:
parent
c38375efa5
commit
650e4c2c61
@ -191,7 +191,11 @@ export class AgentsWelcome extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showModuleByPlatform(menu) {
|
showModuleByPlatform(menu) {
|
||||||
return !this.platform ? false : !UnsupportedComponents[this.platform].includes(menu.id);
|
try {
|
||||||
|
return !this.platform ? false : !UnsupportedComponents[this.platform].includes(menu.id);
|
||||||
|
} catch (error) {
|
||||||
|
return !UnsupportedComponents['other'].includes(menu.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderModules() {
|
renderModules() {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import { IFilterParams, getElasticAlerts, getIndexPattern } from '../../../../../../../overview/mitre/lib';
|
import { IFilterParams, getElasticAlerts, getIndexPattern } from '../../../../../../../overview/mitre/lib';
|
||||||
import { getWazuhFilter } from '../../../../fim_events_table';
|
import { getWazuhFilter } from '../../../../fim_events_table';
|
||||||
import { buildPhraseFilter, buildExistsFilter } from '../../../../../../../../../../../src/plugins/data/common';
|
import { buildPhraseFilter, buildExistsFilter } from '../../../../../../../../../../../src/plugins/data/common';
|
||||||
|
import { toastNotifications } from 'ui/notify';
|
||||||
|
|
||||||
export async function getRequirementAlerts(agentId, time, requirement) {
|
export async function getRequirementAlerts(agentId, time, requirement) {
|
||||||
const indexPattern = await getIndexPattern();
|
const indexPattern = await getIndexPattern();
|
||||||
@ -37,8 +38,17 @@ export async function getRequirementAlerts(agentId, time, requirement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const response = await getElasticAlerts(indexPattern, filterParams, aggs);
|
const response = await getElasticAlerts(indexPattern, filterParams, aggs);
|
||||||
|
const alerts_count = ((((response || {}).data || {}).aggregations || {}).alerts_count || {}).buckets;
|
||||||
|
if (typeof alerts_count === 'undefined') {
|
||||||
|
toastNotifications.add({
|
||||||
|
color: 'warning',
|
||||||
|
title: 'Error getting alerts from compliances',
|
||||||
|
text: "Your environment may not have any index with Wazuh's alerts."
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
alerts_count: ((((response || {}).data || {}).aggregations || {}).alerts_count || {}).buckets,
|
alerts_count: !!alerts_count ? alerts_count : [],
|
||||||
total_alerts: (((response || {}).data || {}).hits || {}).total
|
total_alerts: (((response || {}).data || {}).hits || {}).total
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -62,4 +72,4 @@ function createFilters(agentId, indexPattern) {
|
|||||||
|
|
||||||
function createExistsFilter(requirement, indexPattern) {
|
function createExistsFilter(requirement, indexPattern) {
|
||||||
return buildExistsFilter({ name: `rule.${requirement}`, type: 'nested' }, indexPattern)
|
return buildExistsFilter({ name: `rule.${requirement}`, type: 'nested' }, indexPattern)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user