diff --git a/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/alerts_histogram.tsx b/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/alerts_histogram.tsx index 11dcbfa39d574e2..ffd7f7918ec72b0 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/alerts_histogram.tsx +++ b/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/alerts_histogram.tsx @@ -26,11 +26,11 @@ const DEFAULT_CHART_HEIGHT = 174; interface AlertsHistogramProps { chartHeight?: number; - from: number; + from: string; legendItems: LegendItem[]; legendPosition?: Position; loading: boolean; - to: number; + to: string; data: HistogramData[]; updateDateRange: UpdateDateRange; } diff --git a/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/helpers.tsx b/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/helpers.tsx index 9d124201f022e1c..16ea9669026eec2 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/helpers.tsx +++ b/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/helpers.tsx @@ -3,6 +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 moment from 'moment'; import { showAllOthersBucket } from '../../../../common/constants'; import { HistogramData, AlertsAggregation, AlertsBucket, AlertsGroupBucket } from './types'; @@ -28,8 +29,8 @@ export const formatAlertsData = (alertsData: AlertSearchResponse<{}, AlertsAggre export const getAlertsHistogramQuery = ( stackByField: string, - from: number, - to: number, + from: string, + to: string, additionalFilters: Array<{ bool: { filter: unknown[]; should: unknown[]; must_not: unknown[]; must: unknown[] }; }> @@ -55,7 +56,7 @@ export const getAlertsHistogramQuery = ( alerts: { date_histogram: { field: '@timestamp', - fixed_interval: `${Math.floor((to - from) / 32)}ms`, + fixed_interval: `${Math.floor(moment(to).diff(from) / 32)}ms`, min_doc_count: 0, extended_bounds: { min: from, diff --git a/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/index.test.tsx b/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/index.test.tsx index 2923446b8322d14..1ffcdc9099b41ed 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/index.test.tsx +++ b/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/index.test.tsx @@ -40,10 +40,10 @@ jest.mock('../../../common/components/navigation/use_get_url_search'); describe('AlertsHistogramPanel', () => { const defaultProps = { - from: 0, + from: '0', signalIndexName: 'signalIndexName', setQuery: jest.fn(), - to: 1, + to: '1', updateDateRange: jest.fn(), }; diff --git a/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/index.tsx b/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/index.tsx index b6db6eb93d77f3f..f14d94497f38f59 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/index.tsx +++ b/x-pack/plugins/security_solution/public/alerts/components/alerts_histogram_panel/index.tsx @@ -57,7 +57,7 @@ interface AlertsHistogramPanelProps { defaultStackByOption?: AlertsHistogramOption; deleteQuery?: ({ id }: { id: string }) => void; filters?: Filter[]; - from: number; + from: string; headerChildren?: React.ReactNode; /** Override all defaults, and only display this field */ onlyField?: string; @@ -70,7 +70,7 @@ interface AlertsHistogramPanelProps { showTotalAlertsCount?: boolean; stackByOptions?: AlertsHistogramOption[]; title?: string; - to: number; + to: string; updateDateRange: UpdateDateRange; } diff --git a/x-pack/plugins/security_solution/public/alerts/components/alerts_table/index.tsx b/x-pack/plugins/security_solution/public/alerts/components/alerts_table/index.tsx index 98bb6434ddafd7a..065cc53de595e06 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/alerts_table/index.tsx +++ b/x-pack/plugins/security_solution/public/alerts/components/alerts_table/index.tsx @@ -54,10 +54,10 @@ interface OwnProps { canUserCRUD: boolean; defaultFilters?: Filter[]; hasIndexWrite: boolean; - from: number; + from: string; loading: boolean; signalsIndex: string; - to: number; + to: string; } type AlertsTableComponentProps = OwnProps & PropsFromRedux; diff --git a/x-pack/plugins/security_solution/public/alerts/components/alerts_table/types.ts b/x-pack/plugins/security_solution/public/alerts/components/alerts_table/types.ts index b127ff04eca46d3..fbe492c22840435 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/alerts_table/types.ts +++ b/x-pack/plugins/security_solution/public/alerts/components/alerts_table/types.ts @@ -59,9 +59,9 @@ export interface SendAlertToTimelineActionProps { export type UpdateTimelineLoading = ({ id, isLoading }: { id: string; isLoading: boolean }) => void; export interface CreateTimelineProps { - from: number; + from: string; timeline: TimelineModel; - to: number; + to: string; ruleNote?: string; } diff --git a/x-pack/plugins/security_solution/public/common/components/alerts_viewer/alerts_table.tsx b/x-pack/plugins/security_solution/public/common/components/alerts_viewer/alerts_table.tsx index 6783fcbd17582bb..1b53ac3273661ca 100644 --- a/x-pack/plugins/security_solution/public/common/components/alerts_viewer/alerts_table.tsx +++ b/x-pack/plugins/security_solution/public/common/components/alerts_viewer/alerts_table.tsx @@ -16,9 +16,9 @@ import { getInvestigateInResolverAction } from '../../../timelines/components/ti import * as i18n from './translations'; export interface OwnProps { - end: number; + end: string; id: string; - start: number; + start: string; } const defaultAlertsFilters: Filter[] = [ @@ -56,8 +56,8 @@ const defaultAlertsFilters: Filter[] = [ interface Props { timelineId: TimelineIdLiteral; - endDate: number; - startDate: number; + endDate: string; + startDate: string; pageFilters?: Filter[]; } diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.test.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.test.tsx index ec56751b4cbd219..534cb77523376f7 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.test.tsx @@ -32,8 +32,8 @@ const mockUseResizeObserver: jest.Mock = useResizeObserver as jest.Mock; jest.mock('use-resize-observer/polyfilled'); mockUseResizeObserver.mockImplementation(() => ({})); -const from = 1566943856794; -const to = 1566857456791; +const from = '2019-08-27T22:10:56.794Z'; +const to = '2019-08-26T22:10:56.791Z'; describe('EventsViewer', () => { const mount = useMountAppended(); diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx index 9e38b14c4334a58..71a8eda5f50cb53 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/events_viewer.tsx @@ -53,7 +53,7 @@ interface Props { columns: ColumnHeaderOptions[]; dataProviders: DataProvider[]; deletedEventIds: Readonly; - end: number; + end: string; filters: Filter[]; headerFilterGroup?: React.ReactNode; height?: number; @@ -65,7 +65,7 @@ interface Props { kqlMode: KqlMode; onChangeItemsPerPage: OnChangeItemsPerPage; query: Query; - start: number; + start: string; sort: Sort; toggleColumn: (column: ColumnHeaderOptions) => void; utilityBar?: (refetch: inputsModel.Refetch, totalCount: number) => React.ReactNode; diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.test.tsx index edab0e3a9845686..994b96e33560834 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.test.tsx @@ -31,8 +31,8 @@ const mockUseResizeObserver: jest.Mock = useResizeObserver as jest.Mock; jest.mock('use-resize-observer/polyfilled'); mockUseResizeObserver.mockImplementation(() => ({})); -const from = 1566943856794; -const to = 1566857456791; +const from = '2019-08-27T22:10:56.794Z'; +const to = '2019-08-26T22:10:56.791Z'; describe('StatefulEventsViewer', () => { const mount = useMountAppended(); diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx index 1645db371802c3b..db701e4344b1498 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx @@ -27,9 +27,9 @@ import { InspectButtonContainer } from '../inspect'; export interface OwnProps { defaultIndices?: string[]; defaultModel: SubsetTimelineModel; - end: number; + end: string; id: string; - start: number; + start: string; headerFilterGroup?: React.ReactNode; pageFilters?: Filter[]; utilityBar?: (refetch: inputsModel.Refetch, totalCount: number) => React.ReactNode; diff --git a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/index.test.tsx index 52a97e26550ce69..a80ea48b93f3d6d 100644 --- a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/index.test.tsx @@ -53,7 +53,7 @@ describe('Matrix Histogram Component', () => { const mockMatrixOverTimeHistogramProps = { defaultIndex: ['defaultIndex'], defaultStackByOption: { text: 'text', value: 'value' }, - endDate: new Date('2019-07-18T20:00:00.000Z').valueOf(), + endDate: '2019-07-18T20:00:00.000Z', errorMessage: 'error', histogramType: HistogramType.alerts, id: 'mockId', @@ -64,7 +64,7 @@ describe('Matrix Histogram Component', () => { sourceId: 'default', stackByField: 'mockStackByField', stackByOptions: [{ text: 'text', value: 'value' }], - startDate: new Date('2019-07-18T19:00: 00.000Z').valueOf(), + startDate: '2019-07-18T19:00: 00.000Z', subtitle: 'mockSubtitle', totalCount: -1, title: 'mockTitle', diff --git a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts index a9e6cdd19bb2090..a7bf4459dbbabcb 100644 --- a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts +++ b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts @@ -44,10 +44,10 @@ interface MatrixHistogramBasicProps { defaultStackByOption: MatrixHistogramOption; dispatchSetAbsoluteRangeDatePicker: ActionCreator<{ id: InputsModelId; - from: number; - to: number; + from: string; + to: string; }>; - endDate: number; + endDate: string; headerChildren?: React.ReactNode; hideHistogramIfEmpty?: boolean; id: string; @@ -55,7 +55,7 @@ interface MatrixHistogramBasicProps { mapping?: MatrixHistogramMappingTypes; panelHeight?: number; setQuery: SetQuery; - startDate: number; + startDate: string; stackByOptions: MatrixHistogramOption[]; subtitle?: string | GetSubTitle; title?: string | GetTitle; @@ -63,17 +63,17 @@ interface MatrixHistogramBasicProps { } export interface MatrixHistogramQueryProps { - endDate: number; + endDate: string; errorMessage: string; filterQuery?: ESQuery | string | undefined; setAbsoluteRangeDatePicker?: ActionCreator<{ id: InputsModelId; - from: number; - to: number; + from: string; + to: string; }>; setAbsoluteRangeDatePickerTarget?: InputsModelId; stackByField: string; - startDate: number; + startDate: string; indexToAdd?: string[] | null; isInspected: boolean; histogramType: HistogramType; diff --git a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/utils.test.ts b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/utils.test.ts index 9e3ddcc014c61bd..e827131773c8921 100644 --- a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/utils.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/utils.test.ts @@ -22,8 +22,8 @@ describe('utils', () => { let configs: BarchartConfigs; beforeAll(() => { configs = getBarchartConfigs({ - from: 0, - to: 0, + from: '0', + to: '0', onBrushEnd: jest.fn() as UpdateDateRange, }); }); @@ -53,8 +53,8 @@ describe('utils', () => { beforeAll(() => { configs = getBarchartConfigs({ chartHeight: mockChartHeight, - from: 0, - to: 0, + from: '0', + to: '0', onBrushEnd: jest.fn() as UpdateDateRange, yTickFormatter: mockYTickFormatter, showLegend: false, diff --git a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/utils.ts b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/utils.ts index 45e9c54b2eff878..9474929d35a5173 100644 --- a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/utils.ts +++ b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/utils.ts @@ -13,9 +13,9 @@ import { histogramDateTimeFormatter } from '../utils'; interface GetBarchartConfigsProps { chartHeight?: number; - from: number; + from: string; legendPosition?: Position; - to: number; + to: string; onBrushEnd: UpdateDateRange; yTickFormatter?: (value: number) => string; showLegend?: boolean; diff --git a/x-pack/plugins/security_solution/public/common/components/ml/anomaly/anomaly_table_provider.tsx b/x-pack/plugins/security_solution/public/common/components/ml/anomaly/anomaly_table_provider.tsx index 6ccc41546e5587f..66e70ddc2e14f8d 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/anomaly/anomaly_table_provider.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml/anomaly/anomaly_table_provider.tsx @@ -15,8 +15,8 @@ interface ChildrenArgs { interface Props { influencers?: InfluencerInput[]; - startDate: number; - endDate: number; + startDate: string; + endDate: string; criteriaFields?: CriteriaFields[]; children: (args: ChildrenArgs) => React.ReactNode; skip: boolean; diff --git a/x-pack/plugins/security_solution/public/common/components/ml/links/create_explorer_link.test.ts b/x-pack/plugins/security_solution/public/common/components/ml/links/create_explorer_link.test.ts index 4a25f82a94a6181..30d0673192af850 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/links/create_explorer_link.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/links/create_explorer_link.test.ts @@ -18,8 +18,8 @@ describe('create_explorer_link', () => { test('it returns expected link', () => { const entities = createExplorerLink( anomalies.anomalies[0], - new Date('1970').valueOf(), - new Date('3000').valueOf() + new Date('1970').toISOString(), + new Date('3000').toISOString() ); expect(entities).toEqual( "#/explorer?_g=(ml:(jobIds:!(job-1)),refreshInterval:(display:Off,pause:!f,value:0),time:(from:'1970-01-01T00:00:00.000Z',mode:absolute,to:'3000-01-01T00:00:00.000Z'))&_a=(mlExplorerFilter:(),mlExplorerSwimlane:(),mlSelectLimit:(display:'10',val:10),mlShowCharts:!t)" diff --git a/x-pack/plugins/security_solution/public/common/components/ml/links/create_explorer_link.tsx b/x-pack/plugins/security_solution/public/common/components/ml/links/create_explorer_link.tsx index e00f53a08a91844..468bc962453f68f 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/links/create_explorer_link.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml/links/create_explorer_link.tsx @@ -11,8 +11,8 @@ import { useKibana } from '../../../lib/kibana'; interface ExplorerLinkProps { score: Anomaly; - startDate: number; - endDate: number; + startDate: string; + endDate: string; linkName: React.ReactNode; } @@ -35,7 +35,7 @@ export const ExplorerLink: React.FC = ({ ); }; -export const createExplorerLink = (score: Anomaly, startDate: number, endDate: number): string => { +export const createExplorerLink = (score: Anomaly, startDate: string, endDate: string): string => { const startDateIso = new Date(startDate).toISOString(); const endDateIso = new Date(endDate).toISOString(); diff --git a/x-pack/plugins/security_solution/public/common/components/ml/score/anomaly_score.test.tsx b/x-pack/plugins/security_solution/public/common/components/ml/score/anomaly_score.test.tsx index b172c22a9ed4e66..30dce938b62a9da 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/score/anomaly_score.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml/score/anomaly_score.test.tsx @@ -13,7 +13,7 @@ import { TestProviders } from '../../../mock/test_providers'; import { useMountAppended } from '../../../utils/use_mount_appended'; import { Anomalies } from '../types'; -const endDate: number = new Date('3000-01-01T00:00:00.000Z').valueOf(); +const endDate: string = '3000-01-01T00:00:00.000Z'; const narrowDateRange = jest.fn(); describe('anomaly_scores', () => { @@ -28,7 +28,7 @@ describe('anomaly_scores', () => { const wrapper = shallow( { { { @@ -29,7 +29,7 @@ describe('anomaly_scores', () => { const wrapper = shallow( { { { { { { { diff --git a/x-pack/plugins/security_solution/public/common/components/ml/score/score_interval_to_datetime.test.ts b/x-pack/plugins/security_solution/public/common/components/ml/score/score_interval_to_datetime.test.ts index 42c1978a98ee2dd..2abe58e6752f341 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/score/score_interval_to_datetime.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/score/score_interval_to_datetime.test.ts @@ -17,8 +17,8 @@ describe('score_interval_to_datetime', () => { test('converts a second interval to plus or minus (+/-) one hour', () => { const expected: FromTo = { - from: new Date('2019-06-25T04:31:59.345Z').valueOf(), - to: new Date('2019-06-25T06:31:59.345Z').valueOf(), + from: '2019-06-25T04:31:59.345Z', + to: '2019-06-25T06:31:59.345Z', }; anomalies.anomalies[0].time = new Date('2019-06-25T05:31:59.345Z').valueOf(); expect(scoreIntervalToDateTime(anomalies.anomalies[0], 'second')).toEqual(expected); @@ -26,8 +26,8 @@ describe('score_interval_to_datetime', () => { test('converts a minute interval to plus or minus (+/-) one hour', () => { const expected: FromTo = { - from: new Date('2019-06-25T04:31:59.345Z').valueOf(), - to: new Date('2019-06-25T06:31:59.345Z').valueOf(), + from: '2019-06-25T04:31:59.345Z', + to: '2019-06-25T06:31:59.345Z', }; anomalies.anomalies[0].time = new Date('2019-06-25T05:31:59.345Z').valueOf(); expect(scoreIntervalToDateTime(anomalies.anomalies[0], 'minute')).toEqual(expected); @@ -35,8 +35,8 @@ describe('score_interval_to_datetime', () => { test('converts a hour interval to plus or minus (+/-) one hour', () => { const expected: FromTo = { - from: new Date('2019-06-25T04:31:59.345Z').valueOf(), - to: new Date('2019-06-25T06:31:59.345Z').valueOf(), + from: '2019-06-25T04:31:59.345Z', + to: '2019-06-25T06:31:59.345Z', }; anomalies.anomalies[0].time = new Date('2019-06-25T05:31:59.345Z').valueOf(); expect(scoreIntervalToDateTime(anomalies.anomalies[0], 'hour')).toEqual(expected); @@ -44,8 +44,8 @@ describe('score_interval_to_datetime', () => { test('converts a day interval to plus or minus (+/-) one day', () => { const expected: FromTo = { - from: new Date('2019-06-24T05:31:59.345Z').valueOf(), - to: new Date('2019-06-26T05:31:59.345Z').valueOf(), + from: '2019-06-24T05:31:59.345Z', + to: '2019-06-26T05:31:59.345Z', }; anomalies.anomalies[0].time = new Date('2019-06-25T05:31:59.345Z').valueOf(); expect(scoreIntervalToDateTime(anomalies.anomalies[0], 'day')).toEqual(expected); diff --git a/x-pack/plugins/security_solution/public/common/components/ml/score/score_interval_to_datetime.ts b/x-pack/plugins/security_solution/public/common/components/ml/score/score_interval_to_datetime.ts index b1257676a64b25e..69b5be9272a385d 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/score/score_interval_to_datetime.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/score/score_interval_to_datetime.ts @@ -8,21 +8,21 @@ import moment from 'moment'; import { Anomaly } from '../types'; export interface FromTo { - from: number; - to: number; + from: string; + to: string; } export const scoreIntervalToDateTime = (score: Anomaly, interval: string): FromTo => { if (interval === 'second' || interval === 'minute' || interval === 'hour') { return { - from: moment(score.time).subtract(1, 'hour').valueOf(), - to: moment(score.time).add(1, 'hour').valueOf(), + from: moment(score.time).subtract(1, 'hour').toISOString(), + to: moment(score.time).add(1, 'hour').toISOString(), }; } else { // default should be a day return { - from: moment(score.time).subtract(1, 'day').valueOf(), - to: moment(score.time).add(1, 'day').valueOf(), + from: moment(score.time).subtract(1, 'day').toISOString(), + to: moment(score.time).add(1, 'day').toISOString(), }; } }; diff --git a/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_host_table_columns.test.tsx b/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_host_table_columns.test.tsx index 93b22460d4ed77e..b90946c534f3ac5 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_host_table_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_host_table_columns.test.tsx @@ -13,8 +13,8 @@ import { TestProviders } from '../../../mock'; import React from 'react'; import { useMountAppended } from '../../../utils/use_mount_appended'; -const startDate = new Date(2001).valueOf(); -const endDate = new Date(3000).valueOf(); +const startDate = new Date(2001).toISOString(); +const endDate = new Date(3000).toISOString(); const interval = 'days'; const narrowDateRange = jest.fn(); diff --git a/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_host_table_columns.tsx b/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_host_table_columns.tsx index fc89189bf4f4652..b72da55128f994f 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_host_table_columns.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_host_table_columns.tsx @@ -24,8 +24,8 @@ import { escapeDataProviderId } from '../../drag_and_drop/helpers'; import { FormattedRelativePreferenceDate } from '../../formatted_date'; export const getAnomaliesHostTableColumns = ( - startDate: number, - endDate: number, + startDate: string, + endDate: string, interval: string, narrowDateRange: NarrowDateRange ): [ @@ -132,8 +132,8 @@ export const getAnomaliesHostTableColumns = ( export const getAnomaliesHostTableColumnsCurated = ( pageType: HostsType, - startDate: number, - endDate: number, + startDate: string, + endDate: string, interval: string, narrowDateRange: NarrowDateRange ) => { diff --git a/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_network_table_columns.tsx b/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_network_table_columns.tsx index ce4269afbe5b2a6..52b26a20a8f6443 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_network_table_columns.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_network_table_columns.tsx @@ -26,8 +26,8 @@ import { escapeDataProviderId } from '../../drag_and_drop/helpers'; import { FlowTarget } from '../../../../graphql/types'; export const getAnomaliesNetworkTableColumns = ( - startDate: number, - endDate: number, + startDate: string, + endDate: string, flowTarget?: FlowTarget ): [ Columns, @@ -127,8 +127,8 @@ export const getAnomaliesNetworkTableColumns = ( export const getAnomaliesNetworkTableColumnsCurated = ( pageType: NetworkType, - startDate: number, - endDate: number, + startDate: string, + endDate: string, flowTarget?: FlowTarget ) => { const columns = getAnomaliesNetworkTableColumns(startDate, endDate, flowTarget); diff --git a/x-pack/plugins/security_solution/public/common/components/ml/tables/host_equality.test.ts b/x-pack/plugins/security_solution/public/common/components/ml/tables/host_equality.test.ts index 89b87f95e5159df..eaaf5a9aedcdb91 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/tables/host_equality.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/tables/host_equality.test.ts @@ -11,15 +11,15 @@ import { HostsType } from '../../../../hosts/store/model'; describe('host_equality', () => { test('it returns true if start and end date are equal', () => { const prev: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, }; const next: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, @@ -30,15 +30,15 @@ describe('host_equality', () => { test('it returns false if starts are not equal', () => { const prev: AnomaliesHostTableProps = { - startDate: new Date('2001').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2001').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, }; const next: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, @@ -49,15 +49,15 @@ describe('host_equality', () => { test('it returns false if starts are not equal for next', () => { const prev: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, }; const next: AnomaliesHostTableProps = { - startDate: new Date('2001').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2001').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, @@ -68,15 +68,15 @@ describe('host_equality', () => { test('it returns false if ends are not equal', () => { const prev: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2001').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2001').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, }; const next: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, @@ -87,15 +87,15 @@ describe('host_equality', () => { test('it returns false if ends are not equal for next', () => { const prev: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, }; const next: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2001').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2001').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, @@ -106,15 +106,15 @@ describe('host_equality', () => { test('it returns false if skip is not equal', () => { const prev: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: true, type: HostsType.details, }; const next: AnomaliesHostTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: HostsType.details, diff --git a/x-pack/plugins/security_solution/public/common/components/ml/tables/network_equality.test.ts b/x-pack/plugins/security_solution/public/common/components/ml/tables/network_equality.test.ts index 8b3e30c32903143..3819e9d0e4b3feb 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/tables/network_equality.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/tables/network_equality.test.ts @@ -12,15 +12,15 @@ import { FlowTarget } from '../../../../graphql/types'; describe('network_equality', () => { test('it returns true if start and end date are equal', () => { const prev: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, }; const next: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, @@ -31,15 +31,15 @@ describe('network_equality', () => { test('it returns false if starts are not equal', () => { const prev: AnomaliesNetworkTableProps = { - startDate: new Date('2001').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2001').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, }; const next: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, @@ -50,15 +50,15 @@ describe('network_equality', () => { test('it returns false if starts are not equal for next', () => { const prev: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, }; const next: AnomaliesNetworkTableProps = { - startDate: new Date('2001').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2001').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, @@ -69,15 +69,15 @@ describe('network_equality', () => { test('it returns false if ends are not equal', () => { const prev: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2001').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2001').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, }; const next: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, @@ -88,15 +88,15 @@ describe('network_equality', () => { test('it returns false if ends are not equal for next', () => { const prev: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, }; const next: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2001').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2001').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, @@ -107,15 +107,15 @@ describe('network_equality', () => { test('it returns false if skip is not equal', () => { const prev: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: true, type: NetworkType.details, }; const next: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, @@ -126,16 +126,16 @@ describe('network_equality', () => { test('it returns false if flowType is not equal', () => { const prev: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: true, type: NetworkType.details, flowTarget: FlowTarget.source, }; const next: AnomaliesNetworkTableProps = { - startDate: new Date('2000').valueOf(), - endDate: new Date('2000').valueOf(), + startDate: new Date('2000').toISOString(), + endDate: new Date('2000').toISOString(), narrowDateRange: jest.fn(), skip: false, type: NetworkType.details, diff --git a/x-pack/plugins/security_solution/public/common/components/ml/types.ts b/x-pack/plugins/security_solution/public/common/components/ml/types.ts index 13bceaa473a84fb..a4c4f728b0f8f59 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/types.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/types.ts @@ -75,8 +75,8 @@ export interface AnomaliesByNetwork { } export interface HostOrNetworkProps { - startDate: number; - endDate: number; + startDate: string; + endDate: string; narrowDateRange: NarrowDateRange; skip: boolean; } diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts b/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts index ade76f8e2433832..061c7637fae256b 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts @@ -80,20 +80,20 @@ const getMockObject = ( global: { linkTo: ['timeline'], timerange: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, }, timeline: { linkTo: ['global'], timerange: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, }, @@ -123,7 +123,7 @@ describe('Navigation Breadcrumbs', () => { }, { href: - 'securitySolution:hosts?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:hosts?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', text: 'Hosts', }, { @@ -143,7 +143,7 @@ describe('Navigation Breadcrumbs', () => { { text: 'Network', href: - 'securitySolution:network?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:network?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', }, { text: 'Flows', @@ -162,7 +162,7 @@ describe('Navigation Breadcrumbs', () => { { text: 'Timelines', href: - 'securitySolution:timelines?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:timelines?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', }, ]); }); @@ -177,12 +177,12 @@ describe('Navigation Breadcrumbs', () => { { text: 'Hosts', href: - 'securitySolution:hosts?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:hosts?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', }, { text: 'siem-kibana', href: - 'securitySolution:hosts/siem-kibana?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:hosts/siem-kibana?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', }, { text: 'Authentications', href: '' }, ]); @@ -198,11 +198,11 @@ describe('Navigation Breadcrumbs', () => { { text: 'Network', href: - 'securitySolution:network?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:network?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', }, { text: ipv4, - href: `securitySolution:network/ip/${ipv4}/source?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))`, + href: `securitySolution:network/ip/${ipv4}/source?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))`, }, { text: 'Flows', href: '' }, ]); @@ -218,11 +218,11 @@ describe('Navigation Breadcrumbs', () => { { text: 'Network', href: - 'securitySolution:network?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:network?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', }, { text: ipv6, - href: `securitySolution:network/ip/${ipv6Encoded}/source?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))`, + href: `securitySolution:network/ip/${ipv6Encoded}/source?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))`, }, { text: 'Flows', href: '' }, ]); @@ -237,12 +237,12 @@ describe('Navigation Breadcrumbs', () => { { text: 'Hosts', href: - 'securitySolution:hosts?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:hosts?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', }, { text: 'siem-kibana', href: - 'securitySolution:hosts/siem-kibana?timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))', + 'securitySolution:hosts/siem-kibana?timerange=(global:(linkTo:!(timeline),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)),timeline:(linkTo:!(global),timerange:(from:2019-05-16T23:10:43.696Z,fromStr:now-24h,kind:relative,to:2019-05-17T23:10:43.697Z,toStr:now)))', }, { text: 'Authentications', href: '' }, ]); diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/navigation/index.test.tsx index 10f8b11b4d9c528..a7af54a09997026 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/navigation/index.test.tsx @@ -57,20 +57,20 @@ describe('SIEM Navigation', () => { [CONSTANTS.timerange]: { global: { [CONSTANTS.timerange]: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, linkTo: ['timeline'], }, timeline: { [CONSTANTS.timerange]: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, linkTo: ['global'], @@ -160,20 +160,20 @@ describe('SIEM Navigation', () => { global: { linkTo: ['timeline'], timerange: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, }, timeline: { linkTo: ['global'], timerange: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, }, @@ -259,20 +259,20 @@ describe('SIEM Navigation', () => { global: { linkTo: ['timeline'], timerange: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, }, timeline: { linkTo: ['global'], timerange: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, }, diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/tab_navigation/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/navigation/tab_navigation/index.test.tsx index f345346d620cb19..b25cf3779801b7f 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/tab_navigation/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/navigation/tab_navigation/index.test.tsx @@ -47,20 +47,20 @@ describe('Tab Navigation', () => { [CONSTANTS.timerange]: { global: { [CONSTANTS.timerange]: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, linkTo: ['timeline'], }, timeline: { [CONSTANTS.timerange]: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, linkTo: ['global'], @@ -105,20 +105,20 @@ describe('Tab Navigation', () => { [CONSTANTS.timerange]: { global: { [CONSTANTS.timerange]: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, linkTo: ['timeline'], }, timeline: { [CONSTANTS.timerange]: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, linkTo: ['global'], diff --git a/x-pack/plugins/security_solution/public/common/components/stat_items/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/stat_items/index.test.tsx index f548275b36e7099..815a9053ac0c8cb 100644 --- a/x-pack/plugins/security_solution/public/common/components/stat_items/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/stat_items/index.test.tsx @@ -41,8 +41,8 @@ import { State, createStore } from '../../store'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { KpiNetworkData, KpiHostsData } from '../../../graphql/types'; -const from = new Date('2019-06-15T06:00:00.000Z').valueOf(); -const to = new Date('2019-06-18T06:00:00.000Z').valueOf(); +const from = '2019-06-15T06:00:00.000Z'; +const to = '2019-06-18T06:00:00.000Z'; jest.mock('../charts/areachart', () => { return { AreaChart: () =>
}; diff --git a/x-pack/plugins/security_solution/public/common/components/stat_items/index.tsx b/x-pack/plugins/security_solution/public/common/components/stat_items/index.tsx index dee730059b03a68..183f89d9320f358 100644 --- a/x-pack/plugins/security_solution/public/common/components/stat_items/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/stat_items/index.tsx @@ -66,10 +66,10 @@ export interface StatItems { export interface StatItemsProps extends StatItems { areaChart?: ChartSeriesData[]; barChart?: ChartSeriesData[]; - from: number; + from: string; id: string; narrowDateRange: UpdateDateRange; - to: number; + to: string; } export const numberFormatter = (value: string | number): string => value.toLocaleString(); @@ -160,8 +160,8 @@ export const useKpiMatrixStatus = ( mappings: Readonly, data: KpiHostsData | KpiNetworkData, id: string, - from: number, - to: number, + from: string, + to: string, narrowDateRange: UpdateDateRange ): StatItemsProps[] => { const [statItemsProps, setStatItemsProps] = useState(mappings as StatItemsProps[]); diff --git a/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.test.tsx index 164ca177ee91ada..274770453aa113f 100644 --- a/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.test.tsx @@ -156,8 +156,8 @@ describe('SIEM Super Date Picker', () => { }); test('Make Sure to (end date) is superior than from (start date)', () => { - expect(store.getState().inputs.global.timerange.to).toBeGreaterThan( - store.getState().inputs.global.timerange.from + expect(new Date(store.getState().inputs.global.timerange.to).valueOf()).toBeGreaterThan( + new Date(store.getState().inputs.global.timerange.from).valueOf() ); }); }); @@ -321,7 +321,7 @@ describe('SIEM Super Date Picker', () => { const mapStateToProps = makeMapStateToProps(); const props1 = mapStateToProps(state, { id: 'global' }); const clone = cloneDeep(state); - clone.inputs.global.timerange.from = 999; + clone.inputs.global.timerange.from = '999'; const props2 = mapStateToProps(clone, { id: 'global' }); expect(props1.start).not.toBe(props2.start); }); @@ -330,7 +330,7 @@ describe('SIEM Super Date Picker', () => { const mapStateToProps = makeMapStateToProps(); const props1 = mapStateToProps(state, { id: 'global' }); const clone = cloneDeep(state); - clone.inputs.global.timerange.to = 999; + clone.inputs.global.timerange.to = '999'; const props2 = mapStateToProps(clone, { id: 'global' }); expect(props1.end).not.toBe(props2.end); }); diff --git a/x-pack/plugins/security_solution/public/common/components/super_date_picker/selectors.test.ts b/x-pack/plugins/security_solution/public/common/components/super_date_picker/selectors.test.ts index 1dafa141542bfd3..51f844a42c74f38 100644 --- a/x-pack/plugins/security_solution/public/common/components/super_date_picker/selectors.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/super_date_picker/selectors.test.ts @@ -23,8 +23,8 @@ describe('selectors', () => { kind: 'absolute', fromStr: undefined, toStr: undefined, - from: 0, - to: 0, + from: '0', + to: '0', }; let inputState: InputsRange = { @@ -57,8 +57,8 @@ describe('selectors', () => { kind: 'absolute', fromStr: undefined, toStr: undefined, - from: 0, - to: 0, + from: '0', + to: '0', }; inputState = { @@ -147,8 +147,8 @@ describe('selectors', () => { kind: 'relative', fromStr: '', toStr: '', - from: 1, - to: 0, + from: '0', + to: '0', }; const change: InputsRange = { ...inputState, @@ -179,8 +179,8 @@ describe('selectors', () => { kind: 'relative', fromStr: '', toStr: '', - from: 1, - to: 0, + from: '0', + to: '0', }; const change: InputsRange = { ...inputState, @@ -211,8 +211,8 @@ describe('selectors', () => { kind: 'relative', fromStr: '', toStr: '', - from: 0, - to: 1, + from: '0', + to: '1', }; const change: InputsRange = { ...inputState, @@ -243,8 +243,8 @@ describe('selectors', () => { kind: 'relative', fromStr: '', toStr: '', - from: 0, - to: 0, + from: '0', + to: '0', }; const change: InputsRange = { ...inputState, @@ -275,8 +275,8 @@ describe('selectors', () => { kind: 'relative', fromStr: '', toStr: '', - from: 0, - to: 0, + from: '0', + to: '0', }; const change: InputsRange = { ...inputState, diff --git a/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx index 336f906b3bed044..26f89842221196e 100644 --- a/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx @@ -86,8 +86,8 @@ const state: State = { kind: 'relative', fromStr: 'now-24h', toStr: 'now', - from: 1586835969047, - to: 1586922369047, + from: '2020-04-14T03:46:09.047Z', + to: '2020-04-15T03:46:09.047Z', }, }, }, diff --git a/x-pack/plugins/security_solution/public/common/components/top_n/top_n.test.tsx b/x-pack/plugins/security_solution/public/common/components/top_n/top_n.test.tsx index b1979c501c7786d..e5a1fb612028504 100644 --- a/x-pack/plugins/security_solution/public/common/components/top_n/top_n.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/top_n/top_n.test.tsx @@ -114,14 +114,14 @@ describe('TopN', () => { defaultView="raw" field={field} filters={[]} - from={1586824307695} + from={'2020-04-14T00:31:47.695Z'} indexPattern={mockIndexPattern} options={defaultOptions} query={query} setAbsoluteRangeDatePicker={setAbsoluteRangeDatePicker} setAbsoluteRangeDatePickerTarget="global" setQuery={jest.fn()} - to={1586910707695} + to={'2020-04-15T00:31:47.695Z'} toggleTopN={toggleTopN} value={value} /> @@ -153,14 +153,14 @@ describe('TopN', () => { defaultView="raw" field={field} filters={[]} - from={1586824307695} + from={'2020-04-14T00:31:47.695Z'} indexPattern={mockIndexPattern} options={defaultOptions} query={query} setAbsoluteRangeDatePicker={setAbsoluteRangeDatePicker} setAbsoluteRangeDatePickerTarget="global" setQuery={jest.fn()} - to={1586910707695} + to={'2020-04-15T00:31:47.695Z'} toggleTopN={toggleTopN} value={value} /> @@ -191,14 +191,14 @@ describe('TopN', () => { defaultView="alert" field={field} filters={[]} - from={1586824307695} + from={'2020-04-14T00:31:47.695Z'} indexPattern={mockIndexPattern} options={defaultOptions} query={query} setAbsoluteRangeDatePicker={setAbsoluteRangeDatePicker} setAbsoluteRangeDatePickerTarget="global" setQuery={jest.fn()} - to={1586910707695} + to={'2020-04-15T00:31:47.695Z'} toggleTopN={toggleTopN} value={value} /> @@ -228,14 +228,14 @@ describe('TopN', () => { defaultView="all" field={field} filters={[]} - from={1586824307695} + from={'2020-04-14T00:31:47.695Z'} indexPattern={mockIndexPattern} options={allEvents} query={query} setAbsoluteRangeDatePicker={setAbsoluteRangeDatePicker} setAbsoluteRangeDatePickerTarget="global" setQuery={jest.fn()} - to={1586910707695} + to={'2020-04-15T00:31:47.695Z'} toggleTopN={jest.fn()} value={value} /> diff --git a/x-pack/plugins/security_solution/public/common/components/top_n/top_n.tsx b/x-pack/plugins/security_solution/public/common/components/top_n/top_n.tsx index 0ccb7e1e72f1f51..3572bb5d7804997 100644 --- a/x-pack/plugins/security_solution/public/common/components/top_n/top_n.tsx +++ b/x-pack/plugins/security_solution/public/common/components/top_n/top_n.tsx @@ -49,15 +49,15 @@ export interface Props { deleteQuery?: ({ id }: { id: string }) => void; field: string; filters: Filter[]; - from: number; + from: string; indexPattern: IIndexPattern; indexToAdd?: string[] | null; options: TopNOption[]; query: Query; setAbsoluteRangeDatePicker: ActionCreator<{ id: InputsModelId; - from: number; - to: number; + from: string; + to: string; }>; setAbsoluteRangeDatePickerTarget: InputsModelId; setQuery: (params: { @@ -66,7 +66,7 @@ export interface Props { loading: boolean; refetch: inputsModel.Refetch; }) => void; - to: number; + to: string; toggleTopN: () => void; onFilterAdded?: () => void; value?: string[] | string | null; diff --git a/x-pack/plugins/security_solution/public/common/components/url_state/initialize_redux_by_url.tsx b/x-pack/plugins/security_solution/public/common/components/url_state/initialize_redux_by_url.tsx index 38917be76c9187c..4ef94136e782141 100644 --- a/x-pack/plugins/security_solution/public/common/components/url_state/initialize_redux_by_url.tsx +++ b/x-pack/plugins/security_solution/public/common/components/url_state/initialize_redux_by_url.tsx @@ -92,9 +92,7 @@ export const dispatchSetInitialStateFromUrl = ( }); }; -const timeRangeToISOString = ( - timerange: AbsoluteTimeRange | RelativeTimeRange -): AbsoluteTimeRange | RelativeTimeRange => { +const timeRangeToISOString = (timerange: T): T => { const range = { ...timerange }; if (isNumber(range.from)) { @@ -133,7 +131,7 @@ const updateTimerange = (newUrlStateString: string, dispatch: Dispatch) => { if (timelineType) { if (timelineType === 'absolute') { - const absoluteRange = timeRangeToISOString( + const absoluteRange = timeRangeToISOString( normalizeTimeRange(get('timeline.timerange', timerangeStateData)) ); @@ -146,7 +144,7 @@ const updateTimerange = (newUrlStateString: string, dispatch: Dispatch) => { } if (timelineType === 'relative') { - const relativeRange = timeRangeToISOString( + const relativeRange = timeRangeToISOString( normalizeTimeRange(get('timeline.timerange', timerangeStateData)) ); @@ -161,7 +159,7 @@ const updateTimerange = (newUrlStateString: string, dispatch: Dispatch) => { if (globalType) { if (globalType === 'absolute') { - const absoluteRange = timeRangeToISOString( + const absoluteRange = timeRangeToISOString( normalizeTimeRange(get('global.timerange', timerangeStateData)) ); @@ -173,7 +171,7 @@ const updateTimerange = (newUrlStateString: string, dispatch: Dispatch) => { ); } if (globalType === 'relative') { - const relativeRange = timeRangeToISOString( + const relativeRange = timeRangeToISOString( normalizeTimeRange(get('global.timerange', timerangeStateData)) ); diff --git a/x-pack/plugins/security_solution/public/common/components/url_state/normalize_time_range.test.ts b/x-pack/plugins/security_solution/public/common/components/url_state/normalize_time_range.test.ts index dcdadf0f3407276..c6d20049fceacdd 100644 --- a/x-pack/plugins/security_solution/public/common/components/url_state/normalize_time_range.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/url_state/normalize_time_range.test.ts @@ -25,8 +25,8 @@ describe('#normalizeTimeRange', () => { if (isAbsoluteTimeRange(dateTimeRange)) { const expected: AbsoluteTimeRange = { kind: 'absolute', - from: 0, - to: 0, + from: '0', + to: '0', fromStr: undefined, toStr: undefined, }; @@ -47,8 +47,8 @@ describe('#normalizeTimeRange', () => { if (isAbsoluteTimeRange(dateTimeRange)) { const expected: AbsoluteTimeRange = { kind: 'absolute', - from: 0, - to: 0, + from: '0', + to: '0', fromStr: undefined, toStr: undefined, }; @@ -71,8 +71,8 @@ describe('#normalizeTimeRange', () => { if (isAbsoluteTimeRange(dateTimeRange)) { const expected: AbsoluteTimeRange = { kind: 'absolute', - from: from.valueOf(), - to: to.valueOf(), + from: from.toISOString(), + to: to.toISOString(), fromStr: undefined, toStr: undefined, }; @@ -89,14 +89,14 @@ describe('#normalizeTimeRange', () => { kind: 'absolute', fromStr: undefined, toStr: undefined, - from: from.valueOf(), - to: to.valueOf(), + from: from.toISOString(), + to: to.toISOString(), }; if (isAbsoluteTimeRange(dateTimeRange)) { const expected: AbsoluteTimeRange = { kind: 'absolute', - from: from.valueOf(), - to: to.valueOf(), + from: from.toISOString(), + to: to.toISOString(), fromStr: undefined, toStr: undefined, }; @@ -113,14 +113,14 @@ describe('#normalizeTimeRange', () => { kind: 'absolute', fromStr: undefined, toStr: undefined, - from: `${from.valueOf()}`, - to: `${to.valueOf()}`, + from: `${from.toISOString()}`, + to: `${to.toISOString()}`, }; if (isAbsoluteTimeRange(dateTimeRange)) { const expected: AbsoluteTimeRange = { kind: 'absolute', - from: from.valueOf(), - to: to.valueOf(), + from: from.toISOString(), + to: to.toISOString(), fromStr: undefined, toStr: undefined, }; @@ -130,7 +130,7 @@ describe('#normalizeTimeRange', () => { } }); - test('Absolute time range returns NaN with from and to when garbage is sent in', () => { + test('Absolute time range returns empty string with from and to when garbage is sent in', () => { const to = 'garbage'; const from = 'garbage'; const dateTimeRange: URLTimeRange = { @@ -143,8 +143,8 @@ describe('#normalizeTimeRange', () => { if (isAbsoluteTimeRange(dateTimeRange)) { const expected: AbsoluteTimeRange = { kind: 'absolute', - from: NaN, - to: NaN, + from: '', + to: '', fromStr: undefined, toStr: undefined, }; @@ -165,8 +165,8 @@ describe('#normalizeTimeRange', () => { if (isRelativeTimeRange(dateTimeRange)) { const expected: RelativeTimeRange = { kind: 'relative', - from: 0, - to: 0, + from: '0', + to: '0', fromStr: '', toStr: '', }; @@ -187,8 +187,8 @@ describe('#normalizeTimeRange', () => { if (isRelativeTimeRange(dateTimeRange)) { const expected: RelativeTimeRange = { kind: 'relative', - from: 0, - to: 0, + from: '0', + to: '0', fromStr: '', toStr: '', }; @@ -211,8 +211,8 @@ describe('#normalizeTimeRange', () => { if (isRelativeTimeRange(dateTimeRange)) { const expected: RelativeTimeRange = { kind: 'relative', - from: from.valueOf(), - to: to.valueOf(), + from: from.toISOString(), + to: to.toISOString(), fromStr: '', toStr: '', }; @@ -229,14 +229,14 @@ describe('#normalizeTimeRange', () => { kind: 'relative', fromStr: '', toStr: '', - from: from.valueOf(), - to: to.valueOf(), + from: from.toISOString(), + to: to.toISOString(), }; if (isRelativeTimeRange(dateTimeRange)) { const expected: RelativeTimeRange = { kind: 'relative', - from: from.valueOf(), - to: to.valueOf(), + from: from.toISOString(), + to: to.toISOString(), fromStr: '', toStr: '', }; @@ -253,14 +253,14 @@ describe('#normalizeTimeRange', () => { kind: 'relative', fromStr: '', toStr: '', - from: `${from.valueOf()}`, - to: `${to.valueOf()}`, + from: `${from.toISOString()}`, + to: `${to.toISOString()}`, }; if (isRelativeTimeRange(dateTimeRange)) { const expected: RelativeTimeRange = { kind: 'relative', - from: from.valueOf(), - to: to.valueOf(), + from: from.toISOString(), + to: to.toISOString(), fromStr: '', toStr: '', }; @@ -270,7 +270,7 @@ describe('#normalizeTimeRange', () => { } }); - test('Relative time range returns NaN with from and to when garbage is sent in', () => { + test('Relative time range returns empty string with from and to when garbage is sent in', () => { const to = 'garbage'; const from = 'garbage'; const dateTimeRange: URLTimeRange = { @@ -283,8 +283,8 @@ describe('#normalizeTimeRange', () => { if (isRelativeTimeRange(dateTimeRange)) { const expected: RelativeTimeRange = { kind: 'relative', - from: NaN, - to: NaN, + from: '', + to: '', fromStr: '', toStr: '', }; diff --git a/x-pack/plugins/security_solution/public/common/components/url_state/test_dependencies.ts b/x-pack/plugins/security_solution/public/common/components/url_state/test_dependencies.ts index dec1672b076eb5c..8d471e843320c23 100644 --- a/x-pack/plugins/security_solution/public/common/components/url_state/test_dependencies.ts +++ b/x-pack/plugins/security_solution/public/common/components/url_state/test_dependencies.ts @@ -92,20 +92,20 @@ export const defaultProps: UrlStateContainerPropTypes = { [CONSTANTS.timerange]: { global: { [CONSTANTS.timerange]: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, linkTo: ['timeline'], }, timeline: { [CONSTANTS.timerange]: { - from: 1558048243696, + from: '2019-05-16T23:10:43.696Z', fromStr: 'now-24h', kind: 'relative', - to: 1558134643697, + to: '2019-05-17T23:10:43.697Z', toStr: 'now', }, linkTo: ['global'], diff --git a/x-pack/plugins/security_solution/public/common/components/utils.ts b/x-pack/plugins/security_solution/public/common/components/utils.ts index ff022fd7d763d71..3620b09495eb6de 100644 --- a/x-pack/plugins/security_solution/public/common/components/utils.ts +++ b/x-pack/plugins/security_solution/public/common/components/utils.ts @@ -20,7 +20,7 @@ export const getDaysDiff = (minDate: moment.Moment, maxDate: moment.Moment) => { return diff; }; -export const histogramDateTimeFormatter = (domain: [number, number] | null, fixedDiff?: number) => { +export const histogramDateTimeFormatter = (domain: [string, string] | null, fixedDiff?: number) => { const diff = fixedDiff ?? getDaysDiff(moment(domain![0]), moment(domain![1])); const format = niceTimeFormatByDay(diff); return timeFormatter(format); diff --git a/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/types.ts b/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/types.ts index a2009809a9916ad..771e7ae5b45e83a 100644 --- a/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/types.ts +++ b/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/types.ts @@ -22,11 +22,11 @@ export type AnomaliesQueryTabBodyProps = QueryTabBodyProps & { // eslint-disable-next-line @typescript-eslint/no-explicit-any AnomaliesTableComponent: React.NamedExoticComponent; deleteQuery?: ({ id }: { id: string }) => void; - endDate: number; + endDate: string; flowTarget?: FlowTarget; narrowDateRange: NarrowDateRange; setQuery: SetQuery; - startDate: number; + startDate: string; skip: boolean; updateDateRange?: UpdateDateRange; hideHistogramIfEmpty?: boolean; diff --git a/x-pack/plugins/security_solution/public/common/containers/global_time/index.tsx b/x-pack/plugins/security_solution/public/common/containers/global_time/index.tsx index 9c9778c7074ee14..f2545c1642d4933 100644 --- a/x-pack/plugins/security_solution/public/common/containers/global_time/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/global_time/index.tsx @@ -18,8 +18,8 @@ interface SetQuery { } export interface GlobalTimeArgs { - from: number; - to: number; + from: string; + to: string; setQuery: ({ id, inspect, loading, refetch }: SetQuery) => void; deleteQuery?: ({ id }: { id: string }) => void; isInitializing: boolean; diff --git a/x-pack/plugins/security_solution/public/common/containers/matrix_histogram/index.test.tsx b/x-pack/plugins/security_solution/public/common/containers/matrix_histogram/index.test.tsx index cb988d7ebf1901e..2bc6678eec81496 100644 --- a/x-pack/plugins/security_solution/public/common/containers/matrix_histogram/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/matrix_histogram/index.test.tsx @@ -61,13 +61,13 @@ describe('useQuery', () => { }); const TestComponent = () => { result = useQuery({ - endDate: 100, + endDate: '100', errorMessage: 'fakeErrorMsg', filterQuery: '', histogramType: HistogramType.alerts, isInspected: false, stackByField: 'fakeField', - startDate: 0, + startDate: '0', }); return
; @@ -123,13 +123,13 @@ describe('useQuery', () => { }); const TestComponent = () => { result = useQuery({ - endDate: 100, + endDate: '100', errorMessage: 'fakeErrorMsg', filterQuery: '', histogramType: HistogramType.alerts, isInspected: false, stackByField: 'fakeField', - startDate: 0, + startDate: '0', }); return
; diff --git a/x-pack/plugins/security_solution/public/common/containers/query_template.tsx b/x-pack/plugins/security_solution/public/common/containers/query_template.tsx index fdc95c1dadfe166..3e78c924ff59c50 100644 --- a/x-pack/plugins/security_solution/public/common/containers/query_template.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/query_template.tsx @@ -12,11 +12,11 @@ import { ESQuery } from '../../../common/typed_json'; export interface QueryTemplateProps { id?: string; - endDate?: number; + endDate?: string; filterQuery?: ESQuery | string; skip?: boolean; sourceId: string; - startDate?: number; + startDate?: string; } // eslint-disable-next-line @typescript-eslint/no-explicit-any export type FetchMoreOptionsArgs = FetchMoreQueryOptions & diff --git a/x-pack/plugins/security_solution/public/common/containers/query_template_paginated.tsx b/x-pack/plugins/security_solution/public/common/containers/query_template_paginated.tsx index 446e1125b2807e9..3abaf11284725e2 100644 --- a/x-pack/plugins/security_solution/public/common/containers/query_template_paginated.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/query_template_paginated.tsx @@ -16,11 +16,11 @@ import { generateTablePaginationOptions } from '../components/paginated_table/he export interface QueryTemplatePaginatedProps { id?: string; - endDate?: number; + endDate?: string; filterQuery?: ESQuery | string; skip?: boolean; sourceId: string; - startDate?: number; + startDate?: string; } // eslint-disable-next-line @typescript-eslint/no-explicit-any type FetchMoreOptionsArgs = FetchMoreQueryOptions & diff --git a/x-pack/plugins/security_solution/public/common/mock/global_state.ts b/x-pack/plugins/security_solution/public/common/mock/global_state.ts index 3d76416855e9e15..f9a7928978d4602 100644 --- a/x-pack/plugins/security_solution/public/common/mock/global_state.ts +++ b/x-pack/plugins/security_solution/public/common/mock/global_state.ts @@ -156,7 +156,7 @@ export const mockGlobalState: State = { }, inputs: { global: { - timerange: { kind: 'relative', fromStr: DEFAULT_FROM, toStr: DEFAULT_TO, from: 0, to: 1 }, + timerange: { kind: 'relative', fromStr: DEFAULT_FROM, toStr: DEFAULT_TO, from: '0', to: '1' }, linkTo: ['timeline'], queries: [], policy: { kind: DEFAULT_INTERVAL_TYPE, duration: DEFAULT_INTERVAL_VALUE }, @@ -167,7 +167,7 @@ export const mockGlobalState: State = { filters: [], }, timeline: { - timerange: { kind: 'relative', fromStr: DEFAULT_FROM, toStr: DEFAULT_TO, from: 0, to: 1 }, + timerange: { kind: 'relative', fromStr: DEFAULT_FROM, toStr: DEFAULT_TO, from: '0', to: '1' }, linkTo: ['global'], queries: [], policy: { kind: DEFAULT_INTERVAL_TYPE, duration: DEFAULT_INTERVAL_VALUE }, diff --git a/x-pack/plugins/security_solution/public/common/store/inputs/actions.ts b/x-pack/plugins/security_solution/public/common/store/inputs/actions.ts index dd5ea63416095e9..efad0638b2971bd 100644 --- a/x-pack/plugins/security_solution/public/common/store/inputs/actions.ts +++ b/x-pack/plugins/security_solution/public/common/store/inputs/actions.ts @@ -19,8 +19,8 @@ export const setAbsoluteRangeDatePicker = actionCreator<{ }>('SET_ABSOLUTE_RANGE_DATE_PICKER'); export const setTimelineRangeDatePicker = actionCreator<{ - from: number; - to: number; + from: string; + to: string; }>('SET_TIMELINE_RANGE_DATE_PICKER'); export const setRelativeRangeDatePicker = actionCreator<{ diff --git a/x-pack/plugins/security_solution/public/common/store/inputs/helpers.test.ts b/x-pack/plugins/security_solution/public/common/store/inputs/helpers.test.ts index d23110b44ad4347..5a868de1436b8ef 100644 --- a/x-pack/plugins/security_solution/public/common/store/inputs/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/common/store/inputs/helpers.test.ts @@ -53,8 +53,8 @@ describe('Inputs', () => { kind: 'relative', fromStr: 'now-48h', toStr: 'now', - from: 23, - to: 26, + from: '23', + to: '26', }; const newState: InputsModel = updateInputTimerange('global', newTimerange, state); expect(newState.timeline.timerange).toEqual(newState.global.timerange); @@ -65,8 +65,8 @@ describe('Inputs', () => { kind: 'relative', fromStr: 'now-68h', toStr: 'NOTnow', - from: 29, - to: 33, + from: '29', + to: '33', }; const newState: InputsModel = updateInputTimerange('timeline', newTimerange, state); expect(newState.timeline.timerange).toEqual(newState.global.timerange); @@ -83,8 +83,8 @@ describe('Inputs', () => { kind: 'relative', fromStr: 'now-48h', toStr: 'now', - from: 23, - to: 26, + from: '23', + to: '26', }; const newState: InputsModel = updateInputTimerange('global', newTimerange, state); expect(newState.timeline.timerange).toEqual(state.timeline.timerange); @@ -96,8 +96,8 @@ describe('Inputs', () => { kind: 'relative', fromStr: 'now-68h', toStr: 'NOTnow', - from: 29, - to: 33, + from: '29', + to: '33', }; const newState: InputsModel = updateInputTimerange('timeline', newTimerange, state); expect(newState.timeline.timerange).toEqual(newTimerange); @@ -274,10 +274,10 @@ describe('Inputs', () => { }, ], timerange: { - from: 0, + from: '0', fromStr: 'now-24h', kind: 'relative', - to: 1, + to: '1', toStr: 'now', }, query: { query: '', language: 'kuery' }, @@ -291,10 +291,10 @@ describe('Inputs', () => { }, queries: [], timerange: { - from: 0, + from: '0', fromStr: 'now-24h', kind: 'relative', - to: 1, + to: '1', toStr: 'now', }, query: { query: '', language: 'kuery' }, diff --git a/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.test.tsx b/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.test.tsx index 09e253ae56747dc..978bdcaa2bb019c 100644 --- a/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.test.tsx +++ b/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.test.tsx @@ -14,8 +14,8 @@ import { kpiHostDetailsMapping } from './kpi_host_details_mapping'; describe('kpiHostsComponent', () => { const ID = 'kpiHost'; - const from = new Date('2019-06-15T06:00:00.000Z').valueOf(); - const to = new Date('2019-06-18T06:00:00.000Z').valueOf(); + const from = '2019-06-15T06:00:00.000Z'; + const to = '2019-06-18T06:00:00.000Z'; const narrowDateRange = () => {}; describe('render', () => { test('it should render spinner if it is loading', () => { diff --git a/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.tsx b/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.tsx index ba70df7d361d452..c39e86591013f93 100644 --- a/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.tsx @@ -21,10 +21,10 @@ import { UpdateDateRange } from '../../../common/components/charts/common'; const kpiWidgetHeight = 247; interface GenericKpiHostProps { - from: number; + from: string; id: string; loading: boolean; - to: number; + to: string; narrowDateRange: UpdateDateRange; } diff --git a/x-pack/plugins/security_solution/public/hosts/containers/hosts/index.tsx b/x-pack/plugins/security_solution/public/hosts/containers/hosts/index.tsx index 70f21b6f23cc0d4..d6a725a30ac7bc9 100644 --- a/x-pack/plugins/security_solution/public/hosts/containers/hosts/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/containers/hosts/index.tsx @@ -33,7 +33,7 @@ import { generateTablePaginationOptions } from '../../../common/components/pagin const ID = 'hostsQuery'; export interface HostsArgs { - endDate: number; + endDate: string; hosts: HostsEdges[]; id: string; inspect: inputsModel.InspectQuery; @@ -42,15 +42,15 @@ export interface HostsArgs { loadPage: (newActivePage: number) => void; pageInfo: PageInfoPaginated; refetch: inputsModel.Refetch; - startDate: number; + startDate: string; totalCount: number; } export interface OwnProps extends QueryTemplatePaginatedProps { children: (args: HostsArgs) => React.ReactNode; type: hostsModel.HostsType; - startDate: number; - endDate: number; + startDate: string; + endDate: string; } export interface HostsComponentReduxProps { diff --git a/x-pack/plugins/security_solution/public/hosts/containers/hosts/overview/index.tsx b/x-pack/plugins/security_solution/public/hosts/containers/hosts/overview/index.tsx index 5267fff3a26d67b..12a82c7980b61b4 100644 --- a/x-pack/plugins/security_solution/public/hosts/containers/hosts/overview/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/containers/hosts/overview/index.tsx @@ -27,8 +27,8 @@ export interface HostOverviewArgs { hostOverview: HostItem; loading: boolean; refetch: inputsModel.Refetch; - startDate: number; - endDate: number; + startDate: string; + endDate: string; } export interface HostOverviewReduxProps { @@ -38,8 +38,8 @@ export interface HostOverviewReduxProps { export interface OwnProps extends QueryTemplateProps { children: (args: HostOverviewArgs) => React.ReactNode; hostName: string; - startDate: number; - endDate: number; + startDate: string; + endDate: string; } type HostsOverViewProps = OwnProps & HostOverviewReduxProps & WithKibanaProps; diff --git a/x-pack/plugins/security_solution/public/hosts/pages/details/details_tabs.test.tsx b/x-pack/plugins/security_solution/public/hosts/pages/details/details_tabs.test.tsx index e520facf285c2b7..3f0c953beefb83e 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/details/details_tabs.test.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/details/details_tabs.test.tsx @@ -67,11 +67,11 @@ describe('body', () => { ( return; } const [min, max] = x; - setAbsoluteRangeDatePicker({ id: 'global', from: min, to: max }); + setAbsoluteRangeDatePicker({ + id: 'global', + from: new Date(min).toISOString(), + to: new Date(max).toISOString(), + }); }, [setAbsoluteRangeDatePicker] ); diff --git a/x-pack/plugins/security_solution/public/hosts/pages/details/index.tsx b/x-pack/plugins/security_solution/public/hosts/pages/details/index.tsx index 1c66a9edc19475a..191c25a68ce06cf 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/details/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/details/index.tsx @@ -76,7 +76,11 @@ const HostDetailsComponent = React.memo( return; } const [min, max] = x; - setAbsoluteRangeDatePicker({ id: 'global', from: min, to: max }); + setAbsoluteRangeDatePicker({ + id: 'global', + from: new Date(min).toISOString(), + to: new Date(max).toISOString(), + }); }, [setAbsoluteRangeDatePicker] ); diff --git a/x-pack/plugins/security_solution/public/hosts/pages/details/types.ts b/x-pack/plugins/security_solution/public/hosts/pages/details/types.ts index aa6288d473c9100..21a9c453c3133f0 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/details/types.ts +++ b/x-pack/plugins/security_solution/public/hosts/pages/details/types.ts @@ -21,8 +21,8 @@ interface HostDetailsComponentReduxProps { interface HostBodyComponentDispatchProps { setAbsoluteRangeDatePicker: ActionCreator<{ id: InputsModelId; - from: number; - to: number; + from: string; + to: string; }>; detailName: string; hostDetailsPagePath: string; @@ -64,6 +64,6 @@ export type HostDetailsTabsProps = HostBodyComponentDispatchProps & export type SetAbsoluteRangeDatePicker = ActionCreator<{ id: InputsModelId; - from: number; - to: number; + from: string; + to: string; }>; diff --git a/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx b/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx index 1ea3a3020a1d5de..b3b62395d7760c4 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx @@ -59,8 +59,8 @@ const mockHistory = { listen: jest.fn(), }; -const to = new Date('2018-03-23T18:49:23.132Z').valueOf(); -const from = new Date('2018-03-24T03:33:52.253Z').valueOf(); +const to = '2018-03-23T18:49:23.132Z'; +const from = '2018-03-24T03:33:52.253Z'; describe('Hosts - rendering', () => { const hostProps: HostsComponentProps = { diff --git a/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx b/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx index f5cc651a30443d0..3e6afc9020b75cd 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx @@ -70,7 +70,11 @@ export const HostsComponent = React.memo( return; } const [min, max] = x; - setAbsoluteRangeDatePicker({ id: 'global', from: min, to: max }); + setAbsoluteRangeDatePicker({ + id: 'global', + from: new Date(min).toISOString(), + to: new Date(max).toISOString(), + }); }, [setAbsoluteRangeDatePicker] ); diff --git a/x-pack/plugins/security_solution/public/hosts/pages/hosts_tabs.tsx b/x-pack/plugins/security_solution/public/hosts/pages/hosts_tabs.tsx index e2a0ba0f1fe6caf..44998b3b799b583 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/hosts_tabs.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/hosts_tabs.tsx @@ -62,7 +62,11 @@ export const HostsTabs = memo( return; } const [min, max] = x; - setAbsoluteRangeDatePicker({ id: 'global', from: min, to: max }); + setAbsoluteRangeDatePicker({ + id: 'global', + from: new Date(min).toISOString(), + to: new Date(max).toISOString(), + }); }, [setAbsoluteRangeDatePicker] ), diff --git a/x-pack/plugins/security_solution/public/hosts/pages/navigation/types.ts b/x-pack/plugins/security_solution/public/hosts/pages/navigation/types.ts index 76f56fe1718aa79..3569b11d81d2d02 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/navigation/types.ts +++ b/x-pack/plugins/security_solution/public/hosts/pages/navigation/types.ts @@ -38,8 +38,8 @@ export type SetQuery = ({ export interface QueryTabBodyProps { type: HostsType; - startDate: number; - endDate: number; + startDate: string; + endDate: string; filterQuery?: string | ESTermQuery; } diff --git a/x-pack/plugins/security_solution/public/hosts/pages/types.ts b/x-pack/plugins/security_solution/public/hosts/pages/types.ts index ffd17b0ef46f6eb..d63cf54d3018794 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/types.ts +++ b/x-pack/plugins/security_solution/public/hosts/pages/types.ts @@ -20,8 +20,8 @@ export type HostsTabsProps = HostsComponentProps & { indexPattern: IIndexPattern; setAbsoluteRangeDatePicker: ActionCreator<{ id: InputsModelId; - from: number; - to: number; + from: string; + to: string; }>; }; diff --git a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map.test.tsx b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map.test.tsx index 33eadad9aa774b2..6a9f3277a8b810a 100644 --- a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map.test.tsx @@ -27,11 +27,11 @@ describe('EmbeddedMapComponent', () => { test('renders correctly against snapshot', () => { const wrapper = shallow( ); expect(wrapper).toMatchSnapshot(); diff --git a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map.tsx b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map.tsx index 6470fc270d0bf46..731e868c0c57a22 100644 --- a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map.tsx +++ b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map.tsx @@ -71,8 +71,8 @@ EmbeddableMap.displayName = 'EmbeddableMap'; export interface EmbeddedMapProps { query: Query; filters: Filter[]; - startDate: number; - endDate: number; + startDate: string; + endDate: string; setQuery: SetQuery; } diff --git a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.test.tsx b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.test.tsx index 50170f4f6ae9e46..e9fedee2e038af4 100644 --- a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.test.tsx @@ -35,8 +35,8 @@ describe('embedded_map_helpers', () => { [], [], { query: '', language: 'kuery' }, - 0, - 0, + '0', + '0', setQueryMock, createPortalNode(), mockEmbeddable @@ -50,8 +50,8 @@ describe('embedded_map_helpers', () => { [], [], { query: '', language: 'kuery' }, - 0, - 0, + '0', + '0', setQueryMock, createPortalNode(), mockEmbeddable diff --git a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.tsx b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.tsx index b0f8e2cc024033d..51624f49fe4f588 100644 --- a/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.tsx +++ b/x-pack/plugins/security_solution/public/network/components/embeddables/embedded_map_helpers.tsx @@ -49,8 +49,8 @@ export const createEmbeddable = async ( filters: Filter[], indexPatterns: IndexPatternMapping[], query: Query, - startDate: number, - endDate: number, + startDate: string, + endDate: string, setQuery: SetQuery, portalNode: PortalNode, embeddableApi: EmbeddableStart diff --git a/x-pack/plugins/security_solution/public/network/components/ip_overview/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/ip_overview/index.test.tsx index b8d97f06bf85f80..b9d9279ae34f81c 100644 --- a/x-pack/plugins/security_solution/public/network/components/ip_overview/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/ip_overview/index.test.tsx @@ -51,14 +51,14 @@ describe('IP Overview Component', () => { const mockProps = { anomaliesData: mockAnomalies, data: mockData.IpOverview, - endDate: new Date('2019-06-18T06:00:00.000Z').valueOf(), + endDate: '2019-06-18T06:00:00.000Z', flowTarget: FlowTarget.source, loading: false, id: 'ipOverview', ip: '10.10.10.10', isLoadingAnomaliesData: false, narrowDateRange: (jest.fn() as unknown) as NarrowDateRange, - startDate: new Date('2019-06-15T06:00:00.000Z').valueOf(), + startDate: '2019-06-15T06:00:00.000Z', type: networkModel.NetworkType.details, updateFlowTargetAction: (jest.fn() as unknown) as ActionCreator<{ flowTarget: FlowTarget; diff --git a/x-pack/plugins/security_solution/public/network/components/ip_overview/index.tsx b/x-pack/plugins/security_solution/public/network/components/ip_overview/index.tsx index 56f6d27dc28ca40..cf08b084d21979e 100644 --- a/x-pack/plugins/security_solution/public/network/components/ip_overview/index.tsx +++ b/x-pack/plugins/security_solution/public/network/components/ip_overview/index.tsx @@ -42,8 +42,8 @@ interface OwnProps { loading: boolean; isLoadingAnomaliesData: boolean; anomaliesData: Anomalies | null; - startDate: number; - endDate: number; + startDate: string; + endDate: string; type: networkModel.NetworkType; narrowDateRange: NarrowDateRange; } diff --git a/x-pack/plugins/security_solution/public/network/components/kpi_network/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/kpi_network/index.test.tsx index 8acd17d2ce76765..06f623e61c28095 100644 --- a/x-pack/plugins/security_solution/public/network/components/kpi_network/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/kpi_network/index.test.tsx @@ -21,8 +21,8 @@ import { mockData } from './mock'; describe('KpiNetwork Component', () => { const state: State = mockGlobalState; - const from = new Date('2019-06-15T06:00:00.000Z').valueOf(); - const to = new Date('2019-06-18T06:00:00.000Z').valueOf(); + const from = '2019-06-15T06:00:00.000Z'; + const to = '2019-06-18T06:00:00.000Z'; const narrowDateRange = jest.fn(); const { storage } = createSecuritySolutionStorageMock(); diff --git a/x-pack/plugins/security_solution/public/network/components/kpi_network/index.tsx b/x-pack/plugins/security_solution/public/network/components/kpi_network/index.tsx index ac7381160515d8f..dd8979bc02a615a 100644 --- a/x-pack/plugins/security_solution/public/network/components/kpi_network/index.tsx +++ b/x-pack/plugins/security_solution/public/network/components/kpi_network/index.tsx @@ -37,10 +37,10 @@ const euiColorVis3 = euiVisColorPalette[3]; interface KpiNetworkProps { data: KpiNetworkData; - from: number; + from: string; id: string; loading: boolean; - to: number; + to: string; narrowDateRange: UpdateDateRange; } @@ -132,8 +132,8 @@ export const KpiNetworkBaseComponent = React.memo<{ fieldsMapping: Readonly; data: KpiNetworkData; id: string; - from: number; - to: number; + from: string; + to: string; narrowDateRange: UpdateDateRange; }>(({ fieldsMapping, data, id, from, to, narrowDateRange }) => { const statItemsProps: StatItemsProps[] = useKpiMatrixStatus( diff --git a/x-pack/plugins/security_solution/public/network/containers/tls/index.tsx b/x-pack/plugins/security_solution/public/network/containers/tls/index.tsx index a50f2a131b75b84..17506f9a01cb926 100644 --- a/x-pack/plugins/security_solution/public/network/containers/tls/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/tls/index.tsx @@ -92,8 +92,8 @@ class TlsComponentQuery extends QueryTemplatePaginated< sourceId, timerange: { interval: '12h', - from: startDate ? startDate : 0, - to: endDate ? endDate : Date.now(), + from: startDate ? startDate : '', + to: endDate ? endDate : new Date(Date.now()).toISOString(), }, }; return ( diff --git a/x-pack/plugins/security_solution/public/network/pages/ip_details/index.test.tsx b/x-pack/plugins/security_solution/public/network/pages/ip_details/index.test.tsx index 962a6269f84882d..b7514622aeffbf8 100644 --- a/x-pack/plugins/security_solution/public/network/pages/ip_details/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/ip_details/index.test.tsx @@ -62,8 +62,8 @@ const getMockHistory = (ip: string) => ({ listen: jest.fn(), }); -const to = new Date('2018-03-23T18:49:23.132Z').valueOf(); -const from = new Date('2018-03-24T03:33:52.253Z').valueOf(); +const to = '2018-03-23T18:49:23.132Z'; +const from = '2018-03-24T03:33:52.253Z'; const getMockProps = (ip: string) => ({ to, from, @@ -83,8 +83,8 @@ const getMockProps = (ip: string) => ({ match: { params: { detailName: ip, search: '' }, isExact: true, path: '', url: '' }, setAbsoluteRangeDatePicker: (jest.fn() as unknown) as ActionCreator<{ id: InputsModelId; - from: number; - to: number; + from: string; + to: string; }>, setIpDetailsTablesActivePageToZero: (jest.fn() as unknown) as ActionCreator, }); diff --git a/x-pack/plugins/security_solution/public/network/pages/ip_details/types.ts b/x-pack/plugins/security_solution/public/network/pages/ip_details/types.ts index 02d83208884b41b..ef62a07e0d2a9c0 100644 --- a/x-pack/plugins/security_solution/public/network/pages/ip_details/types.ts +++ b/x-pack/plugins/security_solution/public/network/pages/ip_details/types.ts @@ -21,8 +21,8 @@ export type IPDetailsComponentProps = GlobalTimeArgs & { export interface OwnProps { type: NetworkType; - startDate: number; - endDate: number; + startDate: string; + endDate: string; filterQuery: string | ESTermQuery; ip: string; skip: boolean; diff --git a/x-pack/plugins/security_solution/public/network/pages/navigation/network_routes.tsx b/x-pack/plugins/security_solution/public/network/pages/navigation/network_routes.tsx index e1e84b3ef4271f4..93582088811dcab 100644 --- a/x-pack/plugins/security_solution/public/network/pages/navigation/network_routes.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/navigation/network_routes.tsx @@ -53,7 +53,11 @@ export const NetworkRoutes = React.memo( return; } const [min, max] = x; - setAbsoluteRangeDatePicker({ id: 'global', from: min, to: max }); + setAbsoluteRangeDatePicker({ + id: 'global', + from: new Date(min).toISOString(), + to: new Date(max).toISOString(), + }); }, [setAbsoluteRangeDatePicker] ); diff --git a/x-pack/plugins/security_solution/public/network/pages/navigation/types.ts b/x-pack/plugins/security_solution/public/network/pages/navigation/types.ts index 433ed7fffd74196..18cc3e902efce2b 100644 --- a/x-pack/plugins/security_solution/public/network/pages/navigation/types.ts +++ b/x-pack/plugins/security_solution/public/network/pages/navigation/types.ts @@ -18,8 +18,8 @@ import { NarrowDateRange } from '../../../common/components/ml/types'; interface QueryTabBodyProps extends Pick { skip: boolean; type: networkModel.NetworkType; - startDate: number; - endDate: number; + startDate: string; + endDate: string; filterQuery?: string | ESTermQuery; narrowDateRange?: NarrowDateRange; } diff --git a/x-pack/plugins/security_solution/public/network/pages/network.test.tsx b/x-pack/plugins/security_solution/public/network/pages/network.test.tsx index af84e1d42b45b9c..78521a980de402c 100644 --- a/x-pack/plugins/security_solution/public/network/pages/network.test.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/network.test.tsx @@ -58,8 +58,8 @@ const mockHistory = { listen: jest.fn(), }; -const to = new Date('2018-03-23T18:49:23.132Z').valueOf(); -const from = new Date('2018-03-24T03:33:52.253Z').valueOf(); +const to = '2018-03-23T18:49:23.132Z'; +const from = '2018-03-24T03:33:52.253Z'; const getMockProps = () => ({ networkPagePath: '', diff --git a/x-pack/plugins/security_solution/public/network/pages/network.tsx b/x-pack/plugins/security_solution/public/network/pages/network.tsx index 4275c1641f5176f..3af031abfbd0334 100644 --- a/x-pack/plugins/security_solution/public/network/pages/network.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/network.tsx @@ -70,7 +70,11 @@ const NetworkComponent = React.memo( return; } const [min, max] = x; - setAbsoluteRangeDatePicker({ id: 'global', from: min, to: max }); + setAbsoluteRangeDatePicker({ + id: 'global', + from: new Date(min).toISOString(), + to: new Date(max).toISOString(), + }); }, [setAbsoluteRangeDatePicker] ); diff --git a/x-pack/plugins/security_solution/public/network/pages/types.ts b/x-pack/plugins/security_solution/public/network/pages/types.ts index e4170ee4b908b24..dd0e1120bd513ef 100644 --- a/x-pack/plugins/security_solution/public/network/pages/types.ts +++ b/x-pack/plugins/security_solution/public/network/pages/types.ts @@ -11,8 +11,8 @@ import { GlobalTimeArgs } from '../../common/containers/global_time'; export type SetAbsoluteRangeDatePicker = ActionCreator<{ id: InputsModelId; - from: number; - to: number; + from: string; + to: string; }>; export type NetworkComponentProps = Partial> & diff --git a/x-pack/plugins/security_solution/public/overview/components/alerts_by_category/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/alerts_by_category/index.test.tsx index 1aa114608b479c7..be1df8d5bfebbd0 100644 --- a/x-pack/plugins/security_solution/public/overview/components/alerts_by_category/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/alerts_by_category/index.test.tsx @@ -26,8 +26,8 @@ jest.mock('../../../common/containers/matrix_histogram', () => { }); const theme = () => ({ eui: { ...euiDarkVars, euiSizeL: '24px' }, darkMode: true }); -const from = new Date('2020-03-31T06:00:00.000Z').valueOf(); -const to = new Date('2019-03-31T06:00:00.000Z').valueOf(); +const from = '2020-03-31T06:00:00.000Z'; +const to = '2019-03-31T06:00:00.000Z'; describe('Alerts by category', () => { let wrapper: ReactWrapper; diff --git a/x-pack/plugins/security_solution/public/overview/components/alerts_by_category/index.tsx b/x-pack/plugins/security_solution/public/overview/components/alerts_by_category/index.tsx index 03e8279f01db70f..bfc1dccfee01d20 100644 --- a/x-pack/plugins/security_solution/public/overview/components/alerts_by_category/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/alerts_by_category/index.tsx @@ -42,7 +42,7 @@ const DEFAULT_STACK_BY = 'event.module'; interface Props { deleteQuery?: ({ id }: { id: string }) => void; filters?: Filter[]; - from: number; + from: string; hideHeaderChildren?: boolean; indexPattern: IIndexPattern; query?: Query; @@ -52,7 +52,7 @@ interface Props { loading: boolean; refetch: inputsModel.Refetch; }) => void; - to: number; + to: string; } const AlertsByCategoryComponent: React.FC = ({ diff --git a/x-pack/plugins/security_solution/public/overview/components/event_counts/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/event_counts/index.test.tsx index 95dd65f559470d8..c4a941d845f1673 100644 --- a/x-pack/plugins/security_solution/public/overview/components/event_counts/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/event_counts/index.test.tsx @@ -16,8 +16,8 @@ import { EventCounts } from '.'; jest.mock('../../../common/components/link_to'); describe('EventCounts', () => { - const from = 1579553397080; - const to = 1579639797080; + const from = '2020-01-20T20:49:57.080Z'; + const to = '2020-01-21T20:49:57.080Z'; test('it filters the `Host events` widget with a `host.name` `exists` filter', () => { const wrapper = mount( diff --git a/x-pack/plugins/security_solution/public/overview/components/event_counts/index.tsx b/x-pack/plugins/security_solution/public/overview/components/event_counts/index.tsx index 1773af86a382f64..45862da5405b729 100644 --- a/x-pack/plugins/security_solution/public/overview/components/event_counts/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/event_counts/index.tsx @@ -31,7 +31,7 @@ const DEFAULT_QUERY: Query = { query: '', language: 'kuery' }; interface Props { filters?: Filter[]; - from: number; + from: string; indexPattern: IIndexPattern; query?: Query; setQuery: (params: { @@ -40,7 +40,7 @@ interface Props { loading: boolean; refetch: inputsModel.Refetch; }) => void; - to: number; + to: string; } const EventCountsComponent: React.FC = ({ diff --git a/x-pack/plugins/security_solution/public/overview/components/events_by_dataset/index.tsx b/x-pack/plugins/security_solution/public/overview/components/events_by_dataset/index.tsx index fe3f9f8ecda332e..3693d54e2f121cd 100644 --- a/x-pack/plugins/security_solution/public/overview/components/events_by_dataset/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/events_by_dataset/index.tsx @@ -46,7 +46,7 @@ interface Props { combinedQueries?: string; deleteQuery?: ({ id }: { id: string }) => void; filters?: Filter[]; - from: number; + from: string; headerChildren?: React.ReactNode; indexPattern: IIndexPattern; indexToAdd?: string[] | null; @@ -60,7 +60,7 @@ interface Props { refetch: inputsModel.Refetch; }) => void; showSpacer?: boolean; - to: number; + to: string; } const getHistogramOption = (fieldName: string): MatrixHistogramOption => ({ diff --git a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.test.tsx index 56c232158ac02cf..05f92e856d069e6 100644 --- a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.test.tsx @@ -20,12 +20,12 @@ describe('Host Summary Component', () => { ); diff --git a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx index c1004f772a0eeed..016940477b559c2 100644 --- a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx @@ -40,8 +40,8 @@ interface HostSummaryProps { loading: boolean; isLoadingAnomaliesData: boolean; anomaliesData: Anomalies | null; - startDate: number; - endDate: number; + startDate: string; + endDate: string; narrowDateRange: NarrowDateRange; } diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_host/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_host/index.test.tsx index 2b21385004a7398..7fa3ea430ffcb11 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_host/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_host/index.test.tsx @@ -28,8 +28,8 @@ import { wait } from '../../../common/lib/helpers'; jest.mock('../../../common/lib/kibana'); jest.mock('../../../common/components/link_to'); -const startDate = 1579553397080; -const endDate = 1579639797080; +const startDate = '2020-01-20T20:49:57.080Z'; +const endDate = '2020-01-21T20:49:57.080Z'; interface MockedProvidedQuery { request: { diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_host/index.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_host/index.tsx index 195bb4fa0807a06..6596dcb9a1eb736 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_host/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_host/index.tsx @@ -24,8 +24,8 @@ import { SecurityPageName } from '../../../app/types'; import { LinkButton } from '../../../common/components/links'; export interface OwnProps { - startDate: number; - endDate: number; + startDate: string; + endDate: string; filterQuery?: ESQuery | string; setQuery: ({ id, diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_network/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_network/index.test.tsx index 42c80b6b115bd45..92abd3081ad767f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_network/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_network/index.test.tsx @@ -43,8 +43,8 @@ jest.mock('../../../common/lib/kibana', () => { }; }); -const startDate = 1579553397080; -const endDate = 1579639797080; +const startDate = '2020-01-20T20:49:57.080Z'; +const endDate = '2020-01-21T20:49:57.080Z'; interface MockedProvidedQuery { request: { diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_network/index.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_network/index.tsx index a3760863bcb626d..dc3d05168ff8e78 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_network/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_network/index.tsx @@ -27,8 +27,8 @@ import { SecurityPageName } from '../../../app/types'; import { LinkButton } from '../../../common/components/links'; export interface OverviewNetworkProps { - startDate: number; - endDate: number; + startDate: string; + endDate: string; filterQuery?: ESQuery | string; setQuery: ({ id, diff --git a/x-pack/plugins/security_solution/public/overview/components/signals_by_category/index.tsx b/x-pack/plugins/security_solution/public/overview/components/signals_by_category/index.tsx index 5010fd9c06eb763..5ff43c8569b17c8 100644 --- a/x-pack/plugins/security_solution/public/overview/components/signals_by_category/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/signals_by_category/index.tsx @@ -23,7 +23,7 @@ const NO_FILTERS: Filter[] = []; interface Props { deleteQuery?: ({ id }: { id: string }) => void; filters?: Filter[]; - from: number; + from: string; headerChildren?: React.ReactNode; indexPattern: IIndexPattern; /** Override all defaults, and only display this field */ @@ -37,7 +37,7 @@ interface Props { loading: boolean; refetch: inputsModel.Refetch; }) => void; - to: number; + to: string; } const SignalsByCategoryComponent: React.FC = ({ @@ -59,7 +59,11 @@ const SignalsByCategoryComponent: React.FC = ({ return; } const [min, max] = x; - setAbsoluteRangeDatePicker({ id: setAbsoluteRangeDatePickerTarget, from: min, to: max }); + setAbsoluteRangeDatePicker({ + id: setAbsoluteRangeDatePickerTarget, + from: new Date(min).toISOString(), + to: new Date(max).toISOString(), + }); }, // eslint-disable-next-line react-hooks/exhaustive-deps [setAbsoluteRangeDatePicker] diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_host/index.tsx b/x-pack/plugins/security_solution/public/overview/containers/overview_host/index.tsx index 89761e104d70f24..76ea1f3b4af7565 100644 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_host/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_host/index.tsx @@ -32,8 +32,8 @@ export interface OverviewHostArgs { export interface OverviewHostProps extends QueryTemplateProps { children: (args: OverviewHostArgs) => React.ReactNode; sourceId: string; - endDate: number; - startDate: number; + endDate: string; + startDate: string; } const OverviewHostComponentQuery = React.memo( diff --git a/x-pack/plugins/security_solution/public/overview/containers/overview_network/index.tsx b/x-pack/plugins/security_solution/public/overview/containers/overview_network/index.tsx index 86242adf3f47fa0..38c035f6883b69f 100644 --- a/x-pack/plugins/security_solution/public/overview/containers/overview_network/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/containers/overview_network/index.tsx @@ -32,8 +32,8 @@ export interface OverviewNetworkArgs { export interface OverviewNetworkProps extends QueryTemplateProps { children: (args: OverviewNetworkArgs) => React.ReactNode; sourceId: string; - endDate: number; - startDate: number; + endDate: string; + startDate: string; } export const OverviewNetworkComponentQuery = React.memo( diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts index 31ac3240afb72a5..dbfbb360a66768d 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts @@ -757,15 +757,15 @@ describe('helpers', () => { timelineDispatch({ duplicate: true, id: 'timeline-1', - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', notes: [], timeline: mockTimelineModel, })(); expect(dispatchSetTimelineRangeDatePicker).toHaveBeenCalledWith({ - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', }); }); @@ -773,8 +773,8 @@ describe('helpers', () => { timelineDispatch({ duplicate: true, id: 'timeline-1', - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', notes: [], timeline: mockTimelineModel, })(); @@ -789,8 +789,8 @@ describe('helpers', () => { timelineDispatch({ duplicate: true, id: 'timeline-1', - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', notes: [], timeline: mockTimelineModel, })(); @@ -803,8 +803,8 @@ describe('helpers', () => { timelineDispatch({ duplicate: true, id: 'timeline-1', - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', notes: [], timeline: mockTimelineModel, })(); @@ -826,8 +826,8 @@ describe('helpers', () => { timelineDispatch({ duplicate: true, id: 'timeline-1', - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', notes: [], timeline: mockTimeline, })(); @@ -850,8 +850,8 @@ describe('helpers', () => { timelineDispatch({ duplicate: true, id: 'timeline-1', - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', notes: [], timeline: mockTimeline, })(); @@ -879,8 +879,8 @@ describe('helpers', () => { timelineDispatch({ duplicate: false, id: 'timeline-1', - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', notes: [ { created: 1585233356356, @@ -913,8 +913,8 @@ describe('helpers', () => { timelineDispatch({ duplicate: true, id: 'timeline-1', - from: 1585233356356, - to: 1585233716356, + from: '2020-03-26T14:35:56.356Z', + to: '2020-03-26T14:41:56.356Z', notes: [], timeline: mockTimelineModel, ruleNote: '# this would be some markdown', diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts index 8811d5452e0396e..497506467dba99f 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts @@ -185,10 +185,10 @@ export interface OpenTimelineProps { export interface UpdateTimeline { duplicate: boolean; id: string; - from: number; + from: string; notes: NoteResult[] | null | undefined; timeline: TimelineModel; - to: number; + to: string; ruleNote?: string; } diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.test.tsx index 1038ac4b6958728..84c55182915235b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.test.tsx @@ -13,8 +13,8 @@ import { mockBrowserFields } from '../../../common/containers/source/mock'; import { EsQueryConfig, Filter, esFilters } from '../../../../../../../src/plugins/data/public'; const cleanUpKqlQuery = (str: string) => str.replace(/\n/g, '').replace(/\s\s+/g, ' '); -const startDate = new Date('2018-03-23T18:49:23.132Z').valueOf(); -const endDate = new Date('2018-03-24T03:33:52.253Z').valueOf(); +const startDate = '2018-03-23T18:49:23.132Z'; +const endDate = '2018-03-24T03:33:52.253Z'; describe('Build KQL Query', () => { test('Build KQL query with one data provider', () => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx index 897188319435a54..97e1829a2738e89 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/helpers.tsx @@ -107,8 +107,8 @@ export const combineQueries = ({ filters: Filter[]; kqlQuery: Query; kqlMode: string; - start: number; - end: number; + start: string; + end: string; isEventViewer?: boolean; }): { filterQuery: string } | null => { const kuery: Query = { query: '', language: kqlQuery.language }; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/index.test.tsx index 296b24cff43adb7..fc18bccea6e9c60 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/index.test.tsx @@ -56,8 +56,8 @@ describe('StatefulTimeline', () => { columnId: '@timestamp', sortDirection: Direction.desc, }; - const startDate = new Date('2018-03-23T18:49:23.132Z').valueOf(); - const endDate = new Date('2018-03-24T03:33:52.253Z').valueOf(); + const startDate = '2018-03-23T18:49:23.132Z'; + const endDate = '2018-03-24T03:33:52.253Z'; const mocks = [ { request: { query: timelineQuery }, result: { data: { events: mockTimelineData } } }, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.test.tsx index 546f06b60cb56a3..08aa3147578e891 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.test.tsx @@ -65,9 +65,9 @@ describe('Timeline QueryBar ', () => { filterManager={new FilterManager(mockUiSettingsForFilterManager)} filterQuery={{ expression: 'here: query', kind: 'kuery' }} filterQueryDraft={{ expression: 'here: query', kind: 'kuery' }} - from={0} + from={'0'} fromStr={DEFAULT_FROM} - to={1} + to={'1'} toStr={DEFAULT_TO} kqlMode="search" indexPattern={mockIndexPattern} @@ -107,9 +107,9 @@ describe('Timeline QueryBar ', () => { filterManager={new FilterManager(mockUiSettingsForFilterManager)} filterQuery={{ expression: 'here: query', kind: 'kuery' }} filterQueryDraft={{ expression: 'here: query', kind: 'kuery' }} - from={0} + from={'0'} fromStr={DEFAULT_FROM} - to={1} + to={'1'} toStr={DEFAULT_TO} kqlMode="search" indexPattern={mockIndexPattern} @@ -154,9 +154,9 @@ describe('Timeline QueryBar ', () => { filterManager={new FilterManager(mockUiSettingsForFilterManager)} filterQuery={{ expression: 'here: query', kind: 'kuery' }} filterQueryDraft={{ expression: 'here: query', kind: 'kuery' }} - from={0} + from={'0'} fromStr={DEFAULT_FROM} - to={1} + to={'1'} toStr={DEFAULT_TO} kqlMode="search" indexPattern={mockIndexPattern} @@ -199,9 +199,9 @@ describe('Timeline QueryBar ', () => { filterManager={new FilterManager(mockUiSettingsForFilterManager)} filterQuery={{ expression: 'here: query', kind: 'kuery' }} filterQueryDraft={{ expression: 'here: query', kind: 'kuery' }} - from={0} + from={'0'} fromStr={DEFAULT_FROM} - to={1} + to={'1'} toStr={DEFAULT_TO} kqlMode="search" indexPattern={mockIndexPattern} @@ -246,9 +246,9 @@ describe('Timeline QueryBar ', () => { filterManager={new FilterManager(mockUiSettingsForFilterManager)} filterQuery={{ expression: 'here: query', kind: 'kuery' }} filterQueryDraft={{ expression: 'here: query', kind: 'kuery' }} - from={0} + from={'0'} fromStr={DEFAULT_FROM} - to={1} + to={'1'} toStr={DEFAULT_TO} kqlMode="search" indexPattern={mockIndexPattern} @@ -291,9 +291,9 @@ describe('Timeline QueryBar ', () => { filterManager={new FilterManager(mockUiSettingsForFilterManager)} filterQuery={{ expression: 'here: query', kind: 'kuery' }} filterQueryDraft={{ expression: 'here: query', kind: 'kuery' }} - from={0} + from={'0'} fromStr={DEFAULT_FROM} - to={1} + to={'1'} toStr={DEFAULT_TO} kqlMode="search" indexPattern={mockIndexPattern} diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx index 967c5818a872252..74f21fecd0fdabf 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx @@ -37,7 +37,7 @@ export interface QueryBarTimelineComponentProps { filterManager: FilterManager; filterQuery: KueryFilterQuery; filterQueryDraft: KueryFilterQuery; - from: number; + from: string; fromStr: string; kqlMode: KqlMode; indexPattern: IIndexPattern; @@ -48,7 +48,7 @@ export interface QueryBarTimelineComponentProps { setKqlFilterQueryDraft: (expression: string, kind: KueryFilterQueryKind) => void; setSavedQueryId: (savedQueryId: string | null) => void; timelineId: string; - to: number; + to: string; toStr: string; updateReduxTime: DispatchUpdateReduxTime; } diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx index 388085d1361f37b..80918d732b3ce74 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx @@ -51,7 +51,7 @@ interface Props { filterManager: FilterManager; filterQuery: KueryFilterQuery; filterQueryDraft: KueryFilterQuery; - from: number; + from: string; fromStr: string; indexPattern: IIndexPattern; isRefreshPaused: boolean; @@ -64,7 +64,7 @@ interface Props { setSavedQueryId: (savedQueryId: string | null) => void; filters: Filter[]; savedQueryId: string | null; - to: number; + to: string; toStr: string; updateEventType: (eventType: EventType) => void; updateReduxTime: DispatchUpdateReduxTime; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.test.tsx index b58505546c34173..0298d3c3ebd0a22 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.test.tsx @@ -59,8 +59,8 @@ describe('Timeline', () => { columnId: '@timestamp', sortDirection: Direction.desc, }; - const startDate = new Date('2018-03-23T18:49:23.132Z').valueOf(); - const endDate = new Date('2018-03-24T03:33:52.253Z').valueOf(); + const startDate = '2018-03-23T18:49:23.132Z'; + const endDate = '2018-03-24T03:33:52.253Z'; const indexPattern = mockIndexPattern; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx index 07d4b004d2eda70..e76e70f20ed4ddb 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/timeline.tsx @@ -88,7 +88,7 @@ export interface Props { browserFields: BrowserFields; columns: ColumnHeaderOptions[]; dataProviders: DataProvider[]; - end: number; + end: string; eventType?: EventType; filters: Filter[]; graphEventId?: string; @@ -109,7 +109,7 @@ export interface Props { onToggleDataProviderExcluded: OnToggleDataProviderExcluded; show: boolean; showCallOutUnauthorizedMsg: boolean; - start: number; + start: string; sort: Sort; status: TimelineStatusLiteral; toggleColumn: (column: ColumnHeaderOptions) => void; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts index f8d0d1cf5474ae6..2c654329323ee6e 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts @@ -158,9 +158,9 @@ describe('Epic Timeline', () => { expect( convertTimelineAsInput(timelineModel, { kind: 'absolute', - from: 1572469587644, + from: '2019-10-30T21:06:27.644Z', fromStr: undefined, - to: 1572555987644, + to: '2019-10-31T21:06:27.644Z', toStr: undefined, }) ).toEqual({ @@ -228,8 +228,8 @@ describe('Epic Timeline', () => { }, ], dateRange: { - end: 1572555987644, - start: 1572469587644, + end: '2019-10-31T21:06:27.644Z', + start: '2019-10-30T21:06:27.644Z', }, description: '', eventType: 'all', diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx index 388869194085c8c..0df88f069c16320 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx @@ -65,8 +65,8 @@ describe('epicLocalStorage', () => { columnId: '@timestamp', sortDirection: Direction.desc, }; - const startDate = new Date('2018-03-23T18:49:23.132Z').valueOf(); - const endDate = new Date('2018-03-24T03:33:52.253Z').valueOf(); + const startDate = '2018-03-23T18:49:23.132Z'; + const endDate = '2018-03-24T03:33:52.253Z'; const indexPattern = mockIndexPattern; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts index 33770aacde6bba0..ac6c32da1431e6c 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts @@ -747,8 +747,8 @@ export const updateTimelineProviders = ({ interface UpdateTimelineRangeParams { id: string; - start: number; - end: number; + start: string; + end: string; timelineById: TimelineById; } diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts index 57895fea8f8ff87..ed2cee352d6f5ea 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts @@ -98,8 +98,8 @@ export interface TimelineModel { pinnedEventsSaveObject: Record; /** Specifies the granularity of the date range (e.g. 1 Day / Week / Month) applicable to the mini-map */ dateRange: { - start: number; - end: number; + start: string; + end: string; }; savedQueryId?: string | null; /** Events selected on this timeline -- eventId to TimelineNonEcsData[] mapping of data required for batch actions **/ diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts index 6e7a36079a0c34a..222737022ec450a 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts @@ -89,8 +89,8 @@ const timelineByIdMock: TimelineById = { pinnedEventIds: {}, pinnedEventsSaveObject: {}, dateRange: { - start: 0, - end: 0, + start: '0', + end: '0', }, selectedEventIds: {}, show: true, @@ -999,8 +999,8 @@ describe('Timeline', () => { test('should return a new reference and not the same reference', () => { const update = updateTimelineRange({ id: 'foo', - start: 23, - end: 33, + start: '23', + end: '33', timelineById: timelineByIdMock, }); expect(update).not.toBe(timelineByIdMock); @@ -1009,16 +1009,16 @@ describe('Timeline', () => { test('should update the timeline range', () => { const update = updateTimelineRange({ id: 'foo', - start: 23, - end: 33, + start: '23', + end: '33', timelineById: timelineByIdMock, }); expect(update).toEqual( set( 'foo.dateRange', { - start: 23, - end: 33, + start: '23', + end: '33', }, timelineByIdMock ) @@ -1124,8 +1124,8 @@ describe('Timeline', () => { templateTimelineId: null, noteIds: [], dateRange: { - start: 0, - end: 0, + start: '0', + end: '0', }, selectedEventIds: {}, show: true, @@ -1220,8 +1220,8 @@ describe('Timeline', () => { templateTimelineId: null, noteIds: [], dateRange: { - start: 0, - end: 0, + start: '0', + end: '0', }, selectedEventIds: {}, show: true, @@ -1426,8 +1426,8 @@ describe('Timeline', () => { templateTimelineId: null, noteIds: [], dateRange: { - start: 0, - end: 0, + start: '0', + end: '0', }, selectedEventIds: {}, show: true, @@ -1522,8 +1522,8 @@ describe('Timeline', () => { templateTimelineVersion: null, noteIds: [], dateRange: { - start: 0, - end: 0, + start: '0', + end: '0', }, selectedEventIds: {}, show: true, @@ -1717,8 +1717,8 @@ describe('Timeline', () => { templateTimelineId: null, noteIds: [], dateRange: { - start: 0, - end: 0, + start: '0', + end: '0', }, selectedEventIds: {}, show: true, @@ -1798,8 +1798,8 @@ describe('Timeline', () => { templateTimelineId: null, noteIds: [], dateRange: { - start: 0, - end: 0, + start: '0', + end: '0', }, selectedEventIds: {}, show: true, @@ -1901,8 +1901,8 @@ describe('Timeline', () => { templateTimelineId: null, noteIds: [], dateRange: { - start: 0, - end: 0, + start: '0', + end: '0', }, selectedEventIds: {}, show: true, diff --git a/x-pack/plugins/security_solution/server/lib/events/types.ts b/x-pack/plugins/security_solution/server/lib/events/types.ts index 94dad13f6280525..e90593318f3040b 100644 --- a/x-pack/plugins/security_solution/server/lib/events/types.ts +++ b/x-pack/plugins/security_solution/server/lib/events/types.ts @@ -66,8 +66,8 @@ export interface LastEventTimeRequestOptions { export interface TimerangeFilter { range: { [timestamp: string]: { - gte: number; - lte: number; + gte: string; + lte: string; format: string; }; }; diff --git a/x-pack/plugins/security_solution/server/lib/hosts/mock.ts b/x-pack/plugins/security_solution/server/lib/hosts/mock.ts index 30082990b55f961..f0429d9a8b5e64a 100644 --- a/x-pack/plugins/security_solution/server/lib/hosts/mock.ts +++ b/x-pack/plugins/security_solution/server/lib/hosts/mock.ts @@ -24,7 +24,7 @@ export const mockGetHostsOptions: HostsRequestOptions = { timestamp: '@timestamp', }, }, - timerange: { interval: '12h', to: 1554824274610, from: 1554737874610 }, + timerange: { interval: '12h', to: '2019-04-09T15:37:54.610Z', from: '2019-04-08T15:37:54.610Z' }, sort: { field: HostsFields.lastSeen, direction: Direction.asc }, pagination: { activePage: 0, @@ -295,7 +295,7 @@ export const mockGetHostOverviewOptions: HostOverviewRequestOptions = { timestamp: '@timestamp', }, }, - timerange: { interval: '12h', to: 1554824274610, from: 1554737874610 }, + timerange: { interval: '12h', to: '2019-04-09T15:37:54.610Z', from: '2019-04-08T15:37:54.610Z' }, defaultIndex: DEFAULT_INDEX_PATTERN, fields: [ '_id', diff --git a/x-pack/plugins/security_solution/server/lib/kpi_hosts/mock.ts b/x-pack/plugins/security_solution/server/lib/kpi_hosts/mock.ts index a5affea2842a6c9..876d2f9c16bed68 100644 --- a/x-pack/plugins/security_solution/server/lib/kpi_hosts/mock.ts +++ b/x-pack/plugins/security_solution/server/lib/kpi_hosts/mock.ts @@ -7,8 +7,8 @@ import { DEFAULT_INDEX_PATTERN } from '../../../common/constants'; import { RequestBasicOptions } from '../framework/types'; -const FROM = new Date('2019-05-03T13:24:00.660Z').valueOf(); -const TO = new Date('2019-05-04T13:24:00.660Z').valueOf(); +const FROM = '2019-05-03T13:24:00.660Z'; +const TO = '2019-05-04T13:24:00.660Z'; export const mockKpiHostsOptions: RequestBasicOptions = { defaultIndex: DEFAULT_INDEX_PATTERN, diff --git a/x-pack/plugins/security_solution/server/lib/kpi_network/mock.ts b/x-pack/plugins/security_solution/server/lib/kpi_network/mock.ts index cc0849ccdf1d246..fc9b64ae0746f23 100644 --- a/x-pack/plugins/security_solution/server/lib/kpi_network/mock.ts +++ b/x-pack/plugins/security_solution/server/lib/kpi_network/mock.ts @@ -19,7 +19,7 @@ export const mockOptions: RequestBasicOptions = { timestamp: '@timestamp', }, }, - timerange: { interval: '12h', to: 1549852006071, from: 1549765606071 }, + timerange: { interval: '12h', to: '2019-02-11T02:26:46.071Z', from: '2019-02-10T02:26:46.071Z' }, filterQuery: {}, }; @@ -28,7 +28,11 @@ export const mockRequest = { operationName: 'GetKpiNetworkQuery', variables: { sourceId: 'default', - timerange: { interval: '12h', from: 1557445721842, to: 1557532121842 }, + timerange: { + interval: '12h', + from: '2019-05-09T23:48:41.842Z', + to: '2019-05-10T23:48:41.842Z', + }, filterQuery: '', }, query: diff --git a/x-pack/plugins/security_solution/server/lib/network/mock.ts b/x-pack/plugins/security_solution/server/lib/network/mock.ts index 38e82a4f19dca9b..b421f7af566039c 100644 --- a/x-pack/plugins/security_solution/server/lib/network/mock.ts +++ b/x-pack/plugins/security_solution/server/lib/network/mock.ts @@ -21,7 +21,7 @@ export const mockOptions: NetworkTopNFlowRequestOptions = { timestamp: '@timestamp', }, }, - timerange: { interval: '12h', to: 1549852006071, from: 1549765606071 }, + timerange: { interval: '12h', to: '2019-02-11T02:26:46.071Z', from: '2019-02-11T02:26:46.071Z' }, pagination: { activePage: 0, cursorStart: 0, diff --git a/x-pack/plugins/security_solution/server/lib/overview/mock.ts b/x-pack/plugins/security_solution/server/lib/overview/mock.ts index 51d8a258569a8ba..2621c795ecd6b8a 100644 --- a/x-pack/plugins/security_solution/server/lib/overview/mock.ts +++ b/x-pack/plugins/security_solution/server/lib/overview/mock.ts @@ -19,7 +19,7 @@ export const mockOptionsNetwork: RequestBasicOptions = { timestamp: '@timestamp', }, }, - timerange: { interval: '12h', to: 1549852006071, from: 1549765606071 }, + timerange: { interval: '12h', to: '2019-02-11T02:26:46.071Z', from: '2019-02-10T02:26:46.071Z' }, filterQuery: {}, }; @@ -28,7 +28,11 @@ export const mockRequestNetwork = { operationName: 'GetOverviewNetworkQuery', variables: { sourceId: 'default', - timerange: { interval: '12h', from: 1549765830772, to: 1549852230772 }, + timerange: { + interval: '12h', + from: '2019-02-10T02:30:30.772Z', + to: '2019-02-11T02:30:30.772Z', + }, filterQuery: '', }, query: @@ -90,7 +94,7 @@ export const mockOptionsHost: RequestBasicOptions = { timestamp: '@timestamp', }, }, - timerange: { interval: '12h', to: 1549852006071, from: 1549765606071 }, + timerange: { interval: '12h', to: '2019-02-11T02:26:46.071Z', from: '2019-02-10T02:26:46.071Z' }, filterQuery: {}, }; @@ -99,7 +103,11 @@ export const mockRequestHost = { operationName: 'GetOverviewHostQuery', variables: { sourceId: 'default', - timerange: { interval: '12h', from: 1549765830772, to: 1549852230772 }, + timerange: { + interval: '12h', + from: '2019-02-10T02:30:30.772Z', + to: '2019-02-11T02:30:30.772Z', + }, filterQuery: '', }, query: diff --git a/x-pack/plugins/security_solution/server/lib/tls/mock.ts b/x-pack/plugins/security_solution/server/lib/tls/mock.ts index b97a6fa509ef287..62d5e1e61570a75 100644 --- a/x-pack/plugins/security_solution/server/lib/tls/mock.ts +++ b/x-pack/plugins/security_solution/server/lib/tls/mock.ts @@ -458,7 +458,7 @@ export const mockOptions = { timestamp: '@timestamp', }, }, - timerange: { interval: '12h', to: 1570801871626, from: 1570715471626 }, + timerange: { interval: '12h', to: '2019-10-11T13:51:11.626Z', from: '2019-10-10T13:51:11.626Z' }, pagination: { activePage: 0, cursorStart: 0, fakePossibleCount: 50, querySize: 10 }, filterQuery: {}, fields: [ diff --git a/x-pack/plugins/security_solution/server/utils/build_query/calculate_timeseries_interval.ts b/x-pack/plugins/security_solution/server/utils/build_query/calculate_timeseries_interval.ts index 562628adad678de..2ddab92abf4244b 100644 --- a/x-pack/plugins/security_solution/server/utils/build_query/calculate_timeseries_interval.ts +++ b/x-pack/plugins/security_solution/server/utils/build_query/calculate_timeseries_interval.ts @@ -8,7 +8,7 @@ ** x-pack/plugins/apm/server/lib/helpers/get_bucket_size/calculate_auto.js */ import moment from 'moment'; -import { get, toNumber, isNaN } from 'lodash/fp'; +import { get } from 'lodash/fp'; const d = moment.duration; const roundingRules = [ diff --git a/x-pack/plugins/security_solution/server/utils/build_query/create_options.test.ts b/x-pack/plugins/security_solution/server/utils/build_query/create_options.test.ts index 5ca67ad6ae51f76..f97f845af84d6d5 100644 --- a/x-pack/plugins/security_solution/server/utils/build_query/create_options.test.ts +++ b/x-pack/plugins/security_solution/server/utils/build_query/create_options.test.ts @@ -35,8 +35,8 @@ describe('createOptions', () => { limit: 5, }, timerange: { - from: 10, - to: 0, + from: '10', + to: '0', interval: '12 hours ago', }, sortField: { sortFieldId: 'sort-1', direction: Direction.asc }, @@ -75,8 +75,8 @@ describe('createOptions', () => { filterQuery: {}, fields: [], timerange: { - from: 10, - to: 0, + from: '10', + to: '0', interval: '12 hours ago', }, }; @@ -104,8 +104,8 @@ describe('createOptions', () => { filterQuery: {}, fields: [], timerange: { - from: 10, - to: 0, + from: '10', + to: '0', interval: '12 hours ago', }, };