Skip to content

Commit 41be0f3

Browse files
Robert Austinelasticmachine
andauthored
[Resolver] add comments. (#78301) (#78333)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 8f456ba commit 41be0f3

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

x-pack/plugins/security_solution/common/endpoint/models/event.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ export function timestampAsDateSafeVersion(event: TimestampFields): Date | undef
104104
}
105105
}
106106

107+
/**
108+
* The @timestamp ECS field
109+
*/
107110
export function eventTimestamp(event: SafeResolverEvent): string | undefined | number {
108111
return firstNonNullValue(event['@timestamp']);
109112
}
@@ -213,12 +216,18 @@ export function eventSequence(event: EventSequenceFields): number | undefined {
213216
return firstNonNullValue(event.event?.sequence);
214217
}
215218

219+
/**
220+
* The event.id ECS field.
221+
*/
216222
export function eventIDSafeVersion(event: SafeResolverEvent): number | undefined | string {
217223
return firstNonNullValue(
218224
isLegacyEventSafeVersion(event) ? event.endgame?.serial_event_id : event.event?.id
219225
);
220226
}
221227

228+
/**
229+
* The event.entity_id field.
230+
*/
222231
export function entityId(event: ResolverEvent): string {
223232
if (isLegacyEvent(event)) {
224233
return event.endgame.unique_pid ? String(event.endgame.unique_pid) : '';
@@ -258,6 +267,9 @@ export function entityIDSafeVersion(event: EntityIDFields): string | undefined {
258267
}
259268
}
260269

270+
/**
271+
* The process.parent.entity_id ECS field.
272+
*/
261273
export function parentEntityId(event: ResolverEvent): string | undefined {
262274
if (isLegacyEvent(event)) {
263275
return event.endgame.unique_ppid ? String(event.endgame.unique_ppid) : undefined;

x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export const relatedEventCountByType: (
274274
const stats = statsMap(nodeID);
275275
if (stats) {
276276
const value = Object.prototype.hasOwnProperty.call(stats.events.byCategory, eventType);
277-
if (typeof value === 'number') {
277+
if (typeof value === 'number' && Number.isFinite(value)) {
278278
return value;
279279
}
280280
}

x-pack/plugins/security_solution/public/resolver/view/panels/styles.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,32 @@ import { EuiBreadcrumbs } from '@elastic/eui';
1111
import styled from 'styled-components';
1212
import { EuiDescriptionList } from '@elastic/eui';
1313

14+
/**
15+
* Used by the nodeDetail view to show attributes of the related events.
16+
*/
1417
export const StyledDescriptionList = styled(EuiDescriptionList)`
1518
&.euiDescriptionList.euiDescriptionList--column dt.euiDescriptionList__title.desc-title {
1619
max-width: 10em;
1720
}
1821
`;
1922

23+
/**
24+
* Used by the nodeDetail view for the label of the node.
25+
*/
2026
export const StyledTitle = styled('h4')`
2127
overflow-wrap: break-word;
2228
`;
2329

30+
/**
31+
* Used for a 'BETA' badge in the breadcrumbs of each panel.
32+
*/
2433
export const BetaHeader = styled(`header`)`
2534
margin-bottom: 1em;
2635
`;
2736

37+
/**
38+
* Styled version of EuiBreadcrumbs that is used by the breadcrumbs in each panel.
39+
*/
2840
export const ThemedBreadcrumbs = styled(EuiBreadcrumbs)<{ background: string; text: string }>`
2941
&.euiBreadcrumbs {
3042
background-color: ${(props) => props.background};
@@ -38,20 +50,32 @@ export const ThemedBreadcrumbs = styled(EuiBreadcrumbs)<{ background: string; te
3850
}
3951
`;
4052

53+
/**
54+
* Used in the links to nodes on the node list panel.
55+
*/
4156
export const StyledButtonTextContainer = styled.div`
4257
align-items: center;
4358
display: flex;
4459
flex-direction: row;
4560
`;
4661

62+
/**
63+
* Used in the node list panel to call out the event that is represented by the databaseDocumentID.
64+
*/
4765
export const StyledAnalyzedEvent = styled.div`
4866
color: ${(props) => props.color};
4967
font-size: 10.5px;
5068
font-weight: 700;
5169
`;
5270

71+
/**
72+
* Used to style the node name in the node list panel view.
73+
*/
5374
export const StyledLabelTitle = styled.div``;
5475

76+
/**
77+
* Used by the node list view. Wraps the title of the node and the 'Analyzed event' marker.
78+
*/
5579
export const StyledLabelContainer = styled.div`
5680
display: inline-block;
5781
flex: 3;

0 commit comments

Comments
 (0)