Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data.vulnerability.reference field formatting fix on tables and flyouts #7177

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed the check updates UI was displayed despite it could be configured as disabled [#7156](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7156)
- Fixed filter by value in document details in safari [#7151](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7151)
- Fixed error message to prevent pass no strings to the wazuh logger [#7167](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7167)
- Fixed the rendering of the `data.vunerability.reference` in the table and flyout [#7177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7177)

### Removed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { EuiText, EuiLink, EuiToolTip } from '@elastic/eui';
import { EuiLink, EuiToolTip } from '@elastic/eui';
import { tDataGridRenderColumn } from '../data-grid';
import {
endpointSummary,
Expand All @@ -15,6 +15,38 @@ const renderRequirementsSecurityOperations = (value: []) => {
return <span>{Array.isArray(value) ? value.join(', ') : value}</span>;
};

const renderLinksReference = (value: string) => {
if (!value) {
return '-';
}

const links = (
<>
{/* We separated the reference value since it is a string separated by
commas, causing an issue when returning 2 links. */}
{value?.split(', ').map((link, index) => (
<span key={index}>
{!!index && ', '}
<EuiToolTip
position='top'
content='Navigate to the vulnerability reference'
>
<EuiLink
href={link}
target='_blank'
rel='noopener noreferrer'
external
>
{link}
</EuiLink>
</EuiToolTip>
</span>
))}
</>
);
return links;
};

const renderMitreTechnique = technique => (
<WzLink
appId={mitreAttack.id}
Expand Down Expand Up @@ -75,35 +107,13 @@ export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [
);
},
},
{
id: 'data.vulnerability.reference',
render: renderLinksReference,
},
{
id: 'vulnerability.reference',
render: value => {
const links = (
<>
{/* We separated the reference value since it is a string separated by
commas, causing an issue when returning 2 links. */}
{value?.split(', ').map((link, index) => (
<span key={index}>
{!!index && ', '}
<EuiToolTip
position='top'
content='Navigate to the vulnerability reference'
>
<EuiLink
href={link}
target='_blank'
rel='noopener noreferrer'
external
>
{link}
</EuiLink>
</EuiToolTip>
</span>
))}
</>
);
return links;
},
render: renderLinksReference,
},
{
id: 'rule.id',
Expand Down
Loading
Loading