From 75834f8b1f9540f138254219e23756636ff155d8 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Tue, 8 Oct 2024 17:42:06 -0300 Subject: [PATCH 01/21] Add top packages component --- .../top_packages_table/top_packages_table.tsx | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx diff --git a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx new file mode 100644 index 0000000000..dd11602c6f --- /dev/null +++ b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx @@ -0,0 +1,126 @@ +/* + * Wazuh app - React component building the welcome screen of an agent. + * version, OS, registration date, last keep alive. + * + * Copyright (C) 2015-2022 Wazuh, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Find more information about this on the LICENSE file. + */ + +import React, { useState, useEffect, Fragment } from 'react'; +import { + EuiBasicTable, + EuiFlexItem, + EuiPanel, + EuiSpacer, + EuiText, + EuiButtonIcon, + EuiFlexGroup, + EuiToolTip, + EuiLink +} from '@elastic/eui'; +// @ts-ignore +import { getCore, getDataPlugin } from '../../../../../kibana-services'; +import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; +import { vulnerabilityDetection } from '../../../../../utils/applications'; +import { PinnedAgentManager } from '../../../../wz-agent-selector/wz-agent-selector-service'; +import NavigationService from '../../../../../react-services/navigation-service'; +import { + PatternDataSourceFilterManager, + FILTER_OPERATOR, + PatternDataSource, + tParsedIndexPattern, + useDataSource, + VulnerabilitiesDataSourceRepository, + VulnerabilitiesDataSource +} from '../../../data-source'; +import { WAZUH_MODULES } from '../../../../../../common/wazuh-modules'; + +export function useTimeFilter() { + const { timefilter } = getDataPlugin().query.timefilter; + const [timeFilter, setTimeFilter] = useState(timefilter.getTime()); + useEffect(() => { + const subscription = timefilter + .getTimeUpdate$() + .subscribe(() => setTimeFilter(timefilter.getTime())); + return () => { + subscription.unsubscribe(); + }; + }, []); + return timeFilter; +} + + +export function VulsTopPackageTable({ agentId, items, indexPatternId }) { + const [sort, setSort] = useState({ + field: 'doc_count', + direction: 'desc', + }); + const [data, setData] = useState([]); + const timeFilter = useTimeFilter(); + + const columns = [ + { + field: 'key', + name: 'Package', + sortable: true, + render: field => ( + + {field} + + ) + }, + { + field: 'doc_count', + name: 'Count', + sortable: true, + truncateText: true, + width: '100px', + } + ]; + + return ( + + + + +

Top 5 Packages

+
+
+
+ + setSort(e.sort)} + itemId='top-packages-table' + noItemsMessage='No recent events' + /> +
+ ); +} + + From d3496559679585a6b9027ca35a7e531b0f791dc0 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Tue, 8 Oct 2024 17:42:42 -0300 Subject: [PATCH 02/21] Add vuls severity stat component --- .../vuls_severity_stat/vuls_severity_stat.tsx | 32 +++++++++++++ .../last-alerts-stat/last-alerts-stat.tsx | 47 ++++++++++++------- 2 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx diff --git a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx new file mode 100644 index 0000000000..cae45e53e6 --- /dev/null +++ b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx @@ -0,0 +1,32 @@ +import React, { useState, useEffect } from "react"; +import { EuiStat, EuiStatProps } from "@elastic/eui" +import { RedirectAppLinks } from "../../../../../../../../src/plugins/opensearch_dashboards_react/public"; +import { tUseDataSourceLoadedReturns } from "../../../data-source/hooks/use-data-source"; +import { getCore } from "../../../../../kibana-services"; + +type VulsSeverityStatProps = { + value: string; + color: string; + description?: string; + textAlign?: EuiStatProps['textAlign'] + statElement?: EuiStatProps['descriptionElement']; + isLoading: boolean; +} + + +export default function VulsSeverityStat({ value, description, color, textAlign = "center", statElement = "h2", isLoading }: VulsSeverityStatProps) { + return ( + + + + + ) +} \ No newline at end of file diff --git a/plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-stat.tsx b/plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-stat.tsx index 4f51cf8600..7bdb2291bc 100644 --- a/plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-stat.tsx +++ b/plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-stat.tsx @@ -5,6 +5,7 @@ import { EuiLink, EuiToolTip, EuiText, + EuiStatProps, } from '@elastic/eui'; import { getLast24HoursAlerts } from './last-alerts-service'; import { UI_COLOR_STATUS } from '../../../../../common/constants'; @@ -22,7 +23,7 @@ import { type SeverityKey = 'low' | 'medium' | 'high' | 'critical'; -const severities = { +export const severities = { low: { label: 'Low', color: UI_COLOR_STATUS.success, @@ -59,8 +60,14 @@ const severities = { export function LastAlertsStat({ severity: severityKey, + hideBottomText, + direction = 'row', + textAlign = 'center' }: { severity: SeverityKey; + hideBottomText?: boolean; + direction: 'row' | 'column'; + textAlign?: EuiStatProps['textAlign'] }) { const [countLastAlerts, setCountLastAlerts] = useState(null); const [discoverLocation, setDiscoverLocation] = useState(''); @@ -117,6 +124,9 @@ export function LastAlertsStat({ getCountLastAlerts(); }, []); + const statDescription = direction === 'row' ? `${severity.label} severity` : '' + const statValue = direction === 'row' ? `${countLastAlerts ?? '-'}` : ` ${countLastAlerts ?? '-'} ${severity.label}`; + return ( @@ -124,14 +134,13 @@ export function LastAlertsStat({ title={ - {countLastAlerts ?? '-'} + {statValue} } - description={`${severity.label} severity`} + description={statDescription} descriptionElement='h3' titleColor={severity.color} - textAlign='center' + textAlign={textAlign} /> - - {'Rule level ' + - ruleLevelRange.minRuleLevel + - (ruleLevelRange.maxRuleLevel - ? ' to ' + ruleLevelRange.maxRuleLevel - : ' or higher')} - + {hideBottomText ? null : + + {'Rule level ' + + ruleLevelRange.minRuleLevel + + (ruleLevelRange.maxRuleLevel + ? ' to ' + ruleLevelRange.maxRuleLevel + : ' or higher')} + + } ); From 34dd61afc9979e444f35e8ad0a9fc03b5fc97054 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Tue, 8 Oct 2024 17:43:07 -0300 Subject: [PATCH 03/21] Create vuls panel --- .../common/welcome/components/index.ts | 1 + .../components/top_packages_table/index.ts | 15 ++ .../vuls_panel/vuls_welcome_panel.tsx | 182 ++++++++++++++++++ 3 files changed, 198 insertions(+) create mode 100644 plugins/main/public/components/common/welcome/components/top_packages_table/index.ts create mode 100644 plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx diff --git a/plugins/main/public/components/common/welcome/components/index.ts b/plugins/main/public/components/common/welcome/components/index.ts index e6b4fae312..f40a1a90d0 100644 --- a/plugins/main/public/components/common/welcome/components/index.ts +++ b/plugins/main/public/components/common/welcome/components/index.ts @@ -16,3 +16,4 @@ export { FimEventsTable, useTimeFilter } from './fim_events_table'; export { ScaScan } from './sca_scan'; export { MitreTopTactics } from './mitre_top'; export { RequirementVis } from './requirement_vis'; +export { VulsTopPackageTable } from './top_packages_table'; diff --git a/plugins/main/public/components/common/welcome/components/top_packages_table/index.ts b/plugins/main/public/components/common/welcome/components/top_packages_table/index.ts new file mode 100644 index 0000000000..a29b88ec1f --- /dev/null +++ b/plugins/main/public/components/common/welcome/components/top_packages_table/index.ts @@ -0,0 +1,15 @@ +/* + * Wazuh app - React component building the welcome screen of an agent. + * version, OS, registration date, last keep alive. + * + * Copyright (C) 2015-2022 Wazuh, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Find more information about this on the LICENSE file. + */ + +export { VulsTopPackageTable, useTimeFilter, } from './top_packages_table'; \ No newline at end of file diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx new file mode 100644 index 0000000000..d82d97c262 --- /dev/null +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -0,0 +1,182 @@ +import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip, EuiButtonIcon, EuiSpacer, EuiLink, EuiTitle } from '@elastic/eui'; +import React, { Fragment, useEffect, useState } from 'react'; +import { VulsTopPackageTable } from '../top_packages_table'; +import VulsSeverityStat from '../vuls_severity_stat/vuls_severity_stat'; +import { + PatternDataSourceFilterManager, + PatternDataSource, + tParsedIndexPattern, + useDataSource, + FILTER_OPERATOR, + VulnerabilitiesDataSourceRepository, + VulnerabilitiesDataSource +} from '../../../data-source'; +import { severities } from '../../../../../controllers/overview/components/last-alerts-stat/last-alerts-stat'; +import { getCore, getDataPlugin } from '../../../../../kibana-services'; +import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; +import { vulnerabilityDetection } from '../../../../../utils/applications'; +import { WAZUH_MODULES } from '../../../../../../common/wazuh-modules'; +import NavigationService from '../../../../../react-services/navigation-service'; + + +export default function VulsPanel({ agent }) { + + const { + dataSource, + isLoading: isDataSourceLoading, + fetchData, + } = useDataSource({ + DataSource: VulnerabilitiesDataSource, + repository: new VulnerabilitiesDataSourceRepository(), + }); + + const [isLoading, setIsLoading] = useState(true); + const [severityStats, setSeverityStats] = useState(null); + const [topPackagesData, setTopPackagesData] = useState([]); + + const fetchSeverityStatsData = async () => { + + const data = await fetchData({ + aggs: { + severity: { + terms: { + field: 'vulnerability.severity', + size: 5, + order: { + _count: 'desc', + }, + } + } + } + }); + setSeverityStats(data.aggregations.severity.buckets); + } + + const fetchTopPackagesData = async () => { + fetchData({ + aggs: { + package: { + terms: { + field: 'package.name', + size: 5, + order: { + _count: 'desc', + }, + }, + } + } + }).then(results => { + setTopPackagesData(results.aggregations.package.buckets); + }) + } + + + useEffect(() => { + if (isDataSourceLoading) { + return; + } + Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) + .then(() => setIsLoading(false)) + .catch((error) => { + setIsLoading(false); + }); + }, [isDataSourceLoading, agent.id]); + + const getSeverityValue = (severity) => { + const value = severityStats?.find((v) => v.key.toUpperCase() === severity.toUpperCase())?.doc_count || '-'; + return value ? `${value} ${severity}` : '-'; + } + + const goToVulnerabilityDashboardWithSeverityFilterURL = async (severity, indexPatternId) => { + const filters = [ + PatternDataSourceFilterManager.createFilter( + FILTER_OPERATOR.IS, + `vulnerability.severity`, + severity, + indexPatternId, + ), + ]; + const url = NavigationService.getInstance().getUrlForApp( + vulnerabilityDetection.id, + { + path: `tab=vuls&tabView=dashboard&agentId=${agent.id + }&_g=${PatternDataSourceFilterManager.filtersToURLFormat(filters)}`, + }, + ); + + return url; + } + + const renderSeverityStats = (severity, index) => { + const severityLabel = severities[severity].label; + const severityColor = severities[severity].color; + return ( + + + + + + ) + } + + return + + + + + + +

Vulnerability Detection

+
+
+
+ + + + + + + +
+
+ + + + {Object.keys(severities).reverse().map(renderSeverityStats)} + + + + + + +
+
+} \ No newline at end of file From 58d531cfc9a9f57d0adebd693239f36d9641b4ef Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Tue, 8 Oct 2024 17:43:39 -0300 Subject: [PATCH 04/21] Add vuls panel in agent overview --- .../common/welcome/agents-welcome.js | 60 +++++++++++++------ 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/plugins/main/public/components/common/welcome/agents-welcome.js b/plugins/main/public/components/common/welcome/agents-welcome.js index 43bdc85ef4..91e69e15fa 100644 --- a/plugins/main/public/components/common/welcome/agents-welcome.js +++ b/plugins/main/public/components/common/welcome/agents-welcome.js @@ -58,6 +58,7 @@ import { EventsCount } from './dashboard/events-count'; import { IntlProvider } from 'react-intl'; import { ButtonExploreAgent } from '../../wz-agent-selector/button-explore-agent'; import NavigationService from '../../../react-services/navigation-service'; +import VulsPanel from './components/vuls_panel/vuls_welcome_panel'; export const AgentsWelcome = compose( withErrorBoundary, @@ -388,7 +389,7 @@ export const AgentsWelcome = compose( renderMitrePanel() { return ( - +

@@ -491,13 +492,25 @@ export const AgentsWelcome = compose( {(this.state.widthWindow < 1150 && ( + + + {' '} + {/* Events count evolution */} + {this.renderEventCountVisualization()} + + + {this.renderMitrePanel()} - {this.renderCompliancePanel()} + + {this.renderCompliancePanel()} + @@ -505,12 +518,8 @@ export const AgentsWelcome = compose( - - {' '} - {/* Events count evolution */} - {this.renderEventCountVisualization()} + + @@ -524,26 +533,41 @@ export const AgentsWelcome = compose( - {this.renderMitrePanel()} + {' '} + {/* Events count evolution */} + {this.renderEventCountVisualization()} + + + + + {this.renderMitrePanel()} + + + {this.renderCompliancePanel()} + + - {this.renderCompliancePanel()} - - - {' '} - {/* Events count evolution */} - {this.renderEventCountVisualization()} + + {this.renderSCALastScan()} + + + + )} From 646c8dbfce99d5e33ccf325a8703ff8d1ffdd695 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Tue, 8 Oct 2024 18:01:53 -0300 Subject: [PATCH 05/21] Update CHANGELOG --- CHANGELOG.md | 1 + .../welcome/components/vuls_panel/vuls_welcome_panel.tsx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8f3be31da..5bbbd2244e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Support for Wazuh 4.10.0 - Added sample data for YARA [#6964](https://github.com/wazuh/wazuh-dashboard-plugins/issues/6964) - Added a custom filter and visualization for vulnerability.under_evaluation field [#6968](https://github.com/wazuh/wazuh-dashboard-plugins/issues/6968) [#7044](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7044) [#7046](https://github.com/wazuh/wazuh-dashboard-plugins/issues/7046) +- Add vulnerabilities card to agent details page [#7058](https://github.com/wazuh/wazuh-dashboard-plugins/issues/7058) ### Changed diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index d82d97c262..cf35b248db 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -168,12 +168,12 @@ export default function VulsPanel({ agent }) { - + {Object.keys(severities).reverse().map(renderSeverityStats)} - + From 6a6875b6a503c527ef14132dfc1394098cdb05ff Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Tue, 8 Oct 2024 18:07:54 -0300 Subject: [PATCH 06/21] Apply prettier --- .../components/top_packages_table/index.ts | 2 +- .../top_packages_table/top_packages_table.tsx | 18 +- .../vuls_panel/vuls_welcome_panel.tsx | 336 ++++++++++-------- .../vuls_severity_stat/vuls_severity_stat.tsx | 63 ++-- .../last-alerts-stat/last-alerts-stat.tsx | 29 +- 5 files changed, 240 insertions(+), 208 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/top_packages_table/index.ts b/plugins/main/public/components/common/welcome/components/top_packages_table/index.ts index a29b88ec1f..4fd81bc185 100644 --- a/plugins/main/public/components/common/welcome/components/top_packages_table/index.ts +++ b/plugins/main/public/components/common/welcome/components/top_packages_table/index.ts @@ -12,4 +12,4 @@ * Find more information about this on the LICENSE file. */ -export { VulsTopPackageTable, useTimeFilter, } from './top_packages_table'; \ No newline at end of file +export { VulsTopPackageTable, useTimeFilter } from './top_packages_table'; diff --git a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx index dd11602c6f..a74e4a592b 100644 --- a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx +++ b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx @@ -22,7 +22,7 @@ import { EuiButtonIcon, EuiFlexGroup, EuiToolTip, - EuiLink + EuiLink, } from '@elastic/eui'; // @ts-ignore import { getCore, getDataPlugin } from '../../../../../kibana-services'; @@ -37,7 +37,7 @@ import { tParsedIndexPattern, useDataSource, VulnerabilitiesDataSourceRepository, - VulnerabilitiesDataSource + VulnerabilitiesDataSource, } from '../../../data-source'; import { WAZUH_MODULES } from '../../../../../../common/wazuh-modules'; @@ -55,7 +55,6 @@ export function useTimeFilter() { return timeFilter; } - export function VulsTopPackageTable({ agentId, items, indexPatternId }) { const [sort, setSort] = useState({ field: 'doc_count', @@ -75,21 +74,22 @@ export function VulsTopPackageTable({ agentId, items, indexPatternId }) { href={NavigationService.getInstance().getUrlForApp( vulnerabilityDetection.id, { - path: `tab=vuls&tabView=dashboard&agentId=${agentId - }&_g=${PatternDataSourceFilterManager.filtersToURLFormat([ + path: `tab=vuls&tabView=dashboard&agentId=${agentId}&_g=${PatternDataSourceFilterManager.filtersToURLFormat( + [ PatternDataSourceFilterManager.createFilter( FILTER_OPERATOR.IS, `package.name`, field, indexPatternId, ), - ])}` + ], + )}`, }, )} > {field} - ) + ), }, { field: 'doc_count', @@ -97,7 +97,7 @@ export function VulsTopPackageTable({ agentId, items, indexPatternId }) { sortable: true, truncateText: true, width: '100px', - } + }, ]; return ( @@ -122,5 +122,3 @@ export function VulsTopPackageTable({ agentId, items, indexPatternId }) { ); } - - diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index cf35b248db..dd71a80e3f 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -1,15 +1,25 @@ -import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip, EuiButtonIcon, EuiSpacer, EuiLink, EuiTitle } from '@elastic/eui'; +import { + EuiPanel, + EuiFlexGroup, + EuiFlexItem, + EuiText, + EuiToolTip, + EuiButtonIcon, + EuiSpacer, + EuiLink, + EuiTitle, +} from '@elastic/eui'; import React, { Fragment, useEffect, useState } from 'react'; import { VulsTopPackageTable } from '../top_packages_table'; import VulsSeverityStat from '../vuls_severity_stat/vuls_severity_stat'; import { - PatternDataSourceFilterManager, - PatternDataSource, - tParsedIndexPattern, - useDataSource, - FILTER_OPERATOR, - VulnerabilitiesDataSourceRepository, - VulnerabilitiesDataSource + PatternDataSourceFilterManager, + PatternDataSource, + tParsedIndexPattern, + useDataSource, + FILTER_OPERATOR, + VulnerabilitiesDataSourceRepository, + VulnerabilitiesDataSource, } from '../../../data-source'; import { severities } from '../../../../../controllers/overview/components/last-alerts-stat/last-alerts-stat'; import { getCore, getDataPlugin } from '../../../../../kibana-services'; @@ -18,165 +28,179 @@ import { vulnerabilityDetection } from '../../../../../utils/applications'; import { WAZUH_MODULES } from '../../../../../../common/wazuh-modules'; import NavigationService from '../../../../../react-services/navigation-service'; - export default function VulsPanel({ agent }) { + const { + dataSource, + isLoading: isDataSourceLoading, + fetchData, + } = useDataSource({ + DataSource: VulnerabilitiesDataSource, + repository: new VulnerabilitiesDataSourceRepository(), + }); - const { - dataSource, - isLoading: isDataSourceLoading, - fetchData, - } = useDataSource({ - DataSource: VulnerabilitiesDataSource, - repository: new VulnerabilitiesDataSourceRepository(), - }); + const [isLoading, setIsLoading] = useState(true); + const [severityStats, setSeverityStats] = useState(null); + const [topPackagesData, setTopPackagesData] = useState([]); - const [isLoading, setIsLoading] = useState(true); - const [severityStats, setSeverityStats] = useState(null); - const [topPackagesData, setTopPackagesData] = useState([]); + const fetchSeverityStatsData = async () => { + const data = await fetchData({ + aggs: { + severity: { + terms: { + field: 'vulnerability.severity', + size: 5, + order: { + _count: 'desc', + }, + }, + }, + }, + }); + setSeverityStats(data.aggregations.severity.buckets); + }; - const fetchSeverityStatsData = async () => { + const fetchTopPackagesData = async () => { + fetchData({ + aggs: { + package: { + terms: { + field: 'package.name', + size: 5, + order: { + _count: 'desc', + }, + }, + }, + }, + }).then(results => { + setTopPackagesData(results.aggregations.package.buckets); + }); + }; - const data = await fetchData({ - aggs: { - severity: { - terms: { - field: 'vulnerability.severity', - size: 5, - order: { - _count: 'desc', - }, - } - } - } - }); - setSeverityStats(data.aggregations.severity.buckets); + useEffect(() => { + if (isDataSourceLoading) { + return; } + Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) + .then(() => setIsLoading(false)) + .catch(error => { + setIsLoading(false); + }); + }, [isDataSourceLoading, agent.id]); - const fetchTopPackagesData = async () => { - fetchData({ - aggs: { - package: { - terms: { - field: 'package.name', - size: 5, - order: { - _count: 'desc', - }, - }, - } - } - }).then(results => { - setTopPackagesData(results.aggregations.package.buckets); - }) - } + const getSeverityValue = severity => { + const value = + severityStats?.find(v => v.key.toUpperCase() === severity.toUpperCase()) + ?.doc_count || '-'; + return value ? `${value} ${severity}` : '-'; + }; + const goToVulnerabilityDashboardWithSeverityFilterURL = async ( + severity, + indexPatternId, + ) => { + const filters = [ + PatternDataSourceFilterManager.createFilter( + FILTER_OPERATOR.IS, + `vulnerability.severity`, + severity, + indexPatternId, + ), + ]; + const url = NavigationService.getInstance().getUrlForApp( + vulnerabilityDetection.id, + { + path: `tab=vuls&tabView=dashboard&agentId=${ + agent.id + }&_g=${PatternDataSourceFilterManager.filtersToURLFormat(filters)}`, + }, + ); - useEffect(() => { - if (isDataSourceLoading) { - return; - } - Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) - .then(() => setIsLoading(false)) - .catch((error) => { - setIsLoading(false); - }); - }, [isDataSourceLoading, agent.id]); + return url; + }; - const getSeverityValue = (severity) => { - const value = severityStats?.find((v) => v.key.toUpperCase() === severity.toUpperCase())?.doc_count || '-'; - return value ? `${value} ${severity}` : '-'; - } + const renderSeverityStats = (severity, index) => { + const severityLabel = severities[severity].label; + const severityColor = severities[severity].color; + return ( + + + + + + + + ); + }; - const goToVulnerabilityDashboardWithSeverityFilterURL = async (severity, indexPatternId) => { - const filters = [ - PatternDataSourceFilterManager.createFilter( - FILTER_OPERATOR.IS, - `vulnerability.severity`, - severity, - indexPatternId, - ), - ]; - const url = NavigationService.getInstance().getUrlForApp( - vulnerabilityDetection.id, - { - path: `tab=vuls&tabView=dashboard&agentId=${agent.id - }&_g=${PatternDataSourceFilterManager.filtersToURLFormat(filters)}`, - }, - ); - - return url; - } - - const renderSeverityStats = (severity, index) => { - const severityLabel = severities[severity].label; - const severityColor = severities[severity].color; - return ( - - + + + + + + +

Vulnerability Detection

+
+
+
+ + + + - -
-
-
) - } - - return - - - - - - -

Vulnerability Detection

-
-
-
- - - - - - - -
-
- - - - {Object.keys(severities).reverse().map(renderSeverityStats)} - - - - - + aria-label='Open Vulnerability Detection' + /> + + + + + + + + + {Object.keys(severities).reverse().map(renderSeverityStats)} -
-
-} \ No newline at end of file + + + + + + + + ); +} diff --git a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx index cae45e53e6..d1306a1132 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx @@ -1,32 +1,37 @@ -import React, { useState, useEffect } from "react"; -import { EuiStat, EuiStatProps } from "@elastic/eui" -import { RedirectAppLinks } from "../../../../../../../../src/plugins/opensearch_dashboards_react/public"; -import { tUseDataSourceLoadedReturns } from "../../../data-source/hooks/use-data-source"; -import { getCore } from "../../../../../kibana-services"; +import React, { useState, useEffect } from 'react'; +import { EuiStat, EuiStatProps } from '@elastic/eui'; +import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; +import { tUseDataSourceLoadedReturns } from '../../../data-source/hooks/use-data-source'; +import { getCore } from '../../../../../kibana-services'; type VulsSeverityStatProps = { - value: string; - color: string; - description?: string; - textAlign?: EuiStatProps['textAlign'] - statElement?: EuiStatProps['descriptionElement']; - isLoading: boolean; -} - + value: string; + color: string; + description?: string; + textAlign?: EuiStatProps['textAlign']; + statElement?: EuiStatProps['descriptionElement']; + isLoading: boolean; +}; -export default function VulsSeverityStat({ value, description, color, textAlign = "center", statElement = "h2", isLoading }: VulsSeverityStatProps) { - return ( - - - - - ) -} \ No newline at end of file +export default function VulsSeverityStat({ + value, + description, + color, + textAlign = 'center', + statElement = 'h2', + isLoading, +}: VulsSeverityStatProps) { + return ( + + + + ); +} diff --git a/plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-stat.tsx b/plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-stat.tsx index 7bdb2291bc..cf9258ca81 100644 --- a/plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-stat.tsx +++ b/plugins/main/public/controllers/overview/components/last-alerts-stat/last-alerts-stat.tsx @@ -62,12 +62,12 @@ export function LastAlertsStat({ severity: severityKey, hideBottomText, direction = 'row', - textAlign = 'center' + textAlign = 'center', }: { severity: SeverityKey; hideBottomText?: boolean; direction: 'row' | 'column'; - textAlign?: EuiStatProps['textAlign'] + textAlign?: EuiStatProps['textAlign']; }) { const [countLastAlerts, setCountLastAlerts] = useState(null); const [discoverLocation, setDiscoverLocation] = useState(''); @@ -124,8 +124,12 @@ export function LastAlertsStat({ getCountLastAlerts(); }, []); - const statDescription = direction === 'row' ? `${severity.label} severity` : '' - const statValue = direction === 'row' ? `${countLastAlerts ?? '-'}` : ` ${countLastAlerts ?? '-'} ${severity.label}`; + const statDescription = + direction === 'row' ? `${severity.label} severity` : ''; + const statValue = + direction === 'row' + ? `${countLastAlerts ?? '-'}` + : ` ${countLastAlerts ?? '-'} ${severity.label}`; return ( @@ -134,13 +138,14 @@ export function LastAlertsStat({ title={ - {hideBottomText ? null : + {hideBottomText ? null : ( {'Rule level ' + ruleLevelRange.minRuleLevel + @@ -167,7 +172,7 @@ export function LastAlertsStat({ ? ' to ' + ruleLevelRange.maxRuleLevel : ' or higher')} - } + )} ); From 5a19ea08a765e71cc6da114b17fb72e172c0fe60 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Wed, 9 Oct 2024 09:00:22 -0300 Subject: [PATCH 07/21] Fix responsive behavior --- .../common/welcome/agents-welcome.js | 98 +++++-------------- .../fim_events_table/fim_events_table.tsx | 2 +- .../top_packages_table/top_packages_table.tsx | 43 +++----- .../vuls_panel/vuls_welcome_panel.tsx | 71 ++++---------- .../vuls_severity_stat/vuls_severity_stat.tsx | 21 ++-- 5 files changed, 72 insertions(+), 163 deletions(-) diff --git a/plugins/main/public/components/common/welcome/agents-welcome.js b/plugins/main/public/components/common/welcome/agents-welcome.js index 91e69e15fa..26f1f9f7cc 100644 --- a/plugins/main/public/components/common/welcome/agents-welcome.js +++ b/plugins/main/public/components/common/welcome/agents-welcome.js @@ -390,7 +390,7 @@ export const AgentsWelcome = compose( return ( - +

@@ -450,6 +450,8 @@ export const AgentsWelcome = compose( render() { const title = this.renderTitle(); + const responsiveGroupDirection = + this.state.widthWindow < 1150 ? 'column' : 'row'; return ( @@ -490,86 +492,38 @@ export const AgentsWelcome = compose( {}} /> - {(this.state.widthWindow < 1150 && ( - + + + {this.renderEventCountVisualization()} + + - - {' '} - {/* Events count evolution */} - {this.renderEventCountVisualization()} - - - - {this.renderMitrePanel()} - + {this.renderCompliancePanel()} - - - - - - - - - - - - - {this.renderSCALastScan()} - - - )) || ( - - - - - - {' '} - {/* Events count evolution */} - {this.renderEventCountVisualization()} - - - - - {this.renderMitrePanel()} - - - {this.renderCompliancePanel()} - - - - - - - - - - - - {this.renderSCALastScan()} - - - - - - - )} + + + + + + + + {this.renderSCALastScan()} + + + + + diff --git a/plugins/main/public/components/common/welcome/components/fim_events_table/fim_events_table.tsx b/plugins/main/public/components/common/welcome/components/fim_events_table/fim_events_table.tsx index f2ec64eb15..7eb4d26d5b 100644 --- a/plugins/main/public/components/common/welcome/components/fim_events_table/fim_events_table.tsx +++ b/plugins/main/public/components/common/welcome/components/fim_events_table/fim_events_table.tsx @@ -39,7 +39,7 @@ export function FimEventsTable({ agent }) { - +

FIM: Recent events

diff --git a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx index a74e4a592b..e459c5a759 100644 --- a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx +++ b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx @@ -25,21 +25,13 @@ import { EuiLink, } from '@elastic/eui'; // @ts-ignore -import { getCore, getDataPlugin } from '../../../../../kibana-services'; -import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; +import { getDataPlugin } from '../../../../../kibana-services'; import { vulnerabilityDetection } from '../../../../../utils/applications'; -import { PinnedAgentManager } from '../../../../wz-agent-selector/wz-agent-selector-service'; -import NavigationService from '../../../../../react-services/navigation-service'; import { PatternDataSourceFilterManager, FILTER_OPERATOR, - PatternDataSource, - tParsedIndexPattern, - useDataSource, - VulnerabilitiesDataSourceRepository, - VulnerabilitiesDataSource, } from '../../../data-source'; -import { WAZUH_MODULES } from '../../../../../../common/wazuh-modules'; +import { WzLink } from '../../../../../components/wz-link/wz-link'; export function useTimeFilter() { const { timefilter } = getDataPlugin().query.timefilter; @@ -69,26 +61,21 @@ export function VulsTopPackageTable({ agentId, items, indexPatternId }) { name: 'Package', sortable: true, render: field => ( - {field} - + ), }, { diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index dd71a80e3f..d7599808e5 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -22,11 +22,11 @@ import { VulnerabilitiesDataSource, } from '../../../data-source'; import { severities } from '../../../../../controllers/overview/components/last-alerts-stat/last-alerts-stat'; -import { getCore, getDataPlugin } from '../../../../../kibana-services'; +import { getCore } from '../../../../../kibana-services'; import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; import { vulnerabilityDetection } from '../../../../../utils/applications'; -import { WAZUH_MODULES } from '../../../../../../common/wazuh-modules'; import NavigationService from '../../../../../react-services/navigation-service'; +import { WzLink } from '../../../../../components/wz-link/wz-link'; export default function VulsPanel({ agent }) { const { @@ -95,52 +95,24 @@ export default function VulsPanel({ agent }) { return value ? `${value} ${severity}` : '-'; }; - const goToVulnerabilityDashboardWithSeverityFilterURL = async ( - severity, - indexPatternId, - ) => { - const filters = [ - PatternDataSourceFilterManager.createFilter( - FILTER_OPERATOR.IS, - `vulnerability.severity`, - severity, - indexPatternId, - ), - ]; - const url = NavigationService.getInstance().getUrlForApp( - vulnerabilityDetection.id, - { - path: `tab=vuls&tabView=dashboard&agentId=${ - agent.id - }&_g=${PatternDataSourceFilterManager.filtersToURLFormat(filters)}`, - }, - ); - - return url; - }; - const renderSeverityStats = (severity, index) => { const severityLabel = severities[severity].label; const severityColor = severities[severity].color; return ( - - + ); @@ -158,13 +130,11 @@ export default function VulsPanel({ agent }) { - + - - -

Vulnerability Detection

-
-
+ +

Vulnerability Detection

+
@@ -186,9 +156,10 @@ export default function VulsPanel({ agent }) {
+ - + {Object.keys(severities).reverse().map(renderSeverityStats)} diff --git a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx index d1306a1132..a800862af4 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx @@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'; import { EuiStat, EuiStatProps } from '@elastic/eui'; import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; import { tUseDataSourceLoadedReturns } from '../../../data-source/hooks/use-data-source'; -import { getCore } from '../../../../../kibana-services'; type VulsSeverityStatProps = { value: string; @@ -22,16 +21,14 @@ export default function VulsSeverityStat({ isLoading, }: VulsSeverityStatProps) { return ( - - - + ); } From 15990ce87ce9b0ef54028860575d196885e5235d Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Wed, 9 Oct 2024 09:04:07 -0300 Subject: [PATCH 08/21] Apply prettier --- .../top_packages_table/top_packages_table.tsx | 2 +- .../vuls_panel/vuls_welcome_panel.tsx | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx index e459c5a759..631f1ec052 100644 --- a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx +++ b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx @@ -75,7 +75,7 @@ export function VulsTopPackageTable({ agentId, items, indexPatternId }) { )}`} > {field} - + ), }, { diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index d7599808e5..e364118e0c 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -103,16 +103,16 @@ export default function VulsPanel({ agent }) { - +

Vulnerability Detection

From 5c0bc485b872b8c2b6dcd3443bd6c4ebedd21818 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Fri, 18 Oct 2024 09:21:17 -0300 Subject: [PATCH 09/21] Change vuls panel style --- .../vuls_panel/vuls_welcome_panel.tsx | 83 ++++++++++++------- .../vuls_severity_stat/vuls_severity_stat.tsx | 1 + 2 files changed, 52 insertions(+), 32 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index e364118e0c..c39ff02da0 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -27,6 +27,9 @@ import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch import { vulnerabilityDetection } from '../../../../../utils/applications'; import NavigationService from '../../../../../react-services/navigation-service'; import { WzLink } from '../../../../../components/wz-link/wz-link'; +import { withErrorBoundary } from '../../../../common/hocs'; +import { compose } from 'redux'; +import { withVulnerabilitiesStateDataSource } from '../../../../../components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern'; export default function VulsPanel({ agent }) { const { @@ -101,31 +104,58 @@ export default function VulsPanel({ agent }) { return ( - - - + + + + + + + ); }; + const VulsPanelContent = () => { + return ( + <> + + + {Object.keys(severities).reverse().map(renderSeverityStats)} + + + + + + + ) + } + + const PanelWithVulnerabilitiesState = compose( + withErrorBoundary, + withVulnerabilitiesStateDataSource, + )(VulsPanelContent); + return ( @@ -161,18 +191,7 @@ export default function VulsPanel({ agent }) {
- - - {Object.keys(severities).reverse().map(renderSeverityStats)} - - - - - +
diff --git a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx index a800862af4..50ec76e197 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx @@ -28,6 +28,7 @@ export default function VulsSeverityStat({ titleElement={statElement} isLoading={isLoading} titleColor={color} + titleSize='m' textAlign={textAlign} /> ); From 0d30f2b6d23433a6ba10f744a0219feee2140439 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Fri, 18 Oct 2024 09:21:53 -0300 Subject: [PATCH 10/21] Use vuls data source in agent overview panel --- .../validate-vulnerabilities-states-index-pattern.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx index 6f0ed611c8..9fd4bb5cbb 100644 --- a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx @@ -18,13 +18,14 @@ const INDEX_PATTERN_CREATION_NO_INDEX = 'INDEX_PATTERN_CREATION_NO_INDEX'; export async function validateVulnerabilitiesStateDataSources({ vulnerabilitiesStatesindexPatternID: indexPatternID, + notRedirect = false, }) { try { // Check the existence of related index pattern const existIndexPattern = await existsIndexPattern(indexPatternID); const indexPattern = existIndexPattern; - // If the idnex pattern does not exist, then check the existence of index + // If the index pattern does not exist, then check the existence of index if (existIndexPattern?.error?.statusCode === HTTP_STATUS_CODES.NOT_FOUND) { // Check the existence of indices const { exist, fields } = await existsIndices(indexPatternID); @@ -41,7 +42,7 @@ export async function validateVulnerabilitiesStateDataSources({ }, }; } - // If the some index match the index pattern, then create the index pattern + // If some index matches the index pattern, then create the index pattern const resultCreateIndexPattern = await createIndexPattern( indexPatternID, fields, @@ -64,7 +65,9 @@ export async function validateVulnerabilitiesStateDataSources({ problem in the Events tabs related there are no implicit filters when accessing if the HOC that protect the view is passed. */ - NavigationService.getInstance().navigateToApp(vulnerabilityDetection.id); + if (!notRedirect) { + NavigationService.getInstance().navigateToApp(vulnerabilityDetection.id); + } } return { ok: false, From 15d49c2fde853a451b3a1157a53e591da507fa0d Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Fri, 18 Oct 2024 10:45:29 -0300 Subject: [PATCH 11/21] Move vuls panel --- .../vuls_panel/vuls_welcome_panel.tsx | 61 +++++++++++-------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index c39ff02da0..b7a5525f98 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -31,6 +31,34 @@ import { withErrorBoundary } from '../../../../common/hocs'; import { compose } from 'redux'; import { withVulnerabilitiesStateDataSource } from '../../../../../components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern'; + +const VulsPanelContent = ( + { agent, dataSource, topPackagesData, severities, renderSeverityStats }, +) => { + return ( + <> + + + {Object.keys(severities).reverse().map(renderSeverityStats)} + + + + + + + ) +} + +const PanelWithVulnerabilitiesState = compose( + withErrorBoundary, + withVulnerabilitiesStateDataSource, +)(VulsPanelContent); + + export default function VulsPanel({ agent }) { const { dataSource, @@ -84,11 +112,15 @@ export default function VulsPanel({ agent }) { if (isDataSourceLoading) { return; } + setIsLoading(true); Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) - .then(() => setIsLoading(false)) .catch(error => { + // ToDo: Handle error + console.error(error); + }) + .finally(() => { setIsLoading(false); - }); + }) }, [isDataSourceLoading, agent.id]); const getSeverityValue = severity => { @@ -132,29 +164,6 @@ export default function VulsPanel({ agent }) { ); }; - const VulsPanelContent = () => { - return ( - <> - - - {Object.keys(severities).reverse().map(renderSeverityStats)} - - - - - - - ) - } - - const PanelWithVulnerabilitiesState = compose( - withErrorBoundary, - withVulnerabilitiesStateDataSource, - )(VulsPanelContent); return ( @@ -191,7 +200,7 @@ export default function VulsPanel({ agent }) {
- +
From f71c0711d0eab6376f775da81376e6ca2b1e597d Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Fri, 18 Oct 2024 10:47:04 -0300 Subject: [PATCH 12/21] Change redirect in hoc --- .../hocs/validate-vulnerabilities-states-index-pattern.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx index 9fd4bb5cbb..29375f24ca 100644 --- a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx @@ -18,7 +18,7 @@ const INDEX_PATTERN_CREATION_NO_INDEX = 'INDEX_PATTERN_CREATION_NO_INDEX'; export async function validateVulnerabilitiesStateDataSources({ vulnerabilitiesStatesindexPatternID: indexPatternID, - notRedirect = false, + redirect = true, }) { try { // Check the existence of related index pattern @@ -65,7 +65,7 @@ export async function validateVulnerabilitiesStateDataSources({ problem in the Events tabs related there are no implicit filters when accessing if the HOC that protect the view is passed. */ - if (!notRedirect) { + if (redirect) { NavigationService.getInstance().navigateToApp(vulnerabilityDetection.id); } } From c9185212f381be3e463e4a1acb6d687619614771 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Fri, 18 Oct 2024 11:56:26 -0300 Subject: [PATCH 13/21] Remove unnecessary redirect --- ...alidate-vulnerabilities-states-index-pattern.tsx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx index 29375f24ca..154cd65fcd 100644 --- a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx @@ -17,8 +17,7 @@ import { HTTP_STATUS_CODES } from '../../../../../../common/constants'; const INDEX_PATTERN_CREATION_NO_INDEX = 'INDEX_PATTERN_CREATION_NO_INDEX'; export async function validateVulnerabilitiesStateDataSources({ - vulnerabilitiesStatesindexPatternID: indexPatternID, - redirect = true, + vulnerabilitiesStatesindexPatternID: indexPatternID }) { try { // Check the existence of related index pattern @@ -58,16 +57,6 @@ export async function validateVulnerabilitiesStateDataSources({ }, }; } - /* WORKAROUND: Redirect to the root of Vulnerabilities Detection application that should - redirects to the Dashboard tab. We want to redirect to this view, because we need the - component is visible (visualizations) to ensure the process that defines the filters for the - Events tab is run when the Dashboard component is unmounted. This workaround solves a - problem in the Events tabs related there are no implicit filters when accessing if the HOC - that protect the view is passed. - */ - if (redirect) { - NavigationService.getInstance().navigateToApp(vulnerabilityDetection.id); - } } return { ok: false, From 59fa115177c810196cd33e54fc562a24005ff2e2 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Fri, 18 Oct 2024 11:57:00 -0300 Subject: [PATCH 14/21] Add HOC to create pattern if not exist --- .../vuls_panel/vuls_welcome_panel.tsx | 347 +++++++++--------- 1 file changed, 172 insertions(+), 175 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index b7a5525f98..0d44a86f5f 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -1,25 +1,25 @@ import { - EuiPanel, - EuiFlexGroup, - EuiFlexItem, - EuiText, - EuiToolTip, - EuiButtonIcon, - EuiSpacer, - EuiLink, - EuiTitle, + EuiPanel, + EuiFlexGroup, + EuiFlexItem, + EuiText, + EuiToolTip, + EuiButtonIcon, + EuiSpacer, + EuiLink, + EuiTitle, } from '@elastic/eui'; import React, { Fragment, useEffect, useState } from 'react'; import { VulsTopPackageTable } from '../top_packages_table'; import VulsSeverityStat from '../vuls_severity_stat/vuls_severity_stat'; import { - PatternDataSourceFilterManager, - PatternDataSource, - tParsedIndexPattern, - useDataSource, - FILTER_OPERATOR, - VulnerabilitiesDataSourceRepository, - VulnerabilitiesDataSource, + PatternDataSourceFilterManager, + PatternDataSource, + tParsedIndexPattern, + useDataSource, + FILTER_OPERATOR, + VulnerabilitiesDataSourceRepository, + VulnerabilitiesDataSource, } from '../../../data-source'; import { severities } from '../../../../../controllers/overview/components/last-alerts-stat/last-alerts-stat'; import { getCore } from '../../../../../kibana-services'; @@ -32,177 +32,174 @@ import { compose } from 'redux'; import { withVulnerabilitiesStateDataSource } from '../../../../../components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern'; -const VulsPanelContent = ( - { agent, dataSource, topPackagesData, severities, renderSeverityStats }, -) => { - return ( - <> - - - {Object.keys(severities).reverse().map(renderSeverityStats)} - - - - - - - ) -} - -const PanelWithVulnerabilitiesState = compose( - withErrorBoundary, - withVulnerabilitiesStateDataSource, -)(VulsPanelContent); - - -export default function VulsPanel({ agent }) { - const { - dataSource, - isLoading: isDataSourceLoading, - fetchData, - } = useDataSource({ - DataSource: VulnerabilitiesDataSource, - repository: new VulnerabilitiesDataSourceRepository(), - }); +const VulsPanelContent = ({ agent }) => { + const { + dataSource, + isLoading: isDataSourceLoading, + fetchData, + } = useDataSource({ + DataSource: VulnerabilitiesDataSource, + repository: new VulnerabilitiesDataSourceRepository(), + }); - const [isLoading, setIsLoading] = useState(true); - const [severityStats, setSeverityStats] = useState(null); - const [topPackagesData, setTopPackagesData] = useState([]); + const [isLoading, setIsLoading] = useState(true); + const [severityStats, setSeverityStats] = useState(null); + const [topPackagesData, setTopPackagesData] = useState([]); - const fetchSeverityStatsData = async () => { - const data = await fetchData({ - aggs: { - severity: { - terms: { - field: 'vulnerability.severity', - size: 5, - order: { - _count: 'desc', + const fetchSeverityStatsData = async () => { + const data = await fetchData({ + aggs: { + severity: { + terms: { + field: 'vulnerability.severity', + size: 5, + order: { + _count: 'desc', + }, + }, + }, }, - }, - }, - }, - }); - setSeverityStats(data.aggregations.severity.buckets); - }; + }); + setSeverityStats(data.aggregations.severity.buckets); + }; - const fetchTopPackagesData = async () => { - fetchData({ - aggs: { - package: { - terms: { - field: 'package.name', - size: 5, - order: { - _count: 'desc', + const fetchTopPackagesData = async () => { + fetchData({ + aggs: { + package: { + terms: { + field: 'package.name', + size: 5, + order: { + _count: 'desc', + }, + }, + }, }, - }, - }, - }, - }).then(results => { - setTopPackagesData(results.aggregations.package.buckets); - }); - }; + }).then(results => { + setTopPackagesData(results.aggregations.package.buckets); + }); + }; - useEffect(() => { - if (isDataSourceLoading) { - return; - } - setIsLoading(true); - Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) - .catch(error => { - // ToDo: Handle error - console.error(error); - }) - .finally(() => { - setIsLoading(false); - }) - }, [isDataSourceLoading, agent.id]); + useEffect(() => { + if (isDataSourceLoading) { + return; + } + setIsLoading(true); + Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) + .catch(error => { + // ToDo: Handle error + console.error(error); + }) + .finally(() => { + setIsLoading(false); + }) + }, [isDataSourceLoading, agent.id]); - const getSeverityValue = severity => { - const value = - severityStats?.find(v => v.key.toUpperCase() === severity.toUpperCase()) - ?.doc_count || '-'; - return value ? `${value} ${severity}` : '-'; - }; + const getSeverityValue = severity => { + const value = + severityStats?.find(v => v.key.toUpperCase() === severity.toUpperCase()) + ?.doc_count || '0'; + return value ? `${value} ${severity}` : '0'; + }; - const renderSeverityStats = (severity, index) => { - const severityLabel = severities[severity].label; - const severityColor = severities[severity].color; - return ( - - - - - - - + const renderSeverityStats = (severity, index) => { + const severityLabel = severities[severity].label; + const severityColor = severities[severity].color; + return ( + + + + + + + + + + - - - - ); - }; + ); + }; - return ( - - - - - - -

Vulnerability Detection

-
+ return ( + + + + {Object.keys(severities).reverse().map(renderSeverityStats)} + - - - - - - + + - -
- - - -
-
- ); + ); +} + +const PanelWithVulnerabilitiesState = compose( + withErrorBoundary, + withVulnerabilitiesStateDataSource, +)(VulsPanelContent); + +const VulsPanel = ({ agent }) => { + return ( + + + + + + +

Vulnerability Detection

+
+
+ + + + + + + +
+
+ + +
+
+ ) } + +export default VulsPanel; \ No newline at end of file From 31a6d4edfe8dacd54455d04fd930dae7784efdd3 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Fri, 18 Oct 2024 12:03:39 -0300 Subject: [PATCH 15/21] Apply prettier --- .../common/search-bar/use-search-bar.test.ts | 10 +- .../vuls_panel/vuls_welcome_panel.tsx | 337 +++++++++--------- ...e-vulnerabilities-states-index-pattern.tsx | 2 +- 3 files changed, 174 insertions(+), 175 deletions(-) diff --git a/plugins/main/public/components/common/search-bar/use-search-bar.test.ts b/plugins/main/public/components/common/search-bar/use-search-bar.test.ts index 6b0fc60ab1..12e88af7b7 100644 --- a/plugins/main/public/components/common/search-bar/use-search-bar.test.ts +++ b/plugins/main/public/components/common/search-bar/use-search-bar.test.ts @@ -143,7 +143,7 @@ describe('[hook] useSearchBarConfiguration', () => { const { result, waitForNextUpdate } = renderHook(() => useSearchBar({ indexPattern: mockedExampleIndexPatternData as IndexPattern, - setFilters: jest.fn() + setFilters: jest.fn(), }), ); expect(result.current.searchBarProps.indexPatterns).toMatchObject([ @@ -174,11 +174,11 @@ describe('[hook] useSearchBarConfiguration', () => { .mockReturnValue([]); const { result, waitForNextUpdate, rerender } = renderHook( // @ts-ignore - (props) => useSearchBar(props), + props => useSearchBar(props), { initialProps: { indexPattern: mockedExampleIndexPatternData as IndexPattern, - setFilters: jest.fn() + setFilters: jest.fn(), }, }, ); @@ -195,10 +195,10 @@ describe('[hook] useSearchBarConfiguration', () => { .mockResolvedValue(newExampleIndexPatternData); rerender({ indexPattern: newExampleIndexPatternData as IndexPattern, - setFilters: jest.fn() + setFilters: jest.fn(), }); expect(result.current.searchBarProps.indexPatterns).toMatchObject([ newExampleIndexPatternData, ]); - }) + }); }); diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index 0d44a86f5f..758764200c 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -1,25 +1,25 @@ import { - EuiPanel, - EuiFlexGroup, - EuiFlexItem, - EuiText, - EuiToolTip, - EuiButtonIcon, - EuiSpacer, - EuiLink, - EuiTitle, + EuiPanel, + EuiFlexGroup, + EuiFlexItem, + EuiText, + EuiToolTip, + EuiButtonIcon, + EuiSpacer, + EuiLink, + EuiTitle, } from '@elastic/eui'; import React, { Fragment, useEffect, useState } from 'react'; import { VulsTopPackageTable } from '../top_packages_table'; import VulsSeverityStat from '../vuls_severity_stat/vuls_severity_stat'; import { - PatternDataSourceFilterManager, - PatternDataSource, - tParsedIndexPattern, - useDataSource, - FILTER_OPERATOR, - VulnerabilitiesDataSourceRepository, - VulnerabilitiesDataSource, + PatternDataSourceFilterManager, + PatternDataSource, + tParsedIndexPattern, + useDataSource, + FILTER_OPERATOR, + VulnerabilitiesDataSourceRepository, + VulnerabilitiesDataSource, } from '../../../data-source'; import { severities } from '../../../../../controllers/overview/components/last-alerts-stat/last-alerts-stat'; import { getCore } from '../../../../../kibana-services'; @@ -31,175 +31,174 @@ import { withErrorBoundary } from '../../../../common/hocs'; import { compose } from 'redux'; import { withVulnerabilitiesStateDataSource } from '../../../../../components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern'; - const VulsPanelContent = ({ agent }) => { - const { - dataSource, - isLoading: isDataSourceLoading, - fetchData, - } = useDataSource({ - DataSource: VulnerabilitiesDataSource, - repository: new VulnerabilitiesDataSourceRepository(), - }); + const { + dataSource, + isLoading: isDataSourceLoading, + fetchData, + } = useDataSource({ + DataSource: VulnerabilitiesDataSource, + repository: new VulnerabilitiesDataSourceRepository(), + }); - const [isLoading, setIsLoading] = useState(true); - const [severityStats, setSeverityStats] = useState(null); - const [topPackagesData, setTopPackagesData] = useState([]); + const [isLoading, setIsLoading] = useState(true); + const [severityStats, setSeverityStats] = useState(null); + const [topPackagesData, setTopPackagesData] = useState([]); - const fetchSeverityStatsData = async () => { - const data = await fetchData({ - aggs: { - severity: { - terms: { - field: 'vulnerability.severity', - size: 5, - order: { - _count: 'desc', - }, - }, - }, + const fetchSeverityStatsData = async () => { + const data = await fetchData({ + aggs: { + severity: { + terms: { + field: 'vulnerability.severity', + size: 5, + order: { + _count: 'desc', }, - }); - setSeverityStats(data.aggregations.severity.buckets); - }; + }, + }, + }, + }); + setSeverityStats(data.aggregations.severity.buckets); + }; - const fetchTopPackagesData = async () => { - fetchData({ - aggs: { - package: { - terms: { - field: 'package.name', - size: 5, - order: { - _count: 'desc', - }, - }, - }, + const fetchTopPackagesData = async () => { + fetchData({ + aggs: { + package: { + terms: { + field: 'package.name', + size: 5, + order: { + _count: 'desc', }, - }).then(results => { - setTopPackagesData(results.aggregations.package.buckets); - }); - }; - - useEffect(() => { - if (isDataSourceLoading) { - return; - } - setIsLoading(true); - Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) - .catch(error => { - // ToDo: Handle error - console.error(error); - }) - .finally(() => { - setIsLoading(false); - }) - }, [isDataSourceLoading, agent.id]); - - const getSeverityValue = severity => { - const value = - severityStats?.find(v => v.key.toUpperCase() === severity.toUpperCase()) - ?.doc_count || '0'; - return value ? `${value} ${severity}` : '0'; - }; + }, + }, + }, + }).then(results => { + setTopPackagesData(results.aggregations.package.buckets); + }); + }; - const renderSeverityStats = (severity, index) => { - const severityLabel = severities[severity].label; - const severityColor = severities[severity].color; - return ( - - - - - - - - - - - - ); - }; + useEffect(() => { + if (isDataSourceLoading) { + return; + } + setIsLoading(true); + Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) + .catch(error => { + // ToDo: Handle error + console.error(error); + }) + .finally(() => { + setIsLoading(false); + }); + }, [isDataSourceLoading, agent.id]); + const getSeverityValue = severity => { + const value = + severityStats?.find(v => v.key.toUpperCase() === severity.toUpperCase()) + ?.doc_count || '0'; + return value ? `${value} ${severity}` : '0'; + }; + const renderSeverityStats = (severity, index) => { + const severityLabel = severities[severity].label; + const severityColor = severities[severity].color; return ( - - - - {Object.keys(severities).reverse().map(renderSeverityStats)} - - - - + + + + + + - + + +
); -} + }; + + return ( + + + + {Object.keys(severities).reverse().map(renderSeverityStats)} + + + + + + + ); +}; const PanelWithVulnerabilitiesState = compose( - withErrorBoundary, - withVulnerabilitiesStateDataSource, + withErrorBoundary, + withVulnerabilitiesStateDataSource, )(VulsPanelContent); const VulsPanel = ({ agent }) => { - return ( - - - - - - -

Vulnerability Detection

-
-
- - - - - - - -
-
- - -
-
- ) -} + return ( + + + + + + +

Vulnerability Detection

+
+
+ + + + + + + +
+
+ + +
+
+ ); +}; -export default VulsPanel; \ No newline at end of file +export default VulsPanel; diff --git a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx index 154cd65fcd..8468fa3f7a 100644 --- a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx @@ -17,7 +17,7 @@ import { HTTP_STATUS_CODES } from '../../../../../../common/constants'; const INDEX_PATTERN_CREATION_NO_INDEX = 'INDEX_PATTERN_CREATION_NO_INDEX'; export async function validateVulnerabilitiesStateDataSources({ - vulnerabilitiesStatesindexPatternID: indexPatternID + vulnerabilitiesStatesindexPatternID: indexPatternID, }) { try { // Check the existence of related index pattern From f9c69ac0fc5319c7bc05a1db77b3186dd74b8564 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra <6089438+Machi3mfl@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:58:32 -0300 Subject: [PATCH 16/21] Remove unused imports Co-authored-by: Guido Modarelli <38738725+guidomodarelli@users.noreply.github.com> --- .../components/vuls_severity_stat/vuls_severity_stat.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx index 50ec76e197..36883351df 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_severity_stat/vuls_severity_stat.tsx @@ -1,7 +1,5 @@ -import React, { useState, useEffect } from 'react'; +import React from 'react'; import { EuiStat, EuiStatProps } from '@elastic/eui'; -import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; -import { tUseDataSourceLoadedReturns } from '../../../data-source/hooks/use-data-source'; type VulsSeverityStatProps = { value: string; From 08428881d31cf46d71d5765deeb6ace462d797f4 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra <6089438+Machi3mfl@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:59:09 -0300 Subject: [PATCH 17/21] Remove unused imports Co-authored-by: Guido Modarelli <38738725+guidomodarelli@users.noreply.github.com> --- .../components/top_packages_table/top_packages_table.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx index 631f1ec052..f405ade847 100644 --- a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx +++ b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx @@ -12,17 +12,14 @@ * Find more information about this on the LICENSE file. */ -import React, { useState, useEffect, Fragment } from 'react'; +import React, { useState, useEffect } from 'react'; import { EuiBasicTable, EuiFlexItem, EuiPanel, EuiSpacer, EuiText, - EuiButtonIcon, EuiFlexGroup, - EuiToolTip, - EuiLink, } from '@elastic/eui'; // @ts-ignore import { getDataPlugin } from '../../../../../kibana-services'; From fc6f1779f0b53f7fb1018d1499af7137c8819f36 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Mon, 28 Oct 2024 12:52:11 -0300 Subject: [PATCH 18/21] Remove unused code --- .../top_packages_table/top_packages_table.tsx | 16 --------------- .../vuls_panel/vuls_welcome_panel.tsx | 20 +++++++++---------- .../vuls_severity_stat/vuls_severity_stat.tsx | 2 -- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx index f405ade847..7ae98623c7 100644 --- a/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx +++ b/plugins/main/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx @@ -30,27 +30,11 @@ import { } from '../../../data-source'; import { WzLink } from '../../../../../components/wz-link/wz-link'; -export function useTimeFilter() { - const { timefilter } = getDataPlugin().query.timefilter; - const [timeFilter, setTimeFilter] = useState(timefilter.getTime()); - useEffect(() => { - const subscription = timefilter - .getTimeUpdate$() - .subscribe(() => setTimeFilter(timefilter.getTime())); - return () => { - subscription.unsubscribe(); - }; - }, []); - return timeFilter; -} - export function VulsTopPackageTable({ agentId, items, indexPatternId }) { const [sort, setSort] = useState({ field: 'doc_count', direction: 'desc', }); - const [data, setData] = useState([]); - const timeFilter = useTimeFilter(); const columns = [ { diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index 758764200c..e667943749 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -6,7 +6,6 @@ import { EuiToolTip, EuiButtonIcon, EuiSpacer, - EuiLink, EuiTitle, } from '@elastic/eui'; import React, { Fragment, useEffect, useState } from 'react'; @@ -112,16 +111,15 @@ const VulsPanelContent = ({ agent }) => { Date: Mon, 28 Oct 2024 12:58:53 -0300 Subject: [PATCH 19/21] Apply prettier --- .../vuls_panel/vuls_welcome_panel.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx index e667943749..f6e85e0413 100644 --- a/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx +++ b/plugins/main/public/components/common/welcome/components/vuls_panel/vuls_welcome_panel.tsx @@ -111,15 +111,16 @@ const VulsPanelContent = ({ agent }) => { Date: Tue, 29 Oct 2024 11:54:47 -0300 Subject: [PATCH 20/21] Resolve conflicts in agents-welcome --- .../common/welcome/agents-welcome.js | 36 ++----------------- .../vuls_panel/vuls_welcome_panel.tsx | 1 - 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/plugins/main/public/components/common/welcome/agents-welcome.js b/plugins/main/public/components/common/welcome/agents-welcome.js index 7f9c418304..61d41e9a2e 100644 --- a/plugins/main/public/components/common/welcome/agents-welcome.js +++ b/plugins/main/public/components/common/welcome/agents-welcome.js @@ -462,45 +462,15 @@ export const AgentsWelcome = compose(
{title}
- - -
+
+ + -
- - - - {' '} - {/* TODO: Replace with SearchBar and replace implementation to get the time range in AgentView component*/} - {}} /> - - - {(this.state.widthWindow < 1150 && ( - - - - - -
- { setIsLoading(true); Promise.all([fetchSeverityStatsData(), fetchTopPackagesData()]) .catch(error => { - // ToDo: Handle error console.error(error); }) .finally(() => { From dc7745ebc9bf220cfe1c78f0611435fceb561c45 Mon Sep 17 00:00:00 2001 From: Maximiliano Ibarra Date: Tue, 29 Oct 2024 13:45:45 -0300 Subject: [PATCH 21/21] Change agents management menu icon --- plugins/main/public/utils/applications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/main/public/utils/applications.ts b/plugins/main/public/utils/applications.ts index 9b07810efd..0351a414f6 100644 --- a/plugins/main/public/utils/applications.ts +++ b/plugins/main/public/utils/applications.ts @@ -904,7 +904,7 @@ export const Categories = [ defaultMessage: 'Agents management', }), order: 600, - euiIconType: 'indexRollupApp', + euiIconType: 'graphApp', }, { id: 'wz-category-server-management',