[Enterprise Search] Move schema types to shared (#84822)

* Move schema types to shared

We use the Schema types in Workplace Search as well, so moving these to shared. Also, we have a component called IndexingStatus so reverting to the prefixed IIndexingStatus interface name

* Fix misspelled interface
This commit is contained in:
Scotty Bollinger 2020-12-02 15:34:19 -06:00 committed by GitHub
parent b593781009
commit 4f3d72b413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 38 deletions

View file

@ -8,7 +8,7 @@ import { kea, MakeLogicType } from 'kea';
import { HttpLogic } from '../../../shared/http';
import { IndexingStatus } from '../schema/types';
import { IIndexingStatus } from '../../../shared/types';
import { EngineDetails } from './types';
interface EngineValues {
@ -25,7 +25,7 @@ interface EngineValues {
interface EngineActions {
setEngineData(engine: EngineDetails): { engine: EngineDetails };
setEngineName(engineName: string): { engineName: string };
setIndexingStatus(activeReindexJob: IndexingStatus): { activeReindexJob: IndexingStatus };
setIndexingStatus(activeReindexJob: IIndexingStatus): { activeReindexJob: IIndexingStatus };
setEngineNotFound(notFound: boolean): { notFound: boolean };
clearEngine(): void;
initializeEngine(): void;

View file

@ -5,7 +5,7 @@
*/
import { ApiToken } from '../credentials/types';
import { Schema, SchemaConflicts, IndexingStatus } from '../schema/types';
import { Schema, SchemaConflicts, IIndexingStatus } from '../../../shared/types';
export interface Engine {
name: string;
@ -26,7 +26,7 @@ export interface EngineDetails extends Engine {
schema: Schema;
schemaConflicts?: SchemaConflicts;
unconfirmedFields?: string[];
activeReindexJob?: IndexingStatus;
activeReindexJob?: IIndexingStatus;
invalidBoosts: boolean;
sample?: boolean;
isMeta: boolean;

View file

@ -1,34 +0,0 @@
/*
* 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.
*/
export type SchemaTypes = 'text' | 'number' | 'geolocation' | 'date';
export interface Schema {
[key: string]: SchemaTypes;
}
// this is a mapping of schema field types ("string", "number", "geolocation", "date") to the names
// of source engines which utilize that type
export type SchemaConflictFieldTypes = {
[key in SchemaTypes]: string[];
};
export interface SchemaConflict {
fieldTypes: SchemaConflictFieldTypes;
resolution?: string;
}
// For now these values are ISchemaConflictFieldTypes, but in the near future will be ISchemaConflict
// once we implement schema conflict resolution
export interface SchemaConflicts {
[key: string]: SchemaConflictFieldTypes;
}
export interface IndexingStatus {
percentageComplete: number;
numDocumentsWithErrors: number;
activeReindexJobId: number;
}

View file

@ -4,6 +4,29 @@
* you may not use this file except in compliance with the Elastic License.
*/
export type SchemaTypes = 'text' | 'number' | 'geolocation' | 'date';
export interface Schema {
[key: string]: SchemaTypes;
}
// this is a mapping of schema field types ("string", "number", "geolocation", "date") to the names
// of source engines which utilize that type
export type SchemaConflictFieldTypes = {
[key in SchemaTypes]: string[];
};
export interface SchemaConflict {
fieldTypes: SchemaConflictFieldTypes;
resolution?: string;
}
// For now these values are ISchemaConflictFieldTypes, but in the near future will be ISchemaConflict
// once we implement schema conflict resolution
export interface SchemaConflicts {
[key: string]: SchemaConflictFieldTypes;
}
export interface IIndexingStatus {
percentageComplete: number;
numDocumentsWithErrors: number;