From 254aa3460cfad83a55487aa01a95c48786b9aeff Mon Sep 17 00:00:00 2001 From: YulNaumenko Date: Mon, 11 Nov 2024 14:01:26 -0800 Subject: [PATCH] fixed solutions badge for non-verified service provider --- .../connector_types/inference/connector.tsx | 5 +++- .../service_provider.tsx | 2 +- .../inference/providers/selectable/index.tsx | 23 +++++++++++++------ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/stack_connectors/public/connector_types/inference/connector.tsx b/x-pack/plugins/stack_connectors/public/connector_types/inference/connector.tsx index ac465b98f267..5f854384dbb5 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/inference/connector.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/inference/connector.tsx @@ -123,7 +123,6 @@ const InferenceAPIConnectorFields: React.FunctionComponent p.task_type === taskType); setSelectedTaskType(taskType); - generateInferenceEndpointId(config, setFieldValue); // transform the schema const newTaskTypeSchema = Object.keys(newTaskType?.configuration ?? {}).map((k) => ({ @@ -151,6 +150,10 @@ const InferenceAPIConnectorFields: React.FunctionComponent = ({ const renderProviderOption = useCallback>( (option, searchValue) => { - const provider = SERVICE_PROVIDERS[option.label as ServiceProviderKeys]; + const provider = Object.keys(SERVICE_PROVIDERS).includes(option.label) + ? SERVICE_PROVIDERS[option.label as ServiceProviderKeys] + : undefined; + + const supportedBySolutions = (provider && + provider.solutions.map((solution) => ( + + {solution} + + ))) ?? ( + + {'Search' as ProviderSolution} + + ); return ( @@ -65,12 +79,7 @@ const SelectableProviderComponent: React.FC = ({ - {provider && - provider.solutions.map((solution) => ( - - {solution} - - ))} + {supportedBySolutions}