Skip to content

Commit

Permalink
Merge branch 'main' of github.com:elastic/kibana into rule-execution-…
Browse files Browse the repository at this point in the history
…context
  • Loading branch information
dgieselaar committed Nov 8, 2021
2 parents ed7a004 + d13ee69 commit ba9995e
Show file tree
Hide file tree
Showing 363 changed files with 834 additions and 788 deletions.
2 changes: 1 addition & 1 deletion src/plugins/discover/public/__mocks__/saved_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { SavedSearch } from '../saved_searches';
import { SavedSearch } from '../services/saved_searches';
import { createSearchSourceMock } from '../../../data/public/mocks';
import { indexPatternMock } from './index_pattern';
import { indexPatternWithTimefieldMock } from './index_pattern_with_timefield';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/discover/public/__mocks__/search_session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { createMemoryHistory } from 'history';
import { dataPluginMock } from '../../../data/public/mocks';
import { DataPublicPluginStart } from '../../../data/public';
import { DiscoverSearchSessionManager } from '../application/apps/main/services/discover_search_session';
import { DiscoverSearchSessionManager } from '../application/main/services/discover_search_session';

export function createSearchSessionMock() {
const history = createMemoryHistory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from 'react';
import { mountWithIntl } from '@kbn/test/jest';
import { ActionBar, ActionBarProps } from './action_bar';
import { findTestSubject } from '@elastic/eui/lib/test';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../utils/constants';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../services/constants';
import { SurrDocType } from '../../services/context';

describe('Test Discover Context ActionBar for successor | predecessor records', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@elastic/eui';
import { ActionBarWarning } from './action_bar_warning';
import { SurrDocType } from '../../services/context';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../utils/constants';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../services/constants';

export interface ActionBarProps {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
import React from 'react';
import { waitFor } from '@testing-library/react';
import { mountWithIntl } from '@kbn/test/jest';
import { createFilterManagerMock } from '../../../../../data/public/query/filter_manager/filter_manager.mock';
import { createFilterManagerMock } from '../../../../data/public/query/filter_manager/filter_manager.mock';
import { mockTopNavMenu } from './__mocks__/top_nav_menu';
import { ContextAppContent } from './context_app_content';
import { indexPatternMock } from '../../../__mocks__/index_pattern';
import { indexPatternMock } from '../../__mocks__/index_pattern';
import { ContextApp } from './context_app';
import { setServices } from '../../../kibana_services';
import { DiscoverServices } from '../../../build_services';
import { indexPatternsMock } from '../../../__mocks__/index_patterns';
import { setServices } from '../../kibana_services';
import { DiscoverServices } from '../../build_services';
import { indexPatternsMock } from '../../__mocks__/index_patterns';
import { act } from 'react-dom/test-utils';
import { uiSettingsMock } from '../../../__mocks__/ui_settings';
import { uiSettingsMock } from '../../__mocks__/ui_settings';

const mockFilterManager = createFilterManagerMock();
const mockNavigationPlugin = { ui: { TopNavMenu: mockTopNavMenu } };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import classNames from 'classnames';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiText, EuiPageContent, EuiPage, EuiSpacer } from '@elastic/eui';
import { cloneDeep } from 'lodash';
import { esFilters } from '../../../../../data/public';
import { DOC_TABLE_LEGACY, SEARCH_FIELDS_FROM_SOURCE } from '../../../../common';
import { esFilters } from '../../../../data/public';
import { DOC_TABLE_LEGACY, SEARCH_FIELDS_FROM_SOURCE } from '../../../common';
import { ContextErrorMessage } from './components/context_error_message';
import { IndexPattern, IndexPatternField } from '../../../../../data/common';
import { IndexPattern, IndexPatternField } from '../../../../data/common';
import { LoadingStatus } from './services/context_query_state';
import { getServices } from '../../../kibana_services';
import { getServices } from '../../kibana_services';
import { AppState, isEqualFilters } from './services/context_state';
import { useColumns } from '../../helpers/use_data_grid_columns';
import { useColumns } from '../../utils/use_data_grid_columns';
import { useContextAppState } from './utils/use_context_app_state';
import { useContextAppFetch } from './utils/use_context_app_fetch';
import { popularizeField } from '../../helpers/popularize_field';
import { popularizeField } from '../../utils/popularize_field';
import { ContextAppContent } from './context_app_content';
import { SurrDocType } from './services/context';
import { DocViewFilterFn } from '../../doc_views/doc_views_types';
import { DocViewFilterFn } from '../../services/doc_views/doc_views_types';

const ContextAppContentMemoized = memo(ContextAppContent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import { ActionBar } from './components/action_bar/action_bar';
import { AppState, GetStateReturn } from './services/context_state';
import { SortDirection } from 'src/plugins/data/common';
import { ContextAppContent, ContextAppContentProps } from './context_app_content';
import { getServices, setServices } from '../../../kibana_services';
import { getServices, setServices } from '../../kibana_services';
import { LoadingStatus } from './services/context_query_state';
import { indexPatternMock } from '../../../__mocks__/index_pattern';
import { indexPatternMock } from '../../__mocks__/index_pattern';
import { DiscoverGrid } from '../../components/discover_grid/discover_grid';
import { discoverServiceMock } from '../../../__mocks__/services';
import { DocTableWrapper } from '../main/components/doc_table/doc_table_wrapper';
import { EsHitRecordList } from '../../types';
import { discoverServiceMock } from '../../__mocks__/services';
import { DocTableWrapper } from '../../components/doc_table/doc_table_wrapper';
import { EsHitRecordList } from '../types';

describe('ContextAppContent test', () => {
let hit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
import React, { useState, Fragment, useMemo, useCallback } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiHorizontalRule, EuiText } from '@elastic/eui';
import { CONTEXT_STEP_SETTING, DOC_HIDE_TIME_COLUMN_SETTING } from '../../../../common';
import { IndexPattern } from '../../../../../data/common';
import { SortDirection } from '../../../../../data/public';
import { CONTEXT_STEP_SETTING, DOC_HIDE_TIME_COLUMN_SETTING } from '../../../common';
import { IndexPattern } from '../../../../data/common';
import { SortDirection } from '../../../../data/public';
import { LoadingStatus } from './services/context_query_state';
import { ActionBar } from './components/action_bar/action_bar';
import { DiscoverGrid } from '../../components/discover_grid/discover_grid';
import { DocViewFilterFn, ElasticSearchHit } from '../../doc_views/doc_views_types';
import { DocViewFilterFn, ElasticSearchHit } from '../../services/doc_views/doc_views_types';
import { AppState } from './services/context_state';
import { SurrDocType } from './services/context';
import { DiscoverServices } from '../../../build_services';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from './utils/constants';
import { DocTableContext } from '../main/components/doc_table/doc_table_context';
import { EsHitRecordList } from '../../types';
import { SortPairArr } from '../main/components/doc_table/lib/get_sort';
import { DiscoverServices } from '../../build_services';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from './services/constants';
import { DocTableContext } from '../../components/doc_table/doc_table_context';
import { EsHitRecordList } from '../types';
import { SortPairArr } from '../../components/doc_table/lib/get_sort';

export interface ContextAppContentProps {
columns: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { useParams } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import { EuiEmptyPrompt } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { DiscoverServices } from '../../../build_services';
import { DiscoverServices } from '../../build_services';
import { ContextApp } from './context_app';
import { getRootBreadcrumbs } from '../../helpers/breadcrumbs';
import { getRootBreadcrumbs } from '../../utils/breadcrumbs';
import { LoadingIndicator } from '../../components/common/loading_indicator';
import { useIndexPattern } from '../../helpers/use_index_pattern';
import { useIndexPattern } from '../../utils/use_index_pattern';

export interface ContextAppProps {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sinon from 'sinon';
import moment from 'moment';

import { EsHitRecordList } from '../../../types';
import { EsHitRecordList } from '../../types';

type SortHit = {
[key in string]: number; // timeField name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
* Side Public License, v 1.
*/

import { IndexPattern, SortDirection } from '../../../../../../data/public';
import { IndexPattern, SortDirection } from '../../../../../data/public';
import { createSearchSourceStub } from './_stubs';
import { fetchAnchor, updateSearchSource } from './anchor';
import { indexPatternMock } from '../../../../__mocks__/index_pattern';
import { savedSearchMock } from '../../../../__mocks__/saved_search';
import { EsHitRecordList } from '../../../types';
import { indexPatternMock } from '../../../__mocks__/index_pattern';
import { savedSearchMock } from '../../../__mocks__/saved_search';
import { EsHitRecordList } from '../../types';

describe('context app', function () {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import { i18n } from '@kbn/i18n';

import { ISearchSource, EsQuerySortValue, IndexPattern } from '../../../../../../data/public';
import { EsHitRecord } from '../../../types';
import { ISearchSource, EsQuerySortValue, IndexPattern } from '../../../../../data/public';
import { EsHitRecord } from '../../types';

export async function fetchAnchor(
anchorId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { get, last } from 'lodash';
import { IndexPattern, SortDirection } from 'src/plugins/data/common';
import { createContextSearchSourceStub } from './_stubs';
import { fetchSurroundingDocs, SurrDocType } from './context';
import { setServices } from '../../../../kibana_services';
import { Query } from '../../../../../../data/public';
import { DiscoverServices } from '../../../../build_services';
import { EsHitRecord, EsHitRecordList } from '../../../types';
import { setServices } from '../../../kibana_services';
import { Query } from '../../../../../data/public';
import { DiscoverServices } from '../../../build_services';
import { EsHitRecord, EsHitRecordList } from '../../types';

const MS_PER_DAY = 24 * 60 * 60 * 1000;
const ANCHOR_TIMESTAMP = new Date(MS_PER_DAY).toJSON();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import moment from 'moment';
import { get, last } from 'lodash';
import { IndexPattern, SortDirection } from 'src/plugins/data/common';
import { createContextSearchSourceStub } from './_stubs';
import { setServices } from '../../../../kibana_services';
import { Query } from '../../../../../../data/public';
import { setServices } from '../../../kibana_services';
import { Query } from '../../../../../data/public';
import { fetchSurroundingDocs, SurrDocType } from './context';
import { DiscoverServices } from '../../../../build_services';
import { EsHitRecord, EsHitRecordList } from '../../../types';
import { DiscoverServices } from '../../../build_services';
import { EsHitRecord, EsHitRecordList } from '../../types';

const MS_PER_DAY = 24 * 60 * 60 * 1000;
const ANCHOR_TIMESTAMP = new Date(MS_PER_DAY).toJSON();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/

import { updateSearchSource } from './context';
import { indexPatternMock } from '../../../../__mocks__/index_pattern';
import { createSearchSourceMock } from '../../../../../../data/public/mocks';
import { indexPatternMock } from '../../../__mocks__/index_pattern';
import { createSearchSourceMock } from '../../../../../data/public/mocks';

describe('context api', function () {
test('createSearchSource when useFieldsApi is true', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* Side Public License, v 1.
*/
import { Filter, IndexPattern, ISearchSource } from 'src/plugins/data/public';
import { reverseSortDir, SortDirection } from './utils/sorting';
import { convertIsoToMillis, extractNanos } from './utils/date_conversion';
import { fetchHitsInInterval } from './utils/fetch_hits_in_interval';
import { generateIntervals } from './utils/generate_intervals';
import { getEsQuerySearchAfter } from './utils/get_es_query_search_after';
import { getEsQuerySort } from './utils/get_es_query_sort';
import { getServices } from '../../../../kibana_services';
import { EsHitRecord, EsHitRecordList } from '../../../types';
import { reverseSortDir, SortDirection } from '../utils/sorting';
import { convertIsoToMillis, extractNanos } from '../utils/date_conversion';
import { fetchHitsInInterval } from '../utils/fetch_hits_in_interval';
import { generateIntervals } from '../utils/generate_intervals';
import { getEsQuerySearchAfter } from '../utils/get_es_query_search_after';
import { getEsQuerySort } from '../utils/get_es_query_sort';
import { getServices } from '../../../kibana_services';
import { EsHitRecord, EsHitRecordList } from '../../types';

export enum SurrDocType {
SUCCESSORS = 'successors',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { EsHitRecord, EsHitRecordList } from '../../../types';
import { EsHitRecord, EsHitRecordList } from '../../types';

export interface ContextFetchState {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import { IUiSettingsClient } from 'kibana/public';
import { getState } from './context_state';
import { createBrowserHistory, History } from 'history';
import { FilterManager, Filter } from '../../../../../../data/public';
import { coreMock } from '../../../../../../../core/public/mocks';
import { SEARCH_FIELDS_FROM_SOURCE } from '../../../../../common';
import { FilterManager, Filter } from '../../../../../data/public';
import { coreMock } from '../../../../../../core/public/mocks';
import { SEARCH_FIELDS_FROM_SOURCE } from '../../../../common';

const setupMock = coreMock.createSetup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
syncStates,
withNotifyOnErrors,
ReduxLikeStateContainer,
} from '../../../../../../kibana_utils/public';
import { esFilters, FilterManager, Filter } from '../../../../../../data/public';
import { handleSourceColumnState } from '../../../helpers/state_helpers';
} from '../../../../../kibana_utils/public';
import { esFilters, FilterManager, Filter } from '../../../../../data/public';
import { handleSourceColumnState } from '../../../utils/state_helpers';

export interface AppState {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* Side Public License, v 1.
*/

import { ISearchSource, EsQuerySortValue, SortDirection } from '../../../../../../../data/public';
import { ISearchSource, EsQuerySortValue, SortDirection } from '../../../../../data/public';
import { convertTimeValueToIso } from './date_conversion';
import { IntervalValue } from './generate_intervals';
import { EsQuerySearchAfter } from './get_es_query_search_after';
import { EsHitRecord, EsHitRecordList } from '../../../../types';
import { EsHitRecord, EsHitRecordList } from '../../types';

interface RangeQuery {
format: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import { SortDirection } from '../../../../../../../data/public';
import { SurrDocType } from '../context';
import { SortDirection } from '../../../../../data/public';
import { SurrDocType } from '../services/context';

export type IntervalValue = number | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import { SurrDocType } from '../context';
import { EsHitRecord, EsHitRecordList } from '../../../../types';
import { SurrDocType } from '../services/context';
import { EsHitRecord, EsHitRecordList } from '../../types';

export type EsQuerySearchAfter = [string | number, string | number];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
*/

import { act, renderHook } from '@testing-library/react-hooks';
import { setServices, getServices } from '../../../../kibana_services';
import { createFilterManagerMock } from '../../../../../../data/public/query/filter_manager/filter_manager.mock';
import { CONTEXT_TIE_BREAKER_FIELDS_SETTING } from '../../../../../common';
import { DiscoverServices } from '../../../../build_services';
import { setServices, getServices } from '../../../kibana_services';
import { createFilterManagerMock } from '../../../../../data/public/query/filter_manager/filter_manager.mock';
import { CONTEXT_TIE_BREAKER_FIELDS_SETTING } from '../../../../common';
import { DiscoverServices } from '../../../build_services';
import { FailureReason, LoadingStatus } from '../services/context_query_state';
import { ContextAppFetchProps, useContextAppFetch } from './use_context_app_fetch';
import {
mockAnchorHit,
mockPredecessorHits,
mockSuccessorHits,
} from '../__mocks__/use_context_app_fetch';
import { indexPatternWithTimefieldMock } from '../../../../__mocks__/index_pattern_with_timefield';
import { indexPatternWithTimefieldMock } from '../../../__mocks__/index_pattern_with_timefield';
import { createContextSearchSourceStub } from '../services/_stubs';
import { IndexPattern } from '../../../../../../data_views/common';
import { IndexPattern } from '../../../../../data_views/common';

const mockFilterManager = createFilterManagerMock();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
*/
import React, { useCallback, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { CONTEXT_TIE_BREAKER_FIELDS_SETTING } from '../../../../../common';
import { DiscoverServices } from '../../../../build_services';
import { CONTEXT_TIE_BREAKER_FIELDS_SETTING } from '../../../../common';
import { DiscoverServices } from '../../../build_services';
import { fetchAnchor } from '../services/anchor';
import { fetchSurroundingDocs, SurrDocType } from '../services/context';
import { MarkdownSimple, toMountPoint } from '../../../../../../kibana_react/public';
import { IndexPattern, SortDirection } from '../../../../../../data/public';
import { MarkdownSimple, toMountPoint } from '../../../../../kibana_react/public';
import { IndexPattern, SortDirection } from '../../../../../data/public';
import {
ContextFetchState,
FailureReason,
getInitialContextQueryState,
LoadingStatus,
} from '../services/context_query_state';
import { AppState } from '../services/context_state';
import { getFirstSortableField } from '../services/utils/sorting';
import { EsHitRecord } from '../../../types';
import { getFirstSortableField } from './sorting';
import { EsHitRecord } from '../../types';

const createError = (statusKey: string, reason: FailureReason, error?: Error) => ({
[statusKey]: { value: LoadingStatus.FAILED, error, reason },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import { useEffect, useMemo, useState } from 'react';

import { cloneDeep } from 'lodash';
import { CONTEXT_DEFAULT_SIZE_SETTING } from '../../../../../common';
import { DiscoverServices } from '../../../../build_services';
import { CONTEXT_DEFAULT_SIZE_SETTING } from '../../../../common';
import { DiscoverServices } from '../../../build_services';
import { AppState, getState } from '../services/context_state';

export function useContextAppState({ services }: { services: DiscoverServices }) {
Expand Down
Loading

0 comments on commit ba9995e

Please sign in to comment.