-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vulnerability detection card in agent overview (#7085)
* Add top packages component * Add vuls severity stat component * Create vuls panel * Add vuls panel in agent overview * Update CHANGELOG * Apply prettier * Fix responsive behavior * Apply prettier * Change vuls panel style * Use vuls data source in agent overview panel * Move vuls panel * Change redirect in hoc * Remove unnecessary redirect * Add HOC to create pattern if not exist * Apply prettier * Remove unused imports Co-authored-by: Guido Modarelli <[email protected]> * Remove unused imports Co-authored-by: Guido Modarelli <[email protected]> * Remove unused code * Apply prettier * Resolve conflicts in agents-welcome * Change agents management menu icon --------- Co-authored-by: Chantal Belén kelm <[email protected]> Co-authored-by: Guido Modarelli <[email protected]> Co-authored-by: Federico Rodriguez <[email protected]>
- Loading branch information
1 parent
bd44194
commit 11cb294
Showing
11 changed files
with
429 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
plugins/main/public/components/common/welcome/components/top_packages_table/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; |
92 changes: 92 additions & 0 deletions
92
...ain/public/components/common/welcome/components/top_packages_table/top_packages_table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* 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 } from 'react'; | ||
import { | ||
EuiBasicTable, | ||
EuiFlexItem, | ||
EuiPanel, | ||
EuiSpacer, | ||
EuiText, | ||
EuiFlexGroup, | ||
} from '@elastic/eui'; | ||
// @ts-ignore | ||
import { getDataPlugin } from '../../../../../kibana-services'; | ||
import { vulnerabilityDetection } from '../../../../../utils/applications'; | ||
import { | ||
PatternDataSourceFilterManager, | ||
FILTER_OPERATOR, | ||
} from '../../../data-source'; | ||
import { WzLink } from '../../../../../components/wz-link/wz-link'; | ||
|
||
export function VulsTopPackageTable({ agentId, items, indexPatternId }) { | ||
const [sort, setSort] = useState({ | ||
field: 'doc_count', | ||
direction: 'desc', | ||
}); | ||
|
||
const columns = [ | ||
{ | ||
field: 'key', | ||
name: 'Package', | ||
sortable: true, | ||
render: field => ( | ||
<WzLink | ||
appId={vulnerabilityDetection.id} | ||
path={`/overview?tab=vuls&tabView=dashboard&agentId=${agentId}&_g=${PatternDataSourceFilterManager.filtersToURLFormat( | ||
[ | ||
PatternDataSourceFilterManager.createFilter( | ||
FILTER_OPERATOR.IS, | ||
`package.name`, | ||
field, | ||
indexPatternId, | ||
), | ||
], | ||
)}`} | ||
> | ||
{field} | ||
</WzLink> | ||
), | ||
}, | ||
{ | ||
field: 'doc_count', | ||
name: 'Count', | ||
sortable: true, | ||
truncateText: true, | ||
width: '100px', | ||
}, | ||
]; | ||
|
||
return ( | ||
<EuiPanel paddingSize='s'> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiText size='xs'> | ||
<h2>Top 5 Packages</h2> | ||
</EuiText> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
<EuiSpacer size='s' /> | ||
<EuiBasicTable | ||
items={items} | ||
columns={columns} | ||
loading={false} | ||
sorting={{ sort }} | ||
onChange={e => setSort(e.sort)} | ||
itemId='top-packages-table' | ||
noItemsMessage='No recent events' | ||
/> | ||
</EuiPanel> | ||
); | ||
} |
Oops, something went wrong.