Skip to content

Commit ce127d2

Browse files
committed
Revert "[NP] Move IndexPatterns into the NP (#51199)"
This reverts commit 3a0d5f4.
1 parent 3a0d5f4 commit ce127d2

File tree

48 files changed

+158
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+158
-211
lines changed

src/legacy/core_plugins/data/public/filter/action/apply_filter_action.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ import {
3232
applyFiltersPopover,
3333
changeTimeFilter,
3434
extractTimeFilter,
35-
IndexPatternsStart,
3635
} from '../../../../../../plugins/data/public';
37-
36+
import { IndexPatternsStart } from '../../index_patterns';
3837
export const GLOBAL_APPLY_FILTER_ACTION = 'GLOBAL_APPLY_FILTER_ACTION';
3938

4039
interface ActionContext {
@@ -75,7 +74,7 @@ export function createFilterAction(
7574
if (selectedFilters.length > 1) {
7675
const indexPatterns = await Promise.all(
7776
filters.map(filter => {
78-
return indexPatternsService.indexPatterns.get(filter.meta.index!);
77+
return indexPatternsService.indexPatterns.get(filter.meta.index);
7978
})
8079
);
8180

src/legacy/core_plugins/data/public/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ export {
4848
/** @public static code */
4949
export * from '../common';
5050
export { FilterStateManager } from './filter/filter_manager';
51-
export { getFromSavedObject, getRoutes, flattenHitWrapper } from './index_patterns';
51+
export { getFromSavedObject, getRoutes } from './index_patterns';

src/plugins/data/public/index_patterns/fields/field.ts renamed to src/legacy/core_plugins/data/public/index_patterns/fields/field.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,26 @@
2020
import { i18n } from '@kbn/i18n';
2121
// @ts-ignore
2222
import { ObjDefine } from './obj_define';
23+
// @ts-ignore
24+
import { shortenDottedString } from '../../../../../core_plugins/kibana/common/utils/shorten_dotted_string';
2325
import { IndexPattern } from '../index_patterns';
2426
import { getNotifications, getFieldFormats } from '../services';
27+
2528
import {
26-
IFieldType,
29+
FieldFormat,
2730
getKbnFieldType,
31+
IFieldType,
2832
IFieldSubType,
29-
FieldFormat,
30-
shortenDottedString,
31-
} from '../../../common';
33+
} from '../../../../../../plugins/data/public';
3234

3335
export type FieldSpec = Record<string, any>;
3436

35-
export class Field implements IFieldType {
37+
/** @deprecated
38+
* Please use IFieldType instead
39+
* */
40+
export type FieldType = IFieldType;
41+
42+
export class Field implements FieldType {
3643
name: string;
3744
type: string;
3845
script?: string;

src/plugins/data/public/index_patterns/fields/field_list.ts renamed to src/legacy/core_plugins/data/public/index_patterns/fields/field_list.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@
1919

2020
import { findIndex } from 'lodash';
2121
import { IndexPattern } from '../index_patterns';
22-
import { IFieldType } from '../../../common';
23-
import { Field, FieldSpec } from './field';
22+
import { Field, FieldType, FieldSpec } from './field';
2423

2524
type FieldMap = Map<Field['name'], Field>;
2625

2726
export interface FieldListInterface extends Array<Field> {
2827
getByName(name: Field['name']): Field | undefined;
2928
getByType(type: Field['type']): Field[];
3029
add(field: FieldSpec): void;
31-
remove(field: IFieldType): void;
30+
remove(field: FieldType): void;
3231
}
3332

3433
export class FieldList extends Array<Field> implements FieldListInterface {
@@ -43,7 +42,7 @@ export class FieldList extends Array<Field> implements FieldListInterface {
4342
}
4443
this.groups.get(field.type)!.set(field.name, field);
4544
};
46-
private removeByGroup = (field: IFieldType) => this.groups.get(field.type)!.delete(field.name);
45+
private removeByGroup = (field: FieldType) => this.groups.get(field.type)!.delete(field.name);
4746

4847
constructor(indexPattern: IndexPattern, specs: FieldSpec[] = [], shortDotsEnable = false) {
4948
super();
@@ -62,7 +61,7 @@ export class FieldList extends Array<Field> implements FieldListInterface {
6261
this.setByGroup(newField);
6362
};
6463

65-
remove = (field: IFieldType) => {
64+
remove = (field: FieldType) => {
6665
this.removeByGroup(field);
6766
this.byName.delete(field.name);
6867

src/legacy/core_plugins/data/public/index_patterns/index.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,4 @@
1717
* under the License.
1818
*/
1919

20-
import { IFieldType, IIndexPattern, indexPatterns } from '../../../../../plugins/data/public';
21-
22-
const getFromSavedObject = indexPatterns.getFromSavedObject;
23-
const getRoutes = indexPatterns.getRoutes;
24-
const flattenHitWrapper = indexPatterns.flattenHitWrapper;
25-
26-
export { getFromSavedObject, getRoutes, flattenHitWrapper };
27-
export { IFieldType as FieldType };
28-
export { IIndexPattern as StaticIndexPattern };
29-
export {
30-
Field,
31-
FieldListInterface,
32-
IndexPattern,
33-
IndexPatterns,
34-
IndexPatternsStart,
35-
IndexPatternsSetup,
36-
IndexPatternsService,
37-
} from '../../../../../plugins/data/public';
20+
export * from './index_patterns_service';

src/plugins/data/public/index_patterns/index_patterns/_pattern_cache.ts renamed to src/legacy/core_plugins/data/public/index_patterns/index_patterns/_pattern_cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import { IndexPattern } from './index_pattern';
2121

22-
interface PatternCache {
22+
export interface PatternCache {
2323
get: (id: string) => IndexPattern;
2424
set: (id: string, value: IndexPattern) => IndexPattern;
2525
clear: (id: string) => void;

0 commit comments

Comments
 (0)