kibana/x-pack/plugins/lens/public/indexpattern_datasource/types.ts
Marco Liberati 0b99841310
[Lens] Performance refactoring for indexpattern fast lookup and Operation support matrix computation (#82829)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-10 14:31:04 +01:00

61 lines
1.6 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { IFieldType } from 'src/plugins/data/common';
import { IndexPatternColumn } from './operations';
import { IndexPatternAggRestrictions } from '../../../../../src/plugins/data/public';
export interface IndexPattern {
id: string;
fields: IndexPatternField[];
getFieldByName(name: string): IndexPatternField | undefined;
title: string;
timeFieldName?: string;
fieldFormatMap?: Record<
string,
{
id: string;
params: unknown;
}
>;
hasRestrictions: boolean;
}
export type IndexPatternField = IFieldType & {
displayName: string;
aggregationRestrictions?: Partial<IndexPatternAggRestrictions>;
meta?: boolean;
};
export interface IndexPatternLayer {
columnOrder: string[];
columns: Record<string, IndexPatternColumn>;
// Each layer is tied to the index pattern that created it
indexPatternId: string;
}
export interface IndexPatternPersistedState {
layers: Record<string, Omit<IndexPatternLayer, 'indexPatternId'>>;
}
export interface IndexPatternPrivateState {
currentIndexPatternId: string;
layers: Record<string, IndexPatternLayer>;
indexPatternRefs: IndexPatternRef[];
indexPatterns: Record<string, IndexPattern>;
/**
* indexPatternId -> fieldName -> boolean
*/
existingFields: Record<string, Record<string, boolean>>;
isFirstExistenceFetch: boolean;
existenceFetchFailed?: boolean;
}
export interface IndexPatternRef {
id: string;
title: string;
}