Skip to content

Commit

Permalink
Change the link of 'Manage Inference endpoints' to 'Inference Managem…
Browse files Browse the repository at this point in the history
…ent view' (#189241)

This PR resolves elastic/search-team#7978

Currently, 'Manage inference endpoints' is redirected to the trained
models page. In this task, we need to change the link to 'Inference
Endpoints' page.
  • Loading branch information
saikatsarkar056 authored Jul 30, 2024
1 parent a35f773 commit 21c4b2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ const mockDispatch = jest.fn();

jest.mock('../../../public/application/app_context', () => ({
useAppContext: jest.fn().mockReturnValue({
core: { application: {} },
core: {
application: {},
http: {
basePath: {
get: jest.fn().mockReturnValue('/base-path'),
},
},
},
docLinks: {
links: {
enterpriseSearch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,13 @@ const SelectInferenceIdContent: React.FC<SelectInferenceIdContentProps> = ({
value,
}) => {
const {
core: { application },
core: { application, http },
docLinks,
plugins: { ml },
} = useAppContext();
const config = getFieldConfig('inference_id');

const getMlTrainedModelPageUrl = useCallback(async () => {
return await ml?.locator?.getUrl({
page: 'trained_models',
});
}, [ml]);
const inferenceEndpointsPageLink = `${http.basePath.get()}/app/enterprise_search/relevance/inference_endpoints`;

const [isInferenceFlyoutVisible, setIsInferenceFlyoutVisible] = useState<boolean>(false);
const [availableTrainedModels, setAvailableTrainedModels] = useState<
Expand Down Expand Up @@ -250,10 +246,7 @@ const SelectInferenceIdContent: React.FC<SelectInferenceIdContentProps> = ({
size="s"
data-test-subj="manageInferenceEndpointButton"
onClick={async () => {
const mlTrainedPageUrl = await getMlTrainedModelPageUrl();
if (typeof mlTrainedPageUrl === 'string') {
application.navigateToUrl(mlTrainedPageUrl);
}
application.navigateToUrl(inferenceEndpointsPageLink);
}}
>
{i18n.translate(
Expand Down

0 comments on commit 21c4b2e

Please sign in to comment.