babel-7
This commit is contained in:
parent
f5a545cdbe
commit
17ec016449
|
@ -18,10 +18,7 @@
|
|||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
require.resolve('@babel/preset-typescript'),
|
||||
require.resolve('@babel/preset-react')
|
||||
],
|
||||
presets: [require.resolve('@babel/preset-typescript'), require.resolve('@babel/preset-react')],
|
||||
plugins: [
|
||||
require.resolve('babel-plugin-add-module-exports'),
|
||||
|
||||
|
@ -37,15 +34,14 @@ module.exports = {
|
|||
{
|
||||
// Babel 7 don't support the namespace feature on typescript code.
|
||||
// With namespaces only used for type declarations, we can securely
|
||||
// strip them off for babel on x-pack infra plugin
|
||||
// strip them off for babel on x-pack infra/siem plugins
|
||||
//
|
||||
// See https://github.com/babel/babel/issues/8244#issuecomment-466548733
|
||||
test: /x-pack[\/\\]plugins[\/\\]infra[\/\\].*[\/\\]graphql/,
|
||||
plugins: [
|
||||
[
|
||||
require.resolve('babel-plugin-typescript-strip-namespaces'),
|
||||
],
|
||||
]
|
||||
}
|
||||
]
|
||||
test: [
|
||||
/x-pack[\/\\]plugins[\/\\]infra[\/\\].*[\/\\]graphql/,
|
||||
/x-pack[\/\\]plugins[\/\\]siem[\/\\].*[\/\\]graphql/,
|
||||
],
|
||||
plugins: [[require.resolve('babel-plugin-typescript-strip-namespaces')]],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ module.exports = () => {
|
|||
// for just the polyfills that the target versions don't already supply
|
||||
// on their own
|
||||
useBuiltIns: 'entry',
|
||||
modules: 'cjs'
|
||||
modules: 'cjs',
|
||||
},
|
||||
],
|
||||
require('./common_preset'),
|
||||
|
@ -45,9 +45,9 @@ module.exports = () => {
|
|||
[
|
||||
require.resolve('babel-plugin-transform-define'),
|
||||
{
|
||||
'global.__BUILT_WITH_BABEL__': 'true'
|
||||
}
|
||||
]
|
||||
]
|
||||
'global.__BUILT_WITH_BABEL__': 'true',
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
{
|
||||
"presets": ["@kbn/babel-preset/webpack_preset"],
|
||||
"plugins": [
|
||||
["@babel/plugin-transform-runtime", {
|
||||
"regenerator": true
|
||||
}]
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{
|
||||
"regenerator": true
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@ import { connect } from 'react-redux';
|
|||
import { pure } from 'recompose';
|
||||
import { Dispatch } from 'redux';
|
||||
|
||||
import { IdToDataProvider } from '../../store/local/drag_and_drop/model';
|
||||
import { dataProvidersSelector } from '../../store/local/drag_and_drop/selectors';
|
||||
import { State } from '../../store/reducer';
|
||||
import { dragAndDropModel, dragAndDropSelectors, State } from '../../store';
|
||||
|
||||
import {
|
||||
addProviderToTimeline,
|
||||
|
@ -22,13 +20,13 @@ import {
|
|||
} from './helpers';
|
||||
|
||||
interface Props {
|
||||
dataProviders?: IdToDataProvider;
|
||||
dataProviders?: dragAndDropModel.IdToDataProvider;
|
||||
dispatch: Dispatch;
|
||||
}
|
||||
|
||||
interface OnDragEndHandlerParams {
|
||||
result: DropResult;
|
||||
dataProviders: IdToDataProvider;
|
||||
dataProviders: dragAndDropModel.IdToDataProvider;
|
||||
dispatch: Dispatch;
|
||||
}
|
||||
|
||||
|
@ -56,10 +54,13 @@ const DragDropContextWrapperComponent = pure<Props>(({ dataProviders, dispatch,
|
|||
</DragDropContext>
|
||||
));
|
||||
|
||||
const emptyDataProviders: IdToDataProvider = {}; // stable reference
|
||||
const emptyDataProviders: dragAndDropModel.IdToDataProvider = {}; // stable reference
|
||||
|
||||
const mapStateToProps = (state: State) => {
|
||||
const dataProviders = defaultTo(emptyDataProviders, dataProvidersSelector(state));
|
||||
const dataProviders = defaultTo(
|
||||
emptyDataProviders,
|
||||
dragAndDropSelectors.dataProvidersSelector(state)
|
||||
);
|
||||
|
||||
return { dataProviders };
|
||||
};
|
||||
|
|
|
@ -17,10 +17,13 @@ import { connect } from 'react-redux';
|
|||
import styled from 'styled-components';
|
||||
import { ActionCreator } from 'typescript-fsa';
|
||||
|
||||
import { dragAndDropActions } from '../../store/local/drag_and_drop';
|
||||
import { IdToDataProvider } from '../../store/local/drag_and_drop/model';
|
||||
import { dataProvidersSelector } from '../../store/local/drag_and_drop/selectors';
|
||||
import { State } from '../../store/reducer';
|
||||
import { State } from '../../store';
|
||||
// This import needs to be directly link to drag_and_drop store or we will have a circular dependency
|
||||
import {
|
||||
dragAndDropActions,
|
||||
dragAndDropModel,
|
||||
dragAndDropSelectors,
|
||||
} from '../../store/drag_and_drop';
|
||||
import { DataProvider } from '../timeline/data_providers/data_provider';
|
||||
import { TruncatableText } from '../truncatable_text';
|
||||
|
||||
|
@ -47,7 +50,7 @@ interface OwnProps {
|
|||
}
|
||||
|
||||
interface StateReduxProps {
|
||||
dataProviders?: IdToDataProvider;
|
||||
dataProviders?: dragAndDropModel.IdToDataProvider;
|
||||
}
|
||||
|
||||
interface DispatchProps {
|
||||
|
@ -123,10 +126,10 @@ class DraggableWrapperComponent extends React.PureComponent<Props> {
|
|||
}
|
||||
}
|
||||
|
||||
const emptyDataProviders: IdToDataProvider = {}; // stable reference
|
||||
const emptyDataProviders: dragAndDropModel.IdToDataProvider = {}; // stable reference
|
||||
|
||||
const mapStateToProps = (state: State) =>
|
||||
defaultTo(emptyDataProviders, dataProvidersSelector(state));
|
||||
defaultTo(emptyDataProviders, dragAndDropSelectors.dataProvidersSelector(state));
|
||||
|
||||
export const DraggableWrapper = connect(
|
||||
mapStateToProps,
|
||||
|
|
|
@ -8,9 +8,7 @@ import { DropResult } from 'react-beautiful-dnd';
|
|||
import { Dispatch } from 'redux';
|
||||
import { ActionCreator } from 'typescript-fsa';
|
||||
|
||||
import { timelineActions } from '../../store';
|
||||
import { dragAndDropActions } from '../../store/local/drag_and_drop';
|
||||
import { IdToDataProvider } from '../../store/local/drag_and_drop/model';
|
||||
import { dragAndDropActions, dragAndDropModel, timelineActions } from '../../store';
|
||||
import { DataProvider } from '../timeline/data_providers/data_provider';
|
||||
|
||||
export const draggableIdPrefix = 'draggableId';
|
||||
|
@ -71,7 +69,7 @@ export const providerWasDroppedOnTimelineButton = (result: DropResult): boolean
|
|||
destinationIsTimelineButton(result);
|
||||
|
||||
interface AddProviderToTimelineParams {
|
||||
dataProviders: IdToDataProvider;
|
||||
dataProviders: dragAndDropModel.IdToDataProvider;
|
||||
result: DropResult;
|
||||
dispatch: Dispatch;
|
||||
addProvider?: ActionCreator<{
|
||||
|
|
|
@ -10,15 +10,14 @@ import { connect } from 'react-redux';
|
|||
import { pure } from 'recompose';
|
||||
import { ActionCreator } from 'typescript-fsa';
|
||||
|
||||
import { appActions, appSelectors, State } from '../../store';
|
||||
import { Error } from '../../store/local/app/model';
|
||||
import { appActions, appModel, appSelectors, State } from '../../store';
|
||||
|
||||
interface OwnProps {
|
||||
toastLifeTimeMs?: number;
|
||||
}
|
||||
|
||||
interface ReduxProps {
|
||||
errors?: Error[];
|
||||
errors?: appModel.Error[];
|
||||
}
|
||||
|
||||
interface DispatchProps {
|
||||
|
@ -45,7 +44,7 @@ export const globalListFromToasts = (
|
|||
/>
|
||||
) : null;
|
||||
|
||||
export const errorsToToasts = (errors: Error[]): Toast[] =>
|
||||
export const errorsToToasts = (errors: appModel.Error[]): Toast[] =>
|
||||
errors.map(({ id, title, message }) => {
|
||||
const toast: Toast = {
|
||||
id,
|
||||
|
|
|
@ -59,7 +59,7 @@ describe('Flyout', () => {
|
|||
});
|
||||
|
||||
test('it renders the title field when its state is set to flyout is true', () => {
|
||||
const stateShowIsTrue = set('local.timeline.timelineById.test.show', true, state);
|
||||
const stateShowIsTrue = set('timeline.timelineById.test.show', true, state);
|
||||
const storeShowIsTrue = createStore(stateShowIsTrue);
|
||||
|
||||
const wrapper = mount(
|
||||
|
@ -82,7 +82,7 @@ describe('Flyout', () => {
|
|||
});
|
||||
|
||||
test('it does NOT render the fly out button when its state is set to flyout is true', () => {
|
||||
const stateShowIsTrue = set('local.timeline.timelineById.test.show', true, state);
|
||||
const stateShowIsTrue = set('timeline.timelineById.test.show', true, state);
|
||||
const storeShowIsTrue = createStore(stateShowIsTrue);
|
||||
|
||||
const wrapper = mount(
|
||||
|
@ -100,7 +100,7 @@ describe('Flyout', () => {
|
|||
});
|
||||
|
||||
test('it renders the flyout body', () => {
|
||||
const stateShowIsTrue = set('local.timeline.timelineById.test.show', true, state);
|
||||
const stateShowIsTrue = set('timeline.timelineById.test.show', true, state);
|
||||
const storeShowIsTrue = createStore(stateShowIsTrue);
|
||||
|
||||
const wrapper = mount(
|
||||
|
@ -126,7 +126,7 @@ describe('Flyout', () => {
|
|||
|
||||
test('it does render the data providers badge when the number is greater than 0', () => {
|
||||
const stateWithDataProviders = set(
|
||||
'local.timeline.timelineById.test.dataProviders',
|
||||
'timeline.timelineById.test.dataProviders',
|
||||
mockDataProviders,
|
||||
state
|
||||
);
|
||||
|
@ -148,7 +148,7 @@ describe('Flyout', () => {
|
|||
|
||||
test('it renders the correct number of data providers badge when the number is greater than 0', () => {
|
||||
const stateWithDataProviders = set(
|
||||
'local.timeline.timelineById.test.dataProviders',
|
||||
'timeline.timelineById.test.dataProviders',
|
||||
mockDataProviders,
|
||||
state
|
||||
);
|
||||
|
@ -213,7 +213,7 @@ describe('Flyout', () => {
|
|||
});
|
||||
|
||||
test('should call the onClose when the close button is clicked', () => {
|
||||
const stateShowIsTrue = set('local.timeline.timelineById.test.show', true, state);
|
||||
const stateShowIsTrue = set('timeline.timelineById.test.show', true, state);
|
||||
const storeShowIsTrue = createStore(stateShowIsTrue);
|
||||
|
||||
const showTimeline = (jest.fn() as unknown) as ActionCreator<{ id: string; show: boolean }>;
|
||||
|
|
|
@ -17,22 +17,22 @@ const TableHeader = styled.thead`
|
|||
const markdownRenderers = {
|
||||
root: ({ children }: { children: React.ReactNode[] }) => (
|
||||
<EuiText data-test-subj="markdown-root" grow={false}>
|
||||
{...children}
|
||||
{children}
|
||||
</EuiText>
|
||||
),
|
||||
table: ({ children }: { children: React.ReactNode[] }) => (
|
||||
<table data-test-subj="markdown-table" className="euiTable euiTable--responsive">
|
||||
{...children}
|
||||
{children}
|
||||
</table>
|
||||
),
|
||||
tableHead: ({ children }: { children: React.ReactNode[] }) => (
|
||||
<TableHeader data-test-subj="markdown-table-header">{...children}</TableHeader>
|
||||
<TableHeader data-test-subj="markdown-table-header">{children}</TableHeader>
|
||||
),
|
||||
tableRow: ({ children }: { children: React.ReactNode[] }) => (
|
||||
<EuiTableRow data-test-subj="markdown-table-row">{...children}</EuiTableRow>
|
||||
<EuiTableRow data-test-subj="markdown-table-row">{children}</EuiTableRow>
|
||||
),
|
||||
tableCell: ({ children }: { children: React.ReactNode[] }) => (
|
||||
<EuiTableRowCell data-test-subj="markdown-table-cell">{...children}</EuiTableRowCell>
|
||||
<EuiTableRowCell data-test-subj="markdown-table-cell">{children}</EuiTableRowCell>
|
||||
),
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import React from 'react';
|
|||
import { MemoryRouter } from 'react-router-dom';
|
||||
|
||||
// @ts-ignore Prevent auto-format from deleting - needed for 'chrome/ui' imports in host_details/ip_details
|
||||
jest.mock('ui/chrome', () => ({
|
||||
jest.doMock('ui/chrome', () => ({
|
||||
getBasePath: () => '',
|
||||
}));
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ import {
|
|||
whoisRenderer,
|
||||
} from './field_renderers';
|
||||
import { mockData } from './mock';
|
||||
import AutonomousSystem = GetIpOverviewQuery.AutonomousSystem;
|
||||
|
||||
type AutonomousSystem = GetIpOverviewQuery.AutonomousSystem;
|
||||
|
||||
describe('Field Renderers', () => {
|
||||
describe('#locationRenderer', () => {
|
||||
|
|
|
@ -11,8 +11,7 @@ import { MockedProvider } from 'react-apollo/test-utils';
|
|||
import { mountWithIntl } from 'test_utils/enzyme_helpers';
|
||||
|
||||
import { mockGlobalState, TestProviders } from '../../../../mock';
|
||||
import { createStore, State } from '../../../../store';
|
||||
import { networkModel } from '../../../../store/local/network';
|
||||
import { createStore, networkModel, State } from '../../../../store';
|
||||
|
||||
import { IpOverview, IpOverviewId } from './index';
|
||||
import { mockData } from './mock';
|
||||
|
|
|
@ -68,7 +68,7 @@ describe('NetworkTopNFlow Table Component', () => {
|
|||
</MockedProvider>
|
||||
);
|
||||
|
||||
expect(store.getState().local.network.page.queries!.dns.dnsSortField).toEqual({
|
||||
expect(store.getState().network.page.queries!.dns.dnsSortField).toEqual({
|
||||
direction: 'desc',
|
||||
field: 'queryCount',
|
||||
});
|
||||
|
@ -80,7 +80,7 @@ describe('NetworkTopNFlow Table Component', () => {
|
|||
|
||||
wrapper.update();
|
||||
|
||||
expect(store.getState().local.network.page.queries!.dns.dnsSortField).toEqual({
|
||||
expect(store.getState().network.page.queries!.dns.dnsSortField).toEqual({
|
||||
direction: 'asc',
|
||||
field: 'dnsName',
|
||||
});
|
||||
|
|
|
@ -147,7 +147,7 @@ describe('NetworkTopNFlow Table Component', () => {
|
|||
</TestProviders>
|
||||
</MockedProvider>
|
||||
);
|
||||
expect(store.getState().local.network.page.queries!.topNFlow.topNFlowSort).toEqual({
|
||||
expect(store.getState().network.page.queries!.topNFlow.topNFlowSort).toEqual({
|
||||
direction: 'desc',
|
||||
field: 'bytes',
|
||||
});
|
||||
|
@ -159,7 +159,7 @@ describe('NetworkTopNFlow Table Component', () => {
|
|||
|
||||
wrapper.update();
|
||||
|
||||
expect(store.getState().local.network.page.queries!.topNFlow.topNFlowSort).toEqual({
|
||||
expect(store.getState().network.page.queries!.topNFlow.topNFlowSort).toEqual({
|
||||
direction: 'asc',
|
||||
field: 'packets',
|
||||
});
|
||||
|
|
|
@ -202,7 +202,7 @@ class RangeDatePickerComponents extends React.PureComponent<
|
|||
}
|
||||
|
||||
const mapStateToProps = (state: State, { id }: OwnProps) => {
|
||||
const myState = getOr({}, `local.inputs.${id}`, state);
|
||||
const myState = getOr({}, `inputs.${id}`, state);
|
||||
return {
|
||||
from: get('timerange.from', myState),
|
||||
to: get('timerange.to', myState),
|
||||
|
|
|
@ -10,8 +10,7 @@ import * as React from 'react';
|
|||
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
|
||||
|
||||
import { Ecs } from '../../../../graphql/types';
|
||||
import { TestProviders } from '../../../../mock';
|
||||
import { mockTimelineData } from '../../../../mock';
|
||||
import { mockTimelineData, TestProviders } from '../../../../mock';
|
||||
|
||||
import {
|
||||
constructDroppedValue,
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { KqlMode } from '../../../store/local/timeline/model';
|
||||
import { timelineModel } from '../../../store';
|
||||
import { AndOrBadge } from '../../and_or_badge';
|
||||
|
||||
import * as i18n from './translations';
|
||||
|
@ -24,14 +24,14 @@ const AndOrContainer = styled.div`
|
|||
`;
|
||||
|
||||
interface ModeProperties {
|
||||
mode: KqlMode;
|
||||
mode: timelineModel.KqlMode;
|
||||
description: string;
|
||||
kqlBarTooltip: string;
|
||||
placeholder: string;
|
||||
selectText: string;
|
||||
}
|
||||
|
||||
export const modes: { [key in KqlMode]: ModeProperties } = {
|
||||
export const modes: { [key in timelineModel.KqlMode]: ModeProperties } = {
|
||||
filter: {
|
||||
mode: 'filter',
|
||||
description: i18n.FILTER_DESCRIPTION,
|
||||
|
@ -89,5 +89,5 @@ export const options = [
|
|||
},
|
||||
];
|
||||
|
||||
export const getPlaceholderText = (kqlMode: KqlMode): string =>
|
||||
export const getPlaceholderText = (kqlMode: timelineModel.KqlMode): string =>
|
||||
kqlMode === 'filter' ? i18n.FILTER_KQL_PLACEHOLDER : i18n.SEARCH_KQL_PLACEHOLDER;
|
||||
|
|
|
@ -17,8 +17,7 @@ import {
|
|||
timelineActions,
|
||||
timelineSelectors,
|
||||
} from '../../../store';
|
||||
import { KqlMode, TimelineModel } from '../../../store/local/timeline/model';
|
||||
import { State } from '../../../store/reducer';
|
||||
import { State, timelineModel } from '../../../store';
|
||||
|
||||
import { SearchOrFilter } from './search_or_filter';
|
||||
|
||||
|
@ -30,7 +29,7 @@ interface OwnProps {
|
|||
interface StateReduxProps {
|
||||
filterQueryDraft: KueryFilterQuery;
|
||||
isFilterQueryDraftValid: boolean;
|
||||
kqlMode?: KqlMode;
|
||||
kqlMode?: timelineModel.KqlMode;
|
||||
}
|
||||
|
||||
interface DispatchProps {
|
||||
|
@ -40,7 +39,7 @@ interface DispatchProps {
|
|||
}>;
|
||||
updateKqlMode: ActionCreator<{
|
||||
id: string;
|
||||
kqlMode: KqlMode;
|
||||
kqlMode: timelineModel.KqlMode;
|
||||
}>;
|
||||
setKqlFilterQueryDraft: ActionCreator<{
|
||||
id: string;
|
||||
|
@ -104,7 +103,7 @@ const makeMapStateToProps = () => {
|
|||
const getKqlFilterQueryDraft = timelineSelectors.getKqlFilterQueryDraftSelector();
|
||||
const isFilterQueryDraftValid = timelineSelectors.isFilterQueryDraftValidSelector();
|
||||
const mapStateToProps = (state: State, { timelineId }: OwnProps) => {
|
||||
const timeline: TimelineModel | {} = getTimeline(state, timelineId);
|
||||
const timeline: timelineModel.TimelineModel | {} = getTimeline(state, timelineId);
|
||||
return {
|
||||
kqlMode: getOr('filter', 'kqlMode', timeline),
|
||||
filterQueryDraft: getKqlFilterQueryDraft(state, timelineId),
|
||||
|
|
|
@ -19,8 +19,7 @@ import styled, { injectGlobal } from 'styled-components';
|
|||
import { StaticIndexPattern } from 'ui/index_patterns';
|
||||
|
||||
import { KueryAutocompletion } from '../../../containers/kuery_autocompletion';
|
||||
import { KueryFilterQuery } from '../../../store';
|
||||
import { KqlMode } from '../../../store/local/timeline/model';
|
||||
import { KueryFilterQuery, timelineModel } from '../../../store';
|
||||
import { AutocompleteField } from '../../autocomplete_field';
|
||||
|
||||
import { getPlaceholderText, modes, options } from './helpers';
|
||||
|
@ -41,7 +40,7 @@ interface Props {
|
|||
filterQueryDraft: KueryFilterQuery;
|
||||
indexPattern: StaticIndexPattern;
|
||||
isFilterQueryDraftValid: boolean;
|
||||
kqlMode: KqlMode;
|
||||
kqlMode: timelineModel.KqlMode;
|
||||
timelineId: string;
|
||||
updateKqlMode: (
|
||||
{
|
||||
|
@ -49,7 +48,7 @@ interface Props {
|
|||
kqlMode,
|
||||
}: {
|
||||
id: string;
|
||||
kqlMode: KqlMode;
|
||||
kqlMode: timelineModel.KqlMode;
|
||||
}
|
||||
) => void;
|
||||
setKqlFilterQueryDraft: (expression: string) => void;
|
||||
|
@ -84,7 +83,9 @@ export const SearchOrFilter = pure<Props>(
|
|||
hasDividers={true}
|
||||
itemLayoutAlign="top"
|
||||
itemClassName={timelineSelectModeItemsClassName}
|
||||
onChange={(mode: KqlMode) => updateKqlMode({ id: timelineId, kqlMode: mode })}
|
||||
onChange={(mode: timelineModel.KqlMode) =>
|
||||
updateKqlMode({ id: timelineId, kqlMode: mode })
|
||||
}
|
||||
options={options}
|
||||
valueOfSelected={kqlMode}
|
||||
/>
|
||||
|
|
|
@ -8,19 +8,25 @@ import { onError } from 'apollo-link-error';
|
|||
import uuid from 'uuid';
|
||||
|
||||
import { store } from '../../store';
|
||||
import { addError } from '../../store/local/app/actions';
|
||||
import { appActions } from '../../store';
|
||||
|
||||
import * as i18n from './translations';
|
||||
|
||||
export const errorLink = onError(({ graphQLErrors, networkError }) => {
|
||||
if (graphQLErrors != null) {
|
||||
graphQLErrors.forEach(({ message }) =>
|
||||
store.dispatch(addError({ id: uuid.v4(), title: i18n.DATA_FETCH_FAILURE, message }))
|
||||
store.dispatch(
|
||||
appActions.addError({ id: uuid.v4(), title: i18n.DATA_FETCH_FAILURE, message })
|
||||
)
|
||||
);
|
||||
}
|
||||
if (networkError != null) {
|
||||
store.dispatch(
|
||||
addError({ id: uuid.v4(), title: i18n.NETWORK_FAILURE, message: networkError.message })
|
||||
appActions.addError({
|
||||
id: uuid.v4(),
|
||||
title: i18n.NETWORK_FAILURE,
|
||||
message: networkError.message,
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,13 +9,7 @@ import { connect } from 'react-redux';
|
|||
import { pure } from 'recompose';
|
||||
import { ActionCreator } from 'typescript-fsa';
|
||||
|
||||
import {
|
||||
globalPolicySelector,
|
||||
globalTimeRangeSelector,
|
||||
inputsActions,
|
||||
inputsModel,
|
||||
State,
|
||||
} from '../../store';
|
||||
import { inputsActions, inputsModel, inputsSelectors, State } from '../../store';
|
||||
|
||||
interface GlobalTimeArgs {
|
||||
poll: number;
|
||||
|
@ -52,8 +46,8 @@ const GlobalTimeComponent = pure<GlobalTimeProps>(({ children, poll, from, to, s
|
|||
));
|
||||
|
||||
const mapStateToProps = (state: State) => {
|
||||
const timerange: inputsModel.TimeRange = globalTimeRangeSelector(state);
|
||||
const policy: inputsModel.Policy = globalPolicySelector(state);
|
||||
const timerange: inputsModel.TimeRange = inputsSelectors.globalTimeRangeSelector(state);
|
||||
const policy: inputsModel.Policy = inputsSelectors.globalPolicySelector(state);
|
||||
return {
|
||||
poll: policy.kind === 'interval' && timerange.kind === 'absolute' ? policy.duration : 0,
|
||||
from: timerange.from,
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Query } from 'react-apollo';
|
|||
import { pure } from 'recompose';
|
||||
|
||||
import { GetIpOverviewQuery, IpOverviewData } from '../../graphql/types';
|
||||
import { networkModel } from '../../store/local';
|
||||
import { networkModel } from '../../store';
|
||||
import { createFilter } from '../helpers';
|
||||
import { QueryTemplateProps } from '../query_template';
|
||||
|
||||
|
|
|
@ -18,97 +18,95 @@ import { State } from '../store';
|
|||
import { defaultHeaders } from './header';
|
||||
|
||||
export const mockGlobalState: State = {
|
||||
local: {
|
||||
app: {
|
||||
notesById: {},
|
||||
errors: [
|
||||
{ id: 'error-id-1', title: 'title-1', message: 'error-message-1' },
|
||||
{ id: 'error-id-2', title: 'title-2', message: 'error-message-2' },
|
||||
],
|
||||
app: {
|
||||
notesById: {},
|
||||
errors: [
|
||||
{ id: 'error-id-1', title: 'title-1', message: 'error-message-1' },
|
||||
{ id: 'error-id-2', title: 'title-2', message: 'error-message-2' },
|
||||
],
|
||||
},
|
||||
hosts: {
|
||||
page: {
|
||||
queries: {
|
||||
authentications: { limit: 10 },
|
||||
hosts: { limit: 10 },
|
||||
events: { limit: 10 },
|
||||
uncommonProcesses: { limit: 10 },
|
||||
},
|
||||
filterQuery: null,
|
||||
filterQueryDraft: null,
|
||||
},
|
||||
hosts: {
|
||||
page: {
|
||||
queries: {
|
||||
authentications: { limit: 10 },
|
||||
hosts: { limit: 10 },
|
||||
events: { limit: 10 },
|
||||
uncommonProcesses: { limit: 10 },
|
||||
},
|
||||
filterQuery: null,
|
||||
filterQueryDraft: null,
|
||||
},
|
||||
details: {
|
||||
queries: {
|
||||
authentications: { limit: 10 },
|
||||
hosts: { limit: 10 },
|
||||
events: { limit: 10 },
|
||||
uncommonProcesses: { limit: 10 },
|
||||
},
|
||||
filterQuery: null,
|
||||
filterQueryDraft: null,
|
||||
details: {
|
||||
queries: {
|
||||
authentications: { limit: 10 },
|
||||
hosts: { limit: 10 },
|
||||
events: { limit: 10 },
|
||||
uncommonProcesses: { limit: 10 },
|
||||
},
|
||||
filterQuery: null,
|
||||
filterQueryDraft: null,
|
||||
},
|
||||
network: {
|
||||
page: {
|
||||
queries: {
|
||||
topNFlow: {
|
||||
limit: 10,
|
||||
topNFlowType: NetworkTopNFlowType.source,
|
||||
topNFlowDirection: NetworkTopNFlowDirection.uniDirectional,
|
||||
topNFlowSort: { field: NetworkTopNFlowFields.bytes, direction: Direction.desc },
|
||||
},
|
||||
dns: {
|
||||
limit: 10,
|
||||
dnsSortField: { field: NetworkDnsFields.queryCount, direction: Direction.desc },
|
||||
isPtrIncluded: false,
|
||||
},
|
||||
},
|
||||
network: {
|
||||
page: {
|
||||
queries: {
|
||||
topNFlow: {
|
||||
limit: 10,
|
||||
topNFlowType: NetworkTopNFlowType.source,
|
||||
topNFlowDirection: NetworkTopNFlowDirection.uniDirectional,
|
||||
topNFlowSort: { field: NetworkTopNFlowFields.bytes, direction: Direction.desc },
|
||||
},
|
||||
filterQuery: null,
|
||||
filterQueryDraft: null,
|
||||
},
|
||||
details: {
|
||||
filterQuery: null,
|
||||
filterQueryDraft: null,
|
||||
queries: {
|
||||
ipOverview: {
|
||||
flowType: IpOverviewType.source,
|
||||
},
|
||||
dns: {
|
||||
limit: 10,
|
||||
dnsSortField: { field: NetworkDnsFields.queryCount, direction: Direction.desc },
|
||||
isPtrIncluded: false,
|
||||
},
|
||||
},
|
||||
filterQuery: null,
|
||||
filterQueryDraft: null,
|
||||
},
|
||||
inputs: {
|
||||
global: {
|
||||
timerange: { kind: 'absolute', from: 0, to: 1 },
|
||||
query: [],
|
||||
policy: { kind: 'manual', duration: 5000 },
|
||||
},
|
||||
},
|
||||
dragAndDrop: { dataProviders: {} },
|
||||
timeline: {
|
||||
timelineById: {
|
||||
test: {
|
||||
id: 'test',
|
||||
columns: defaultHeaders,
|
||||
itemsPerPage: 5,
|
||||
dataProviders: [],
|
||||
description: '',
|
||||
eventIdToNoteIds: {},
|
||||
highlightedDropAndProviderId: '',
|
||||
historyIds: [],
|
||||
isFavorite: false,
|
||||
isLive: false,
|
||||
kqlMode: 'filter',
|
||||
kqlQuery: { filterQuery: null, filterQueryDraft: null },
|
||||
title: '',
|
||||
noteIds: [],
|
||||
range: '1 Day',
|
||||
show: false,
|
||||
pinnedEventIds: {},
|
||||
itemsPerPageOptions: [5, 10, 20],
|
||||
sort: { columnId: '@timestamp', sortDirection: Direction.desc },
|
||||
width: defaultWidth,
|
||||
details: {
|
||||
filterQuery: null,
|
||||
filterQueryDraft: null,
|
||||
queries: {
|
||||
ipOverview: {
|
||||
flowType: IpOverviewType.source,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
global: {
|
||||
timerange: { kind: 'absolute', from: 0, to: 1 },
|
||||
query: [],
|
||||
policy: { kind: 'manual', duration: 5000 },
|
||||
},
|
||||
},
|
||||
dragAndDrop: { dataProviders: {} },
|
||||
timeline: {
|
||||
timelineById: {
|
||||
test: {
|
||||
id: 'test',
|
||||
columns: defaultHeaders,
|
||||
itemsPerPage: 5,
|
||||
dataProviders: [],
|
||||
description: '',
|
||||
eventIdToNoteIds: {},
|
||||
highlightedDropAndProviderId: '',
|
||||
historyIds: [],
|
||||
isFavorite: false,
|
||||
isLive: false,
|
||||
kqlMode: 'filter',
|
||||
kqlQuery: { filterQuery: null, filterQueryDraft: null },
|
||||
title: '',
|
||||
noteIds: [],
|
||||
range: '1 Day',
|
||||
show: false,
|
||||
pinnedEventIds: {},
|
||||
itemsPerPageOptions: [5, 10, 20],
|
||||
sort: { columnId: '@timestamp', sortDirection: Direction.desc },
|
||||
width: defaultWidth,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export {
|
||||
dragAndDropActions,
|
||||
hostsActions,
|
||||
inputsActions,
|
||||
networkActions,
|
||||
timelineActions,
|
||||
} from './local';
|
||||
export { appActions } from './app';
|
||||
export { dragAndDropActions } from './drag_and_drop';
|
||||
export { hostsActions } from './hosts';
|
||||
export { inputsActions } from './inputs';
|
||||
export { networkActions } from './network';
|
||||
export { timelineActions } from './timeline';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import actionCreatorFactory from 'typescript-fsa';
|
||||
|
||||
import { Note } from '../../../lib/note';
|
||||
import { Note } from '../../lib/note';
|
||||
|
||||
const actionCreator = actionCreatorFactory('x-pack/siem/local/app');
|
||||
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
import * as appActions from './actions';
|
||||
import * as appModel from './model';
|
||||
import * as appSelectors from './selectors';
|
||||
|
||||
export { appSelectors };
|
||||
export { appActions };
|
||||
export { appActions, appModel, appSelectors };
|
||||
export * from './reducer';
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Note } from '../../../lib/note';
|
||||
import { Note } from '../../lib/note';
|
||||
|
||||
export type ErrorState = ErrorModel;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { reducerWithInitialState } from 'typescript-fsa-reducers';
|
||||
|
||||
import { Note } from '../../../lib/note';
|
||||
import { Note } from '../../lib/note';
|
||||
|
||||
import { addError, removeError, updateNote } from './actions';
|
||||
import { AppModel, NotesById } from './model';
|
|
@ -8,14 +8,14 @@ import { keys } from 'lodash/fp';
|
|||
import memoizeOne from 'memoize-one';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
import { Note } from '../../../lib/note';
|
||||
import { State } from '../../reducer';
|
||||
import { Note } from '../../lib/note';
|
||||
import { State } from '../reducer';
|
||||
|
||||
import { ErrorModel, NotesById } from './model';
|
||||
|
||||
const selectNotesById = (state: State): NotesById => state.local.app.notesById;
|
||||
const selectNotesById = (state: State): NotesById => state.app.notesById;
|
||||
|
||||
const getErrors = (state: State): ErrorModel => state.local.app.errors;
|
||||
const getErrors = (state: State): ErrorModel => state.app.errors;
|
||||
|
||||
const getNotes = (notesById: NotesById, noteIds: string[]) =>
|
||||
keys(notesById).reduce((acc: Note[], noteId: string) => {
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import actionCreatorFactory from 'typescript-fsa';
|
||||
|
||||
import { DataProvider } from '../../../components/timeline/data_providers/data_provider';
|
||||
import { DataProvider } from '../../components/timeline/data_providers/data_provider';
|
||||
|
||||
const actionCreator = actionCreatorFactory('x-pack/siem/local/drag_and_drop');
|
||||
|
|
@ -5,7 +5,8 @@
|
|||
*/
|
||||
|
||||
import * as dragAndDropActions from './actions';
|
||||
import * as dragAndDropModel from './model';
|
||||
import * as dragAndDropSelectors from './selectors';
|
||||
|
||||
export * from './selectors';
|
||||
export { dragAndDropActions };
|
||||
export { dragAndDropActions, dragAndDropModel, dragAndDropSelectors };
|
||||
export * from './reducer';
|
|
@ -3,7 +3,7 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { DataProvider } from '../../../components/timeline/data_providers/data_provider';
|
||||
import { DataProvider } from '../../components/timeline/data_providers/data_provider';
|
||||
|
||||
export interface IdToDataProvider {
|
||||
[id: string]: DataProvider;
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { DataProvider } from '../../../components/timeline/data_providers/data_provider';
|
||||
import { mockDataProviders } from '../../../components/timeline/data_providers/mock/mock_data_providers';
|
||||
import { DataProvider } from '../../components/timeline/data_providers/data_provider';
|
||||
import { mockDataProviders } from '../../components/timeline/data_providers/mock/mock_data_providers';
|
||||
|
||||
import { IdToDataProvider } from './model';
|
||||
import { registerProviderHandler, unRegisterProviderHandler } from './reducer';
|
|
@ -7,7 +7,7 @@
|
|||
import { omit } from 'lodash/fp';
|
||||
import { reducerWithInitialState } from 'typescript-fsa-reducers';
|
||||
|
||||
import { DataProvider } from '../../../components/timeline/data_providers/data_provider';
|
||||
import { DataProvider } from '../../components/timeline/data_providers/data_provider';
|
||||
|
||||
import { registerProvider, unRegisterProvider } from './actions';
|
||||
import { DragAndDropModel, IdToDataProvider } from './model';
|
|
@ -6,12 +6,11 @@
|
|||
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
import { State } from '../../reducer';
|
||||
import { State } from '../reducer';
|
||||
|
||||
import { IdToDataProvider } from './model';
|
||||
|
||||
const selectDataProviders = (state: State): IdToDataProvider =>
|
||||
state.local.dragAndDrop.dataProviders;
|
||||
const selectDataProviders = (state: State): IdToDataProvider => state.dragAndDrop.dataProviders;
|
||||
|
||||
export const dataProvidersSelector = createSelector(
|
||||
selectDataProviders,
|
|
@ -6,6 +6,6 @@
|
|||
|
||||
import { combineEpics } from 'redux-observable';
|
||||
|
||||
import { createLocalEpic } from './local';
|
||||
import { createGlobalTimeEpic } from './inputs';
|
||||
|
||||
export const createRootEpic = <State>() => combineEpics(createLocalEpic<State>());
|
||||
export const createRootEpic = <State>() => combineEpics(createGlobalTimeEpic<State>());
|
||||
|
|
|
@ -8,7 +8,5 @@ import * as hostsActions from './actions';
|
|||
import * as hostsModel from './model';
|
||||
import * as hostsSelectors from './selectors';
|
||||
|
||||
export { hostsActions };
|
||||
export { hostsModel };
|
||||
export { hostsSelectors };
|
||||
export { hostsActions, hostsModel, hostsSelectors };
|
||||
export * from './reducer';
|
|
@ -7,13 +7,13 @@
|
|||
import { get } from 'lodash/fp';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
import { isFromKueryExpressionValid } from '../../../lib/keury';
|
||||
import { State } from '../../reducer';
|
||||
import { isFromKueryExpressionValid } from '../../lib/keury';
|
||||
import { State } from '../reducer';
|
||||
|
||||
import { GenericHostsModel, HostsType } from './model';
|
||||
|
||||
const selectHosts = (state: State, hostsType: HostsType): GenericHostsModel =>
|
||||
get(hostsType, state.local.hosts);
|
||||
get(hostsType, state.hosts);
|
||||
|
||||
export const authenticationsSelector = () =>
|
||||
createSelector(
|
|
@ -5,10 +5,10 @@
|
|||
*/
|
||||
|
||||
export * from './actions';
|
||||
export * from './reducer';
|
||||
export * from './selectors';
|
||||
export * from './epic';
|
||||
export * from './model';
|
||||
export * from './reducer';
|
||||
export * from './selectors';
|
||||
|
||||
import { createStore } from './store';
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
|
||||
import * as inputsActions from './actions';
|
||||
import * as inputsModel from './model';
|
||||
import * as inputsSelectors from './selectors';
|
||||
|
||||
export { inputsActions };
|
||||
export * from './reducer';
|
||||
export * from './selectors';
|
||||
export * from './epic';
|
||||
export { inputsModel };
|
||||
export { inputsActions, inputsModel, inputsSelectors };
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
import { State } from '../../reducer';
|
||||
import { State } from '../reducer';
|
||||
|
||||
import { GlobalQuery, Policy, TimeRange } from './model';
|
||||
|
||||
const selectGlobalTimeRange = (state: State): TimeRange => state.local.inputs.global.timerange;
|
||||
const selectGlobalPolicy = (state: State): Policy => state.local.inputs.global.policy;
|
||||
const selectGlobalQuery = (state: State): GlobalQuery[] => state.local.inputs.global.query;
|
||||
const selectGlobalTimeRange = (state: State): TimeRange => state.inputs.global.timerange;
|
||||
const selectGlobalPolicy = (state: State): Policy => state.inputs.global.policy;
|
||||
const selectGlobalQuery = (state: State): GlobalQuery[] => state.inputs.global.query;
|
||||
|
||||
export const globalTimeRangeSelector = createSelector(
|
||||
selectGlobalTimeRange,
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { appActions } from './app';
|
||||
export { dragAndDropActions } from './drag_and_drop';
|
||||
export { hostsActions } from './hosts';
|
||||
export { inputsActions } from './inputs';
|
||||
export { networkActions } from './network';
|
||||
export { timelineActions } from './timeline';
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { combineEpics } from 'redux-observable';
|
||||
|
||||
import { createGlobalTimeEpic } from './inputs';
|
||||
|
||||
export const createLocalEpic = <State>() => combineEpics(createGlobalTimeEpic<State>());
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export * from './actions';
|
||||
export * from './epic';
|
||||
export * from './model';
|
||||
export * from './reducer';
|
||||
export * from './selectors';
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { inputsModel } from './inputs';
|
||||
export { hostsModel } from './hosts';
|
||||
export { networkModel } from './network';
|
||||
export { timelineModel } from './timeline';
|
||||
|
||||
export interface KueryFilterQuery {
|
||||
kind: 'kuery';
|
||||
expression: string;
|
||||
}
|
||||
|
||||
export interface SerializedFilterQuery {
|
||||
query: KueryFilterQuery;
|
||||
serializedQuery: string;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
import { appReducer, AppState, initialAppState } from './app';
|
||||
import { dragAndDropReducer, DragAndDropState, initialDragAndDropState } from './drag_and_drop';
|
||||
import { hostsReducer, HostsState, initialHostsState } from './hosts';
|
||||
import { initialInputsState, inputsReducer, InputsState } from './inputs';
|
||||
import { initialNetworkState, networkReducer, NetworkState } from './network';
|
||||
import { initialTimelineState, timelineReducer, TimelineState } from './timeline';
|
||||
|
||||
export interface LocalState {
|
||||
app: AppState;
|
||||
dragAndDrop: DragAndDropState;
|
||||
hosts: HostsState;
|
||||
inputs: InputsState;
|
||||
network: NetworkState;
|
||||
timeline: TimelineState;
|
||||
}
|
||||
|
||||
export const initialLocalState: LocalState = {
|
||||
app: initialAppState,
|
||||
dragAndDrop: initialDragAndDropState,
|
||||
hosts: initialHostsState,
|
||||
inputs: initialInputsState,
|
||||
network: initialNetworkState,
|
||||
timeline: initialTimelineState,
|
||||
};
|
||||
|
||||
export const localReducer = combineReducers<LocalState>({
|
||||
app: appReducer,
|
||||
dragAndDrop: dragAndDropReducer,
|
||||
hosts: hostsReducer,
|
||||
inputs: inputsReducer,
|
||||
network: networkReducer,
|
||||
timeline: timelineReducer,
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { appSelectors } from './app';
|
||||
export * from './drag_and_drop';
|
||||
export { hostsSelectors } from './hosts';
|
||||
export * from './inputs';
|
||||
export { networkSelectors } from './network';
|
||||
export { timelineSelectors } from './timeline';
|
|
@ -4,4 +4,19 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export * from './local';
|
||||
export { appModel } from './app';
|
||||
export { inputsModel } from './inputs';
|
||||
export { hostsModel } from './hosts';
|
||||
export { dragAndDropModel } from './drag_and_drop';
|
||||
export { networkModel } from './network';
|
||||
export { timelineModel } from './timeline';
|
||||
|
||||
export interface KueryFilterQuery {
|
||||
kind: 'kuery';
|
||||
expression: string;
|
||||
}
|
||||
|
||||
export interface SerializedFilterQuery {
|
||||
query: KueryFilterQuery;
|
||||
serializedQuery: string;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
NetworkTopNFlowDirection,
|
||||
NetworkTopNFlowSortField,
|
||||
NetworkTopNFlowType,
|
||||
} from '../../../graphql/types';
|
||||
} from '../../graphql/types';
|
||||
import { KueryFilterQuery, SerializedFilterQuery } from '../model';
|
||||
|
||||
import { NetworkType } from './model';
|
|
@ -10,7 +10,7 @@ import {
|
|||
NetworkTopNFlowFields,
|
||||
NetworkTopNFlowSortField,
|
||||
NetworkTopNFlowType,
|
||||
} from '../../../graphql/types';
|
||||
} from '../../graphql/types';
|
||||
|
||||
export const helperUpdateTopNFlowDirection = (
|
||||
topNFlowType: NetworkTopNFlowType,
|
|
@ -8,7 +8,5 @@ import * as networkActions from './actions';
|
|||
import * as networkModel from './model';
|
||||
import * as networkSelectors from './selectors';
|
||||
|
||||
export { networkActions };
|
||||
export { networkModel };
|
||||
export { networkSelectors };
|
||||
export { networkActions, networkModel, networkSelectors };
|
||||
export * from './reducer';
|
|
@ -10,7 +10,7 @@ import {
|
|||
NetworkTopNFlowDirection,
|
||||
NetworkTopNFlowSortField,
|
||||
NetworkTopNFlowType,
|
||||
} from '../../../graphql/types';
|
||||
} from '../../graphql/types';
|
||||
import { KueryFilterQuery, SerializedFilterQuery } from '../model';
|
||||
|
||||
export enum NetworkType {
|
|
@ -13,7 +13,7 @@ import {
|
|||
NetworkTopNFlowDirection,
|
||||
NetworkTopNFlowFields,
|
||||
NetworkTopNFlowType,
|
||||
} from '../../../graphql/types';
|
||||
} from '../../graphql/types';
|
||||
import { DEFAULT_TABLE_LIMIT } from '../constants';
|
||||
|
||||
import {
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
import { isFromKueryExpressionValid } from '../../../lib/keury';
|
||||
import { State } from '../../reducer';
|
||||
import { isFromKueryExpressionValid } from '../../lib/keury';
|
||||
import { State } from '../reducer';
|
||||
|
||||
import { NetworkDetailsModel, NetworkPageModel } from './model';
|
||||
|
||||
const selectNetworkPage = (state: State): NetworkPageModel => state.local.network.page;
|
||||
const selectNetworkPage = (state: State): NetworkPageModel => state.network.page;
|
||||
|
||||
const selectNetworkDetails = (state: State): NetworkDetailsModel => state.local.network.details;
|
||||
const selectNetworkDetails = (state: State): NetworkDetailsModel => state.network.details;
|
||||
|
||||
export const dnsSelector = () =>
|
||||
createSelector(
|
|
@ -6,16 +6,36 @@
|
|||
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
import { initialLocalState, localReducer, LocalState } from './local';
|
||||
import { appReducer, AppState, initialAppState } from './app';
|
||||
import { dragAndDropReducer, DragAndDropState, initialDragAndDropState } from './drag_and_drop';
|
||||
import { hostsReducer, HostsState, initialHostsState } from './hosts';
|
||||
import { initialInputsState, inputsReducer, InputsState } from './inputs';
|
||||
import { initialNetworkState, networkReducer, NetworkState } from './network';
|
||||
import { initialTimelineState, timelineReducer, TimelineState } from './timeline';
|
||||
|
||||
export interface State {
|
||||
local: LocalState;
|
||||
app: AppState;
|
||||
dragAndDrop: DragAndDropState;
|
||||
hosts: HostsState;
|
||||
inputs: InputsState;
|
||||
network: NetworkState;
|
||||
timeline: TimelineState;
|
||||
}
|
||||
|
||||
export const initialState: State = {
|
||||
local: initialLocalState,
|
||||
app: initialAppState,
|
||||
dragAndDrop: initialDragAndDropState,
|
||||
hosts: initialHostsState,
|
||||
inputs: initialInputsState,
|
||||
network: initialNetworkState,
|
||||
timeline: initialTimelineState,
|
||||
};
|
||||
|
||||
export const reducer = combineReducers<State>({
|
||||
local: localReducer,
|
||||
app: appReducer,
|
||||
dragAndDrop: dragAndDropReducer,
|
||||
hosts: hostsReducer,
|
||||
inputs: inputsReducer,
|
||||
network: networkReducer,
|
||||
timeline: timelineReducer,
|
||||
});
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export {
|
||||
appSelectors,
|
||||
dataProvidersSelector,
|
||||
globalTimeRangeSelector,
|
||||
globalPolicySelector,
|
||||
hostsSelectors,
|
||||
networkSelectors,
|
||||
timelineSelectors,
|
||||
} from './local';
|
||||
export { appSelectors } from './app';
|
||||
export { dragAndDropSelectors } from './drag_and_drop';
|
||||
export { hostsSelectors } from './hosts';
|
||||
export { inputsSelectors } from './inputs';
|
||||
export { networkSelectors } from './network';
|
||||
export { timelineSelectors } from './timeline';
|
||||
|
|
|
@ -14,14 +14,7 @@ import {
|
|||
} from 'redux';
|
||||
import { createEpicMiddleware } from 'redux-observable';
|
||||
|
||||
import {
|
||||
createRootEpic,
|
||||
globalPolicySelector,
|
||||
globalTimeRangeSelector,
|
||||
initialState,
|
||||
reducer,
|
||||
State,
|
||||
} from '.';
|
||||
import { createRootEpic, initialState, inputsSelectors, reducer, State } from '.';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
|
@ -33,8 +26,8 @@ export const createStore = (state = initialState): Store<State, AnyAction> => {
|
|||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||||
|
||||
const middlewareDependencies = {
|
||||
selectGlobalPolicy: globalPolicySelector,
|
||||
selectGlobalTimeRange: globalTimeRangeSelector,
|
||||
selectGlobalPolicy: inputsSelectors.globalPolicySelector,
|
||||
selectGlobalTimeRange: inputsSelectors.globalTimeRangeSelector,
|
||||
};
|
||||
|
||||
const epicMiddleware = createEpicMiddleware<Action, Action, State, typeof middlewareDependencies>(
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
import actionCreatorFactory from 'typescript-fsa';
|
||||
|
||||
import { ColumnHeader } from '../../../components/timeline/body/column_headers/column_header';
|
||||
import { Sort } from '../../../components/timeline/body/sort';
|
||||
import { DataProvider } from '../../../components/timeline/data_providers/data_provider';
|
||||
import { ColumnHeader } from '../../components/timeline/body/column_headers/column_header';
|
||||
import { Sort } from '../../components/timeline/body/sort';
|
||||
import { DataProvider } from '../../components/timeline/data_providers/data_provider';
|
||||
import { KueryFilterQuery, SerializedFilterQuery } from '../model';
|
||||
|
||||
import { KqlMode } from './model';
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
import { getOr, omit, uniq } from 'lodash/fp';
|
||||
|
||||
import { ColumnHeader } from '../../../components/timeline/body/column_headers/column_header';
|
||||
import { getColumnWidthFromType } from '../../../components/timeline/body/helpers';
|
||||
import { Sort } from '../../../components/timeline/body/sort';
|
||||
import { DataProvider } from '../../../components/timeline/data_providers/data_provider';
|
||||
import { ColumnHeader } from '../../components/timeline/body/column_headers/column_header';
|
||||
import { getColumnWidthFromType } from '../../components/timeline/body/helpers';
|
||||
import { Sort } from '../../components/timeline/body/sort';
|
||||
import { DataProvider } from '../../components/timeline/data_providers/data_provider';
|
||||
import { KueryFilterQuery, SerializedFilterQuery } from '../model';
|
||||
|
||||
import { TimelineById, TimelineState } from '.';
|
|
@ -8,7 +8,5 @@ import * as timelineActions from './actions';
|
|||
import * as timelineModel from './model';
|
||||
import * as timelineSelectors from './selectors';
|
||||
|
||||
export { timelineActions };
|
||||
export { timelineModel };
|
||||
export { timelineActions, timelineModel, timelineSelectors };
|
||||
export * from './reducer';
|
||||
export { timelineSelectors };
|
|
@ -4,11 +4,11 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { defaultWidth } from '../../../components/timeline/body';
|
||||
import { ColumnHeader } from '../../../components/timeline/body/column_headers/column_header';
|
||||
import { Sort } from '../../../components/timeline/body/sort';
|
||||
import { DataProvider } from '../../../components/timeline/data_providers/data_provider';
|
||||
import { Direction } from '../../../graphql/types';
|
||||
import { defaultWidth } from '../../components/timeline/body';
|
||||
import { ColumnHeader } from '../../components/timeline/body/column_headers/column_header';
|
||||
import { Sort } from '../../components/timeline/body/sort';
|
||||
import { DataProvider } from '../../components/timeline/data_providers/data_provider';
|
||||
import { Direction } from '../../graphql/types';
|
||||
import { KueryFilterQuery, SerializedFilterQuery } from '../model';
|
||||
|
||||
export const DEFAULT_PAGE_COUNT = 2; // Eui Pager will not render unless this is a minimum of 2 pages
|
|
@ -6,15 +6,15 @@
|
|||
|
||||
import { cloneDeep, set } from 'lodash/fp';
|
||||
|
||||
import { defaultWidth } from '../../../components/timeline/body';
|
||||
import { ColumnHeader } from '../../../components/timeline/body/column_headers/column_header';
|
||||
import { defaultColumnHeaderType } from '../../../components/timeline/body/column_headers/default_headers';
|
||||
import { defaultWidth } from '../../components/timeline/body';
|
||||
import { ColumnHeader } from '../../components/timeline/body/column_headers/column_header';
|
||||
import { defaultColumnHeaderType } from '../../components/timeline/body/column_headers/default_headers';
|
||||
import {
|
||||
DEFAULT_COLUMN_MIN_WIDTH,
|
||||
getColumnWidthFromType,
|
||||
} from '../../../components/timeline/body/helpers';
|
||||
import { Direction } from '../../../graphql/types';
|
||||
import { defaultHeaders } from '../../../mock';
|
||||
} from '../../components/timeline/body/helpers';
|
||||
import { Direction } from '../../graphql/types';
|
||||
import { defaultHeaders } from '../../mock';
|
||||
|
||||
import { TimelineById } from '.';
|
||||
import {
|
|
@ -6,16 +6,16 @@
|
|||
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
import { isFromKueryExpressionValid } from '../../../lib/keury';
|
||||
import { State } from '../../reducer';
|
||||
import { isFromKueryExpressionValid } from '../../lib/keury';
|
||||
import { State } from '../reducer';
|
||||
|
||||
import { timelineDefaults, TimelineModel } from './model';
|
||||
import { TimelineById } from './reducer';
|
||||
|
||||
const selectTimelineById = (state: State): TimelineById => state.local.timeline.timelineById;
|
||||
const selectTimelineById = (state: State): TimelineById => state.timeline.timelineById;
|
||||
|
||||
export const selectTimeline = (state: State, timelineId: string): TimelineModel =>
|
||||
state.local.timeline.timelineById[timelineId];
|
||||
state.timeline.timelineById[timelineId];
|
||||
|
||||
export const timelineByIdSelector = createSelector(
|
||||
selectTimelineById,
|
|
@ -28,7 +28,6 @@ async function main() {
|
|||
config: SERVER_CONFIG_PATH,
|
||||
out: OUTPUT_INTROSPECTION_PATH,
|
||||
overwrite: true,
|
||||
require: ['ts-node/register'],
|
||||
schema: SCHEMA_PATH,
|
||||
template: 'graphql-codegen-introspection-template',
|
||||
},
|
||||
|
|
|
@ -20,7 +20,7 @@ import { AuthenticationsResolversDeps, createAuthenticationsResolvers } from './
|
|||
|
||||
const mockGetFields = jest.fn();
|
||||
mockGetFields.mockResolvedValue({ fieldNodes: [mockAuthenticationsFields] });
|
||||
jest.mock('../../utils/build_query/fields', () => ({
|
||||
jest.doMock('../../utils/build_query/fields', () => ({
|
||||
getFields: mockGetFields,
|
||||
}));
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import { createEventsResolvers, EventsResolversDeps } from './resolvers';
|
|||
|
||||
const mockGetFields = jest.fn();
|
||||
mockGetFields.mockResolvedValue({ fieldNodes: [mockEventsFields] });
|
||||
jest.mock('../../utils/build_query/fields', () => ({
|
||||
jest.doMock('../../utils/build_query/fields', () => ({
|
||||
getFields: mockGetFields,
|
||||
}));
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import { createHostsResolvers, HostsResolversDeps } from './resolvers';
|
|||
|
||||
const mockGetFields = jest.fn();
|
||||
mockGetFields.mockResolvedValue({ fieldNodes: [mockHostsFields] });
|
||||
jest.mock('../../utils/build_query/fields', () => ({
|
||||
jest.doMock('../../utils/build_query/fields', () => ({
|
||||
getFields: mockGetFields,
|
||||
}));
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import { createIpOverviewResolvers, IpOverviewResolversDeps } from './resolvers'
|
|||
|
||||
const mockGetFields = jest.fn();
|
||||
mockGetFields.mockResolvedValue({ fieldNodes: [mockIpOverviewFields] });
|
||||
jest.mock('../../utils/build_query/fields', () => ({
|
||||
jest.doMock('../../utils/build_query/fields', () => ({
|
||||
getFields: mockGetFields,
|
||||
}));
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import { createKpiNetworkResolvers, KpiNetworkResolversDeps } from './resolvers'
|
|||
|
||||
const mockGetFields = jest.fn();
|
||||
mockGetFields.mockResolvedValue({ fieldNodes: [mockKpiNetworkFields] });
|
||||
jest.mock('../../utils/build_query/fields', () => ({
|
||||
jest.doMock('../../utils/build_query/fields', () => ({
|
||||
getFields: mockGetFields,
|
||||
}));
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ describe('Test Source Resolvers', () => {
|
|||
|
||||
const mockGetFields = jest.fn();
|
||||
mockGetFields.mockResolvedValue({ fieldNodes: [mockNetworkTopNFlowFields] });
|
||||
jest.mock('../../utils/build_query/fields', () => ({
|
||||
jest.doMock('../../utils/build_query/fields', () => ({
|
||||
getFields: mockGetFields,
|
||||
}));
|
||||
|
||||
|
@ -118,7 +118,7 @@ describe('Test Source Resolvers', () => {
|
|||
|
||||
const mockGetFields = jest.fn();
|
||||
mockGetFields.mockResolvedValue({ fieldNodes: [mockNetworkDnsFields] });
|
||||
jest.mock('../../utils/build_query/fields', () => ({
|
||||
jest.doMock('../../utils/build_query/fields', () => ({
|
||||
getFields: mockGetFields,
|
||||
}));
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import { mockUncommonProcessesData, mockUncommonProcessesFields } from './uncomm
|
|||
|
||||
const mockGetFields = jest.fn();
|
||||
mockGetFields.mockResolvedValue({ fieldNodes: [mockUncommonProcessesFields] });
|
||||
jest.mock('../../utils/build_query/fields', () => ({
|
||||
jest.doMock('../../utils/build_query/fields', () => ({
|
||||
getFields: mockGetFields,
|
||||
}));
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ describe('events elasticsearch_adapter', () => {
|
|||
registerGraphQLEndpoint: jest.fn(),
|
||||
getIndexPatternsService: jest.fn(),
|
||||
};
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ describe('Network Kpi elasticsearch_adapter', () => {
|
|||
describe('getKpiNetwork - call stack', () => {
|
||||
beforeAll(async () => {
|
||||
mockCallWithRequest.mockResolvedValue(mockResponse);
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
mockBuildQuery = jest.spyOn(generalQueryDsl, 'buildGeneralQuery').mockReturnValue([]);
|
||||
|
@ -83,7 +83,7 @@ describe('Network Kpi elasticsearch_adapter', () => {
|
|||
describe('Happy Path - get Data', () => {
|
||||
beforeAll(async () => {
|
||||
mockCallWithRequest.mockResolvedValue(mockResponse);
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
EsKpiNetwork = new ElasticsearchKpiNetworkAdapter(mockFramework);
|
||||
|
@ -102,7 +102,7 @@ describe('Network Kpi elasticsearch_adapter', () => {
|
|||
describe('Unhappy Path - No data', () => {
|
||||
beforeAll(async () => {
|
||||
mockCallWithRequest.mockResolvedValue(null);
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
EsKpiNetwork = new ElasticsearchKpiNetworkAdapter(mockFramework);
|
||||
|
|
|
@ -23,7 +23,7 @@ describe('Network Top N flow elasticsearch_adapter with NetworkTopNFlowType=sour
|
|||
registerGraphQLEndpoint: jest.fn(),
|
||||
getIndexPatternsService: jest.fn(),
|
||||
};
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
|
||||
|
@ -50,7 +50,7 @@ describe('Network Top N flow elasticsearch_adapter with NetworkTopNFlowType=sour
|
|||
registerGraphQLEndpoint: jest.fn(),
|
||||
getIndexPatternsService: jest.fn(),
|
||||
};
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
|
||||
|
@ -84,7 +84,7 @@ describe('Network Top N flow elasticsearch_adapter with NetworkTopNFlowType=sour
|
|||
registerGraphQLEndpoint: jest.fn(),
|
||||
getIndexPatternsService: jest.fn(),
|
||||
};
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ describe('Siem Overview elasticsearch_adapter', () => {
|
|||
registerGraphQLEndpoint: jest.fn(),
|
||||
getIndexPatternsService: jest.fn(),
|
||||
};
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
|
||||
|
@ -63,7 +63,7 @@ describe('Siem Overview elasticsearch_adapter', () => {
|
|||
registerGraphQLEndpoint: jest.fn(),
|
||||
getIndexPatternsService: jest.fn(),
|
||||
};
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
|
||||
|
@ -94,7 +94,7 @@ describe('Siem Overview elasticsearch_adapter', () => {
|
|||
registerGraphQLEndpoint: jest.fn(),
|
||||
getIndexPatternsService: jest.fn(),
|
||||
};
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
|
||||
|
@ -125,7 +125,7 @@ describe('Siem Overview elasticsearch_adapter', () => {
|
|||
registerGraphQLEndpoint: jest.fn(),
|
||||
getIndexPatternsService: jest.fn(),
|
||||
};
|
||||
jest.mock('../framework', () => ({
|
||||
jest.doMock('../framework', () => ({
|
||||
callWithRequest: mockCallWithRequest,
|
||||
}));
|
||||
|
||||
|
|
3
x-pack/plugins/siem/tsconfig.json
Normal file
3
x-pack/plugins/siem/tsconfig.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
}
|
Loading…
Reference in a new issue