Skip to content

Commit 42ca330

Browse files
yenienserranochantal-kelmasteriscos
authored
Change key prop in rule.mitre.id column render (#6715)
Co-authored-by: Chantal Belén kelm <99441266+chantal-kelm@users.noreply.github.com> Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
1 parent 8d87fe2 commit 42ca330

File tree

1 file changed

+57
-46
lines changed

1 file changed

+57
-46
lines changed

plugins/main/public/components/common/wazuh-discover/render-columns.tsx

Lines changed: 57 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,70 +12,81 @@ const navigateTo = (ev, section, params) => {
1212
AppNavigate.navigateToModule(ev, section, params);
1313
};
1414

15-
const renderMitreTechnique = (technique: string) => <EuiLink
16-
onClick={e =>
17-
navigateTo(e, 'overview', {
18-
tab: 'mitre',
19-
tabView: 'intelligence',
20-
tabRedirect: 'techniques',
21-
idToRedirect: technique,
22-
})
23-
}
24-
>
25-
{technique}
26-
</EuiLink>
15+
const renderMitreTechnique = (technique: string) => (
16+
<EuiLink
17+
onClick={e =>
18+
navigateTo(e, 'overview', {
19+
tab: 'mitre',
20+
tabView: 'intelligence',
21+
tabRedirect: 'techniques',
22+
idToRedirect: technique,
23+
})
24+
}
25+
>
26+
{technique}
27+
</EuiLink>
28+
);
2729

2830
export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [
2931
{
3032
id: 'agent.id',
31-
render: (value) => {
32-
if (value === '000') return value
33+
render: value => {
34+
if (value === '000') return value;
3335

34-
return <RedirectAppLinks application={getCore().application}>
35-
<EuiLink
36-
href={`${endpointSummary.id}#/agents?tab=welcome&agent=${value}`}
37-
>
38-
{value}
39-
</EuiLink>
40-
</RedirectAppLinks>
41-
}
36+
return (
37+
<RedirectAppLinks application={getCore().application}>
38+
<EuiLink
39+
href={`${endpointSummary.id}#/agents?tab=welcome&agent=${value}`}
40+
>
41+
{value}
42+
</EuiLink>
43+
</RedirectAppLinks>
44+
);
45+
},
4246
},
4347
{
4448
id: 'agent.name',
4549
render: (value, row) => {
46-
if (row.agent.id === '000') return value
50+
if (row.agent.id === '000') return value;
4751

48-
return <RedirectAppLinks application={getCore().application}>
49-
<EuiLink
50-
href={`${endpointSummary.id}#/agents?tab=welcome&agent=${row.agent.id}`}
51-
>
52-
{value}
53-
</EuiLink>
54-
</RedirectAppLinks>
55-
}
52+
return (
53+
<RedirectAppLinks application={getCore().application}>
54+
<EuiLink
55+
href={`${endpointSummary.id}#/agents?tab=welcome&agent=${row.agent.id}`}
56+
>
57+
{value}
58+
</EuiLink>
59+
</RedirectAppLinks>
60+
);
61+
},
5662
},
5763
{
5864
id: 'rule.id',
59-
render: (value) => <RedirectAppLinks application={getCore().application}>
60-
<EuiLink href={`${rules.id}#/manager/?tab=rules&redirectRule=${value}`}>
61-
{value}
62-
</EuiLink>
63-
</RedirectAppLinks>
65+
render: value => (
66+
<RedirectAppLinks application={getCore().application}>
67+
<EuiLink href={`${rules.id}#/manager/?tab=rules&redirectRule=${value}`}>
68+
{value}
69+
</EuiLink>
70+
</RedirectAppLinks>
71+
),
6472
},
6573
{
6674
id: 'rule.mitre.id',
67-
render: (value) => Array.isArray(value) ? <div style={{ display: 'flex', gap: 10 }}>
68-
{value?.map(technique => (
69-
<div key={technique}>
70-
{renderMitreTechnique(technique)}
75+
render: value =>
76+
Array.isArray(value) ? (
77+
<div style={{ display: 'flex', gap: 10 }}>
78+
{value?.map((technique, index) => (
79+
<div key={`${technique}-${index}`}>
80+
{renderMitreTechnique(technique)}
81+
</div>
82+
))}
7183
</div>
72-
))}
73-
</div> : <div>
74-
{renderMitreTechnique(value)}
75-
</div>
84+
) : (
85+
<div>{renderMitreTechnique(value)}</div>
86+
),
7687
},
7788
{
7889
id: 'timestamp',
79-
render: (value) => formatUIDate(value)
90+
render: value => formatUIDate(value),
8091
},
81-
]
92+
];

0 commit comments

Comments
 (0)