/
dashboard.tsx
88 lines (81 loc) · 2.77 KB
/
dashboard.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import React from 'react';
import { getPlugins } from '../../../../kibana-services';
import { ViewMode } from '../../../../../../../src/plugins/embeddable/public';
import { getDashboardPanels } from './dashboard_panels';
import { I18nProvider } from '@osd/i18n/react';
import useSearchBar from '../../../common/search-bar/use-search-bar';
import { WAZUH_ALERTS_PATTERN } from '../../../../../common/constants';
import { getKPIsPanel } from './dashboard_panels_kpis';
import { Filter } from '../../../../../../../src/plugins/data/common';
const plugins = getPlugins();
const SearchBar = getPlugins().data.ui.SearchBar;
const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer;
interface DashboardThreatHuntingProps {
pinnedAgent: Filter;
}
export const DashboardThreatHunting: React.FC<DashboardThreatHuntingProps> = ({
pinnedAgent,
}) => {
/* TODO: Analyze whether to use the new index pattern handler https://github.com/wazuh/wazuh-dashboard-plugins/issues/6434 */
const TH_INDEX_PATTERN_ID = WAZUH_ALERTS_PATTERN;
const { searchBarProps } = useSearchBar({
defaultIndexPatternID: TH_INDEX_PATTERN_ID,
});
return (
<>
<I18nProvider>
<SearchBar
appName='th-searchbar'
{...searchBarProps}
showDatePicker={true}
showQueryInput={true}
showQueryBar={true}
/>
</I18nProvider>
<DashboardByRenderer
input={{
viewMode: ViewMode.VIEW,
panels: getKPIsPanel(TH_INDEX_PATTERN_ID),
isFullScreenMode: false,
filters: searchBarProps.filters ?? [],
useMargins: true,
id: 'kpis-th-dashboard-tab',
timeRange: {
from: searchBarProps.dateRangeFrom,
to: searchBarProps.dateRangeTo,
},
title: 'KPIs Threat Hunting dashboard',
description: 'KPIs Dashboard of the Threat Hunting',
query: searchBarProps.query,
refreshConfig: {
pause: false,
value: 15,
},
hidePanelTitles: true,
}}
/>
<DashboardByRenderer
input={{
viewMode: ViewMode.VIEW,
panels: getDashboardPanels(TH_INDEX_PATTERN_ID, !!pinnedAgent),
isFullScreenMode: false,
filters: searchBarProps.filters ?? [],
useMargins: true,
id: 'th-dashboard-tab',
timeRange: {
from: searchBarProps.dateRangeFrom,
to: searchBarProps.dateRangeTo,
},
title: 'Threat Hunting dashboard',
description: 'Dashboard of the Threat Hunting',
query: searchBarProps.query,
refreshConfig: {
pause: false,
value: 15,
},
hidePanelTitles: false,
}}
/>
</>
);
};