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

Change key prop in rule.mitre.id column render #6715

Merged
merged 3 commits into from
May 30, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,70 +12,81 @@ const navigateTo = (ev, section, params) => {
AppNavigate.navigateToModule(ev, section, params);
};

const renderMitreTechnique = (technique: string) => <EuiLink
onClick={e =>
navigateTo(e, 'overview', {
tab: 'mitre',
tabView: 'intelligence',
tabRedirect: 'techniques',
idToRedirect: technique,
})
}
>
{technique}
</EuiLink>
const renderMitreTechnique = (technique: string) => (
<EuiLink
onClick={e =>
navigateTo(e, 'overview', {
tab: 'mitre',
tabView: 'intelligence',
tabRedirect: 'techniques',
idToRedirect: technique,
})
}
>
{technique}
</EuiLink>
);

export const wzDiscoverRenderColumns: tDataGridRenderColumn[] = [
{
id: 'agent.id',
render: (value) => {
if (value === '000') return value
render: value => {
if (value === '000') return value;

return <RedirectAppLinks application={getCore().application}>
<EuiLink
href={`${endpointSummary.id}#/agents?tab=welcome&agent=${value}`}
>
{value}
</EuiLink>
</RedirectAppLinks>
}
return (
<RedirectAppLinks application={getCore().application}>
<EuiLink
href={`${endpointSummary.id}#/agents?tab=welcome&agent=${value}`}
>
{value}
</EuiLink>
</RedirectAppLinks>
);
},
},
{
id: 'agent.name',
render: (value, row) => {
if (row.agent.id === '000') return value
if (row.agent.id === '000') return value;

return <RedirectAppLinks application={getCore().application}>
<EuiLink
href={`${endpointSummary.id}#/agents?tab=welcome&agent=${row.agent.id}`}
>
{value}
</EuiLink>
</RedirectAppLinks>
}
return (
<RedirectAppLinks application={getCore().application}>
<EuiLink
href={`${endpointSummary.id}#/agents?tab=welcome&agent=${row.agent.id}`}
>
{value}
</EuiLink>
</RedirectAppLinks>
);
},
},
{
id: 'rule.id',
render: (value) => <RedirectAppLinks application={getCore().application}>
<EuiLink href={`${rules.id}#/manager/?tab=rules&redirectRule=${value}`}>
{value}
</EuiLink>
</RedirectAppLinks>
render: value => (
<RedirectAppLinks application={getCore().application}>
<EuiLink href={`${rules.id}#/manager/?tab=rules&redirectRule=${value}`}>
{value}
</EuiLink>
</RedirectAppLinks>
),
},
{
id: 'rule.mitre.id',
render: (value) => Array.isArray(value) ? <div style={{ display: 'flex', gap: 10 }}>
{value?.map(technique => (
<div key={technique}>
{renderMitreTechnique(technique)}
render: value =>
Array.isArray(value) ? (
<div style={{ display: 'flex', gap: 10 }}>
{value?.map((technique, index) => (
<div key={`${technique}-${index}`}>
{renderMitreTechnique(technique)}
</div>
))}
</div>
))}
</div> : <div>
{renderMitreTechnique(value)}
</div>
) : (
<div>{renderMitreTechnique(value)}</div>
),
},
{
id: 'timestamp',
render: (value) => formatUIDate(value)
render: value => formatUIDate(value),
},
]
];
Loading