Skip to content

Commit

Permalink
K Qualters Review: move types
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Kimmel committed Aug 26, 2020
1 parent 0be1d08 commit e7c1134
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
IndexedProcessNode,
AABB,
VisibleEntites,
SectionData,
} from '../../types';
import {
isGraphableProcess,
Expand Down Expand Up @@ -211,11 +212,6 @@ const objectToDescriptionListEntries = function* (
}
};

type SectionData = Array<{
sectionTitle: string;
entries: Array<{ title: string; description: string }>;
}>;

/**
* Returns a function that returns the information needed to display related event details based on
* the related event's entityID and its own ID.
Expand Down
16 changes: 16 additions & 0 deletions x-pack/plugins/security_solution/public/resolver/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ export interface IndexedProcessNode extends BBox {
position: Vector2;
}

/**
* A type describing the shape of section titles and entries for description lists
*/
export type SectionData = Array<{
sectionTitle: string;
entries: Array<{ title: string; description: string }>;
}>;

/**
* The two query parameters we read/write on to control which view the table presents:
*/
export interface CrumbInfo {
crumbId: string;
crumbEvent: string;
}

/**
* A type containing all things to actually be rendered to the DOM.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import React, { memo, useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiBasicTableColumn, EuiButtonEmpty, EuiSpacer, EuiInMemoryTable } from '@elastic/eui';
import { FormattedMessage } from 'react-intl';
import { CrumbInfo, StyledBreadcrumbs } from './panel_content_utilities';
import { StyledBreadcrumbs } from './panel_content_utilities';

import * as event from '../../../../common/endpoint/models/event';
import { ResolverEvent, ResolverNodeStats } from '../../../../common/endpoint/types';
import { CrumbInfo } from '../../types';

/**
* This view gives counts for all the related events of a process grouped by related event type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import { i18n } from '@kbn/i18n';
import { EuiSpacer, EuiText, EuiButtonEmpty } from '@elastic/eui';
import React, { memo, useMemo } from 'react';
import { CrumbInfo, StyledBreadcrumbs } from './panel_content_utilities';
import { StyledBreadcrumbs } from './panel_content_utilities';
import { CrumbInfo } from '../../types';

/**
* Display an error in the panel when something goes wrong and give the user a way to "retreat" back to a default state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ const BetaHeader = styled(`header`)`
margin-bottom: 1em;
`;

/**
* The two query parameters we read/write on to control which view the table presents:
*/
export interface CrumbInfo {
crumbId: string;
crumbEvent: string;
}

const ThemedBreadcrumbs = styled(EuiBreadcrumbs)<{ background: string; text: string }>`
&.euiBreadcrumbs {
background-color: ${(props) => props.background};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { FormattedMessage } from 'react-intl';
import { EuiDescriptionListProps } from '@elastic/eui/src/components/description_list/description_list';
import * as selectors from '../../store/selectors';
import * as event from '../../../../common/endpoint/models/event';
import { CrumbInfo, formatDate, StyledBreadcrumbs } from './panel_content_utilities';
import { formatDate, StyledBreadcrumbs } from './panel_content_utilities';
import {
processPath,
processPid,
Expand All @@ -31,6 +31,7 @@ import {
import { CubeForProcess } from './cube_for_process';
import { ResolverEvent } from '../../../../common/endpoint/types';
import { useResolverTheme } from '../assets';
import { CrumbInfo } from '../../types';

const StyledDescriptionList = styled(EuiDescriptionList)`
&.euiDescriptionList.euiDescriptionList--column dt.euiDescriptionList__title.desc-title {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useSelector } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import styled from 'styled-components';
import {
CrumbInfo,
formatDate,
StyledBreadcrumbs,
BoldCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import { useSelector } from 'react-redux';
import styled from 'styled-components';
import * as event from '../../../../common/endpoint/models/event';
import * as selectors from '../../store/selectors';
import { CrumbInfo, formatter, StyledBreadcrumbs } from './panel_content_utilities';
import { formatter, StyledBreadcrumbs } from './panel_content_utilities';
import { useResolverDispatch } from '../use_resolver_dispatch';
import { SideEffectContext } from '../side_effect_context';
import { CubeForProcess } from './cube_for_process';
import { SafeResolverEvent } from '../../../../common/endpoint/types';
import { LimitWarning } from '../limit_warnings';
import { CrumbInfo } from '../../types';

const StyledLimitWarning = styled(LimitWarning)`
flex-flow: row wrap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import { EuiSpacer, EuiText, EuiDescriptionList, EuiTextColor, EuiTitle } from '
import styled from 'styled-components';
import { useSelector } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import { CrumbInfo, StyledBreadcrumbs, BoldCode, StyledTime } from './panel_content_utilities';
import { StyledBreadcrumbs, BoldCode, StyledTime } from './panel_content_utilities';
import * as event from '../../../../common/endpoint/models/event';
import { ResolverEvent } from '../../../../common/endpoint/types';
import * as selectors from '../../store/selectors';
import { useResolverDispatch } from '../use_resolver_dispatch';
import { PanelContentError } from './panel_content_error';
import { CrumbInfo } from '../../types';

// Adding some styles to prevent horizontal scrollbars, per request from UX review
const StyledDescriptionList = memo(styled(EuiDescriptionList)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import { useCallback, useMemo } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import { useQueryStringKeys } from './use_query_string_keys';
import { CrumbInfo } from './panels/panel_content_utilities';
import { CrumbInfo } from '../types';


export function useResolverQueryParams() {
/**
Expand Down

0 comments on commit e7c1134

Please sign in to comment.