Skip to content

Commit

Permalink
[data views] rename files from index patterns to data view (#112047) (#…
Browse files Browse the repository at this point in the history
…112408)

* rename directories

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/plugins/data/common/search/search_source/search_source.test.ts
#	src/plugins/data/public/data_views/data_views/on_unsupported_time_pattern.tsx
#	src/plugins/data/public/data_views/index.ts
#	src/plugins/data/server/search/search_service.ts
  • Loading branch information
mattkime authored Sep 16, 2021
1 parent e3f344f commit d560d74
Show file tree
Hide file tree
Showing 185 changed files with 135 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { DataView } from './index_pattern';
import { DataView } from './data_view';

export interface DataViewCache {
get: (id: string) => Promise<DataView> | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { DATA_VIEW_SAVED_OBJECT_TYPE, SavedObjectsClientCommon } from '../..';

import { createDataViewCache } from '.';
import type { RuntimeField } from '../types';
import { DataView } from './index_pattern';
import { createEnsureDefaultDataView, EnsureDefaultDataView } from './ensure_default_index_pattern';
import { DataView } from './data_view';
import { createEnsureDefaultDataView, EnsureDefaultDataView } from './ensure_default_data_view';
import {
OnNotification,
OnError,
Expand Down Expand Up @@ -241,7 +241,7 @@ export class DataViewsService {
/**
* Checks if current user has a user created index pattern ignoring fleet's server default index patterns
*/
async hasUserIndexPattern(): Promise<boolean> {
async hasUserDataView(): Promise<boolean> {
return this.apiClient.hasUserIndexPattern();
}

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

import { includes } from 'lodash';
import { DataViewsContract } from './index_patterns';
import { DataViewsContract } from './data_views';
import { UiSettingsCommon } from '../types';

export type EnsureDefaultDataView = () => Promise<unknown> | undefined;

export const createEnsureDefaultDataView = (
uiSettings: UiSettingsCommon,
onRedirectNoIndexPattern: () => Promise<unknown> | void
onRedirectNoDefaultView: () => Promise<unknown> | void
) => {
/**
* Checks whether a default index pattern is set and exists and defines
* Checks whether a default data view is set and exists and defines
* one otherwise.
*/
return async function ensureDefaultDataView(this: DataViewsContract) {
Expand All @@ -36,12 +36,12 @@ export const createEnsureDefaultDataView = (
}

// If there is any user index pattern created, set the first as default
// if there is 0 patterns, then don't even call `hasUserIndexPattern()`
if (patterns.length >= 1 && (await this.hasUserIndexPattern().catch(() => true))) {
// if there is 0 patterns, then don't even call `hasUserDataView()`
if (patterns.length >= 1 && (await this.hasUserDataView().catch(() => true))) {
defaultId = patterns[0];
await uiSettings.set('defaultIndex', defaultId);
} else {
return onRedirectNoIndexPattern();
return onRedirectNoDefaultView();
}
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { IndexPattern } from './index_pattern';
import { IndexPattern } from './data_view';

import { fieldFormatsMock } from '../../../../field_formats/common/mocks';
import { flattenHitWrapper } from './flatten_hit';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import _ from 'lodash';
import { DataView } from './index_pattern';
import { DataView } from './data_view';

// Takes a hit, merges it with any stored/scripted fields, and with the metaFields
// returns a flattened version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import _ from 'lodash';
import { DataView } from './index_pattern';
import { DataView } from './data_view';
import { FieldFormatsContentType } from '../../../../field_formats/common';

const formattedCache = new WeakMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
export * from './_pattern_cache';
export * from './flatten_hit';
export * from './format_hit';
export * from './index_pattern';
export * from './index_patterns';
export * from './data_view';
export * from './data_views';
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import { IndexPattern } from './index_pattern';
import { IndexPatternSpec } from '../types';
import { IndexPattern } from './data_view';
import { DataViewSpec } from '../types';
import { FieldFormatsStartCommon } from '../../../../field_formats/common';
import { fieldFormatsMock } from '../../../../field_formats/common/mocks';

Expand Down Expand Up @@ -37,7 +37,7 @@ export const createStubIndexPattern = ({
opts,
deps,
}: {
spec: IndexPatternSpec;
spec: DataViewSpec;
opts?: {
shortDotsEnable?: boolean;
metaFields?: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { map, last } from 'lodash';

import { IndexPattern } from './index_pattern';
import { IndexPattern } from './data_view';

import { DuplicateField } from '../../../../kibana_utils/common';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { i18n } from '@kbn/i18n';
import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
import { DataViewsContract } from '../index_patterns';
import { DataViewsContract } from '../data_views';
import { DataViewSpec } from '..';
import { SavedObjectReference } from '../../../../../core/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { findIndex } from 'lodash';
import { IFieldType } from './types';
import { DataViewField } from './index_pattern_field';
import { FieldSpec, DataViewFieldMap } from '../types';
import { DataView } from '../index_patterns';
import { DataView } from '../data_views';

type FieldMap = Map<DataViewField['name'], DataViewField>;

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

import { IndexPatternField } from './index_pattern_field';
import { IndexPattern } from '../index_patterns';
import { IndexPattern } from '..';
import { KBN_FIELD_TYPES } from '../../../common';
import { FieldSpec, RuntimeField } from '../types';
import { FieldFormat } from '../../../../field_formats/common';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ export {
IndexPatternsContract,
DataViewsService,
DataViewsContract,
} from './index_patterns';
export type {
IndexPattern,
IndexPatternListItem,
DataView,
DataViewListItem,
} from './index_patterns';
} from './data_views';
// todo was trying to export this as type but wasn't working
export { IndexPattern, IndexPatternListItem, DataView, DataViewListItem } from './data_views';
export * from './errors';
export * from './expressions';
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/

import { stubFieldSpecMap, stubLogstashFieldSpecMap } from './field.stub';
import { createStubIndexPattern } from './index_patterns/index_pattern.stub';
export { createStubIndexPattern } from './index_patterns/index_pattern.stub';
import { createStubIndexPattern } from './data_views/index_pattern.stub';
export { createStubIndexPattern } from './data_views/index_pattern.stub';
import { SavedObject } from '../../../../core/types';
import { IndexPatternAttributes } from '../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ export class DataViewMissingIndices extends KbnError {
);
}
}

/**
* @deprecated Use DataViewMissingIndices. All index pattern interfaces were renamed.
*/

export class IndexPatternMissingIndices extends DataViewMissingIndices {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

export * from './fields/fields.mocks';
export * from './index_patterns/index_pattern.stub';
export * from './data_views/index_pattern.stub';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import type { IndexPatternSavedObjectAttrs } from './index_patterns';
import type { IndexPatternSavedObjectAttrs } from './data_views';
import type { SavedObjectsClientCommon } from '../types';

import { DATA_VIEW_SAVED_OBJECT_TYPE } from '../constants';
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

export * from './constants';
export * from './es_query';
export * from './index_patterns';
export * from './data_views';
export * from './kbn_field_types';
export * from './query';
export * from './search';
Expand All @@ -25,4 +25,4 @@ export * from './exports';
* @removeBy 8.1
*/

export { IndexPatternAttributes, DataViewAttributes } from './types';
export { IndexPatternAttributes } from './types';
2 changes: 1 addition & 1 deletion src/plugins/data/common/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* Side Public License, v 1.
*/

export * from './index_patterns/fields/fields.mocks';
export * from './data_views/fields/fields.mocks';
2 changes: 1 addition & 1 deletion src/plugins/data/common/search/aggs/agg_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AggType } from './agg_type';
import { AggTypesRegistryStart } from './agg_types_registry';
import { mockAggTypesRegistry } from './test_helpers';
import { MetricAggType } from './metrics/metric_agg_type';
import { IndexPattern, IndexPatternField, IIndexPatternFieldList } from '../../index_patterns';
import { IndexPattern, IndexPatternField, IIndexPatternFieldList } from '../..';

describe('AggConfig', () => {
let indexPattern: IndexPattern;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/search/aggs/agg_configs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AggConfig } from './agg_config';
import { AggConfigs } from './agg_configs';
import { AggTypesRegistryStart } from './agg_types_registry';
import { mockAggTypesRegistry } from './test_helpers';
import { IndexPattern } from '../../index_patterns/';
import { IndexPattern } from '../..';
import { stubIndexPattern } from '../../stubs';
import { IEsSearchResponse } from '..';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/search/aggs/agg_configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { AggConfig, AggConfigSerialized, IAggConfig } from './agg_config';
import { IAggType } from './agg_type';
import { AggTypesRegistryStart } from './agg_types_registry';
import { AggGroupNames } from './agg_groups';
import { IndexPattern } from '../../index_patterns/index_patterns/index_pattern';
import { IndexPattern } from '../..';
import { TimeRange, getTime, calculateBounds } from '../../../common';
import { IBucketAggConfig } from './buckets';
import { insertTimeShiftSplit, mergeTimeShifts } from './utils/time_splits';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { AggConfigs, CreateAggConfigParams } from '../agg_configs';
import { BUCKET_TYPES } from './bucket_agg_types';
import { IBucketAggConfig } from './bucket_agg_type';
import { mockAggTypesRegistry } from '../test_helpers';
import type { IndexPatternField } from '../../../index_patterns';
import { IndexPattern } from '../../../index_patterns/index_patterns/index_pattern';
import type { IndexPatternField } from '../../..';
import { IndexPattern } from '../../..';

const indexPattern = {
id: '1234',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import moment from 'moment-timezone';
import { i18n } from '@kbn/i18n';

import { KBN_FIELD_TYPES, TimeRange, TimeRangeBounds, UI_SETTINGS } from '../../../../common';
import { IFieldType } from '../../../index_patterns';
import { IFieldType } from '../../..';

import { ExtendedBounds, extendedBoundsToAst, timerangeToAst } from '../../expressions';
import { intervalOptions, autoInterval, isAutoInterval } from './_interval_options';
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/search/aggs/buckets/terms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { AggConfigs } from '../agg_configs';
import { METRIC_TYPES } from '../metrics';
import { mockAggTypesRegistry } from '../test_helpers';
import { BUCKET_TYPES } from './bucket_agg_types';
import type { IndexPatternField } from '../../../index_patterns';
import { IndexPattern } from '../../../index_patterns/index_patterns/index_pattern';
import type { IndexPatternField } from '../../..';
import { IndexPattern } from '../../..';

describe('Terms Agg', () => {
describe('order agg editor UI', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/search/aggs/param_types/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { BaseParamType } from './base';
import { propFilter } from '../utils';
import { KBN_FIELD_TYPES } from '../../../kbn_field_types/types';
import { isNestedField, IndexPatternField } from '../../../index_patterns/fields';
import { isNestedField, IndexPatternField } from '../../../data_views/fields';

const filterByType = propFilter('type');

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/search/aggs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { Assign } from '@kbn/utility-types';
import { DatatableColumn } from 'src/plugins/expressions';
import { IndexPattern } from '../../index_patterns/index_patterns/index_pattern';
import { IndexPattern } from '../..';
import {
aggAvg,
aggBucketAvg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { DatatableColumn } from 'src/plugins/expressions/common';
import { IndexPattern } from '../../../index_patterns';
import { IndexPattern } from '../../..';
import { AggConfigs, CreateAggConfigParams } from '../agg_configs';
import { AggTypesRegistryStart } from '../agg_types_registry';
import { IAggType } from '../agg_type';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jest.mock('moment', () => {
return moment;
});

import { IndexPattern, IndexPatternField } from '../../../index_patterns';
import { IndexPattern, IndexPatternField } from '../../..';
import { AggParamsDateHistogram } from '../buckets';
import { inferTimeZone } from './infer_time_zone';

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

import moment from 'moment';
import { IndexPattern } from '../../../index_patterns';
import { IndexPattern } from '../../..';
import { AggParamsDateHistogram } from '../buckets';

export function inferTimeZone(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Observable } from 'rxjs';
import type { Datatable, ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
import { buildExpressionFunction } from '../../../../../../plugins/expressions/common';

import { IndexPatternExpressionType } from '../../../index_patterns/expressions';
import { IndexPatternsContract } from '../../../index_patterns/index_patterns';
import { IndexPatternExpressionType } from '../../../data_views/expressions';
import { IndexPatternsContract } from '../../..';

import { AggsStart, AggExpressionType, aggCountFnName } from '../../aggs';
import { ISearchStartSearchSource } from '../../search_source';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { from } from 'rxjs';
import type { MockedKeys } from '@kbn/utility-types/jest';
import type { Filter } from '../../../es_query';
import type { IndexPattern } from '../../../index_patterns';
import type { IndexPattern } from '../../..';
import type { IAggConfigs } from '../../aggs';
import type { ISearchSource } from '../../search_source';
import { searchSourceCommonMock, searchSourceInstanceMock } from '../../search_source/mocks';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/search/expressions/esdsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { EsRawResponse } from './es_raw_response';
import { RequestStatistics, RequestAdapter } from '../../../../inspector/common';
import { ISearchGeneric, KibanaContext } from '..';
import { getEsQueryConfig } from '../../es_query';
import { UiSettingsCommon } from '../../index_patterns';
import { UiSettingsCommon } from '../..';

const name = 'esdsl';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
import { buildFilter, FILTERS } from '@kbn/es-query';
import { KibanaField, KibanaFilter } from './kibana_context_type';
import { IndexPattern } from '../../index_patterns/index_patterns';
import { IndexPattern } from '../..';

interface Arguments {
field: KibanaField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ExecutionContextSearch, KibanaContext, KibanaFilter } from './kibana_co
import { KibanaQueryOutput } from './kibana_context_type';
import { KibanaTimerangeOutput } from './timerange';
import { SavedObjectReference } from '../../../../../core/types';
import { SavedObjectsClientCommon } from '../../index_patterns';
import { SavedObjectsClientCommon } from '../..';

/** @internal */
export interface KibanaContextStartDependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { ExpressionValueBoxed } from 'src/plugins/expressions/common';
import { Filter } from '../../es_query';
import { Query, TimeRange } from '../../query';
import { IndexPatternField } from '../../index_patterns/fields';
import { IndexPatternField } from '../..';

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type ExecutionContextSearch = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
import { buildFilter, FILTERS } from '@kbn/es-query';
import { KibanaField, KibanaFilter } from './kibana_context_type';
import { IndexPattern } from '../../index_patterns/index_patterns';
import { IndexPattern } from '../..';

interface Arguments {
field: KibanaField;
Expand Down
Loading

0 comments on commit d560d74

Please sign in to comment.