Skip to content

Commit

Permalink
[Resolver] add comments. (#78301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Austin authored Sep 23, 2020
1 parent e1782c1 commit cb451cd
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
12 changes: 12 additions & 0 deletions x-pack/plugins/security_solution/common/endpoint/models/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ export function timestampAsDateSafeVersion(event: TimestampFields): Date | undef
}
}

/**
* The @timestamp ECS field
*/
export function eventTimestamp(event: SafeResolverEvent): string | undefined | number {
return firstNonNullValue(event['@timestamp']);
}
Expand Down Expand Up @@ -213,12 +216,18 @@ export function eventSequence(event: EventSequenceFields): number | undefined {
return firstNonNullValue(event.event?.sequence);
}

/**
* The event.id ECS field.
*/
export function eventIDSafeVersion(event: SafeResolverEvent): number | undefined | string {
return firstNonNullValue(
isLegacyEventSafeVersion(event) ? event.endgame?.serial_event_id : event.event?.id
);
}

/**
* The event.entity_id field.
*/
export function entityId(event: ResolverEvent): string {
if (isLegacyEvent(event)) {
return event.endgame.unique_pid ? String(event.endgame.unique_pid) : '';
Expand Down Expand Up @@ -258,6 +267,9 @@ export function entityIDSafeVersion(event: EntityIDFields): string | undefined {
}
}

/**
* The process.parent.entity_id ECS field.
*/
export function parentEntityId(event: ResolverEvent): string | undefined {
if (isLegacyEvent(event)) {
return event.endgame.unique_ppid ? String(event.endgame.unique_ppid) : undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export const relatedEventCountByType: (
const stats = statsMap(nodeID);
if (stats) {
const value = Object.prototype.hasOwnProperty.call(stats.events.byCategory, eventType);
if (typeof value === 'number') {
if (typeof value === 'number' && Number.isFinite(value)) {
return value;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,32 @@ import { EuiBreadcrumbs } from '@elastic/eui';
import styled from 'styled-components';
import { EuiDescriptionList } from '@elastic/eui';

/**
* Used by the nodeDetail view to show attributes of the related events.
*/
export const StyledDescriptionList = styled(EuiDescriptionList)`
&.euiDescriptionList.euiDescriptionList--column dt.euiDescriptionList__title.desc-title {
max-width: 10em;
}
`;

/**
* Used by the nodeDetail view for the label of the node.
*/
export const StyledTitle = styled('h4')`
overflow-wrap: break-word;
`;

/**
* Used for a 'BETA' badge in the breadcrumbs of each panel.
*/
export const BetaHeader = styled(`header`)`
margin-bottom: 1em;
`;

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

/**
* Used in the links to nodes on the node list panel.
*/
export const StyledButtonTextContainer = styled.div`
align-items: center;
display: flex;
flex-direction: row;
`;

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

/**
* Used to style the node name in the node list panel view.
*/
export const StyledLabelTitle = styled.div``;

/**
* Used by the node list view. Wraps the title of the node and the 'Analyzed event' marker.
*/
export const StyledLabelContainer = styled.div`
display: inline-block;
flex: 3;
Expand Down

0 comments on commit cb451cd

Please sign in to comment.