Skip to content

Commit

Permalink
Merge branch 'main' into renovate/main-@elasticcharts
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 authored Jan 28, 2025
2 parents d41f70a + 590b4c7 commit 4fe9e6c
Show file tree
Hide file tree
Showing 11 changed files with 385 additions and 127 deletions.
2 changes: 0 additions & 2 deletions .buildkite/pipelines/on_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ steps:
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on: build
timeout_in_minutes: 120
parallelism: 3
retry:
Expand All @@ -503,7 +502,6 @@ steps:
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on: build
timeout_in_minutes: 120
parallelism: 3
retry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,4 @@
import { z } from '@kbn/zod';

export type GetKnowledgeBaseIndicesResponse = z.infer<typeof GetKnowledgeBaseIndicesResponse>;
export const GetKnowledgeBaseIndicesResponse = z.object({
/**
* List of indices with at least one field of a `sematic_text` type.
*/
indices: z.array(z.string()),
});
export const GetKnowledgeBaseIndicesResponse = z.object({}).catchall(z.array(z.string()));
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ paths:
application/json:
schema:
type: object
properties:
indices:
type: array
description: List of indices with at least one field of a `sematic_text` type.
items:
type: string
required:
- indices
additionalProperties:
type: array
description: List of indices with at least one field of a `sematic_text` type.
items:
type: string
400:
description: Generic Error
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('IndexEntryEditor', () => {
beforeEach(() => {
jest.clearAllMocks();
(useKnowledgeBaseIndices as jest.Mock).mockReturnValue({
data: { indices: ['index-1', 'index-2'] },
data: { 'index-1': ['field-1'], 'index-2': ['field-2'] },
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ export const IndexEntryEditor: React.FC<Props> = React.memo(
const { data: kbIndices } = useKnowledgeBaseIndices({
http,
});
const indexOptions = useMemo(() => {
return kbIndices?.indices.map((index) => ({
'data-test-subj': index,
label: index,
value: index,
}));
}, [kbIndices?.indices]);
const indexOptions = useMemo(
() =>
Object.keys(kbIndices ?? {}).map((index) => ({
'data-test-subj': index,
label: index,
value: index,
})),
[kbIndices]
);

const { value: isMissingIndex } = useAsync(async () => {
if (!entry?.index?.length) return false;
Expand All @@ -123,14 +125,12 @@ export const IndexEntryEditor: React.FC<Props> = React.memo(

const fieldOptions = useMemo(
() =>
indexFields?.value
?.filter((field) => field.esTypes?.includes('semantic_text'))
.map((field) => ({
'data-test-subj': field.name,
label: field.name,
value: field.name,
})) ?? [],
[indexFields?.value]
kbIndices?.[entry?.index ?? '']?.map((field) => ({
'data-test-subj': field,
label: field,
value: field,
})) ?? [],
[entry?.index, kbIndices]
);

const outputFieldOptions = useMemo(
Expand Down
Loading

0 comments on commit 4fe9e6c

Please sign in to comment.