From 909759bfc61a805cc8c6807125afc0d264eff132 Mon Sep 17 00:00:00 2001 From: RakhithaRR Date: Wed, 23 Oct 2024 00:18:57 +0530 Subject: [PATCH] Fix endpoint validation issue with AI APIs --- .../src/main/webapp/site/public/locales/en.json | 1 - .../Apis/Details/Endpoints/AIEndpointAuth.jsx | 14 +------------- .../Apis/Details/Endpoints/EndpointOverview.jsx | 9 ++++++++- .../Apis/Details/Endpoints/Endpoints.jsx | 3 ++- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/portals/publisher/src/main/webapp/site/public/locales/en.json b/portals/publisher/src/main/webapp/site/public/locales/en.json index d035a580099..aead2fb71a0 100644 --- a/portals/publisher/src/main/webapp/site/public/locales/en.json +++ b/portals/publisher/src/main/webapp/site/public/locales/en.json @@ -865,7 +865,6 @@ "Apis.Details.Endpoints.Security.api.key.header": "Authorization Header", "Apis.Details.Endpoints.Security.api.key.query.param": "Authorization Query Param", "Apis.Details.Endpoints.Security.api.key.value.placeholder": "Enter API Key", - "Apis.Details.Endpoints.Security.api.key.value.tooltip": "API Key for the AI API", "Apis.Details.Endpoints.Security.api.key.value.value": "API Key", "Apis.Details.Endpoints.Security.no.api.key.value.error": "API Key should not be empty", "Apis.Details.Endpoints.SequenceBackend.AddCertificat": "Add Sequence Backend", diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpointAuth.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpointAuth.jsx index 17e18b9c14f..93bdc756729 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpointAuth.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpointAuth.jsx @@ -20,7 +20,7 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { isRestricted } from 'AppData/AuthManager'; import { FormattedMessage, useIntl } from 'react-intl'; -import { Icon, TextField, Tooltip, InputAdornment, IconButton } from '@mui/material'; +import { Icon, TextField, InputAdornment, IconButton } from '@mui/material'; import CONSTS from 'AppData/Constants'; export default function AIEndpointAuth(props) { @@ -123,18 +123,6 @@ export default function AIEndpointAuth(props) { InputProps={{ endAdornment: ( - - )} - > - security - {showApiKey ? 'visibility' : 'visibility_off'} diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/EndpointOverview.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/EndpointOverview.jsx index 1e4b2fb699f..7fd0d9bdc74 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/EndpointOverview.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/EndpointOverview.jsx @@ -408,6 +408,9 @@ function EndpointOverview(props) { const endpointProp = 'production_endpoints'; if (endpointCategory[category]) { delete endpointConfigCopy[endpointProp]; + if (endpointConfigCopy?.endpoint_security?.production !== null) { + delete endpointConfigCopy.endpoint_security.production; + } if (endpointConfigCopy.endpointType === 'failover') { delete endpointConfigCopy.production_failovers; } @@ -423,6 +426,9 @@ function EndpointOverview(props) { const endpointProp = 'sandbox_endpoints'; if (endpointCategory[category]) { delete endpointConfigCopy[endpointProp]; + if (endpointConfigCopy?.endpoint_security?.sandbox !== null) { + delete endpointConfigCopy.endpoint_security.sandbox; + } if (endpointConfigCopy.endpointType === 'failover') { delete endpointConfigCopy.sandbox_failovers; } @@ -1273,7 +1279,8 @@ function EndpointOverview(props) { {toggleEndpointSecurityConfig} apiId={api.id} /> - {api.subtypeConfiguration?.subtype === 'AIAPI' && // eslint-disable-line + {endpointCategory.sandbox && // eslint-disable-line + api.subtypeConfiguration?.subtype === 'AIAPI' && // eslint-disable-line (apiKeyParamConfig.authHeader || apiKeyParamConfig.authQueryParameter) && // eslint-disable-line (