Skip to content

Commit

Permalink
Move schema types to shared
Browse files Browse the repository at this point in the history
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
  • Loading branch information
scottybollinger committed Dec 2, 2020
1 parent ae9df69 commit 2be89ce
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { ApiToken } from '../credentials/types';
import { Schema, SchemaConflicts, IndexingStatus } from '../schema/types';
import { Schema, SchemaConflicts, IndexingStatus } from '../../../shared/types';

export interface Engine {
name: string;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2be89ce

Please sign in to comment.