diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/trained_models_deployment_modal.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/trained_models_deployment_modal.test.tsx index 0ba8ca201d40d..528a7f167f1c1 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/trained_models_deployment_modal.test.tsx +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/trained_models_deployment_modal.test.tsx @@ -173,11 +173,8 @@ describe('When semantic_text is enabled', () => { ); }); - it('should call saveMappings if refresh button is pressed', async () => { - await act(async () => { - find('tryAgainModalButton').simulate('click'); - }); - expect(saveMappings.mock.calls).toHaveLength(1); + it('should disable the try again button', () => { + expect(find('tryAgainModalButton').props().disabled).toBe(true); }); it('should disable the force save mappings button if checkbox is not checked', async () => { expect(find('forceSaveMappingsButton').props().disabled).toBe(true); diff --git a/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/trained_models_deployment_modal.tsx b/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/trained_models_deployment_modal.tsx index b2e9a1339c3fb..5d8672ea0d24a 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/trained_models_deployment_modal.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/trained_models_deployment_modal.tsx @@ -155,7 +155,9 @@ export function TrainedModelsDeploymentModal({ aria-labelledby={modalTitleId} onClose={closeModal} data-test-subj="trainedModelsDeploymentModal" - initialFocus="[data-test-subj=tryAgainModalButton]" + initialFocus={ + erroredDeployments.length === 0 ? undefined : '[data-test-subj=tryAgainModalButton]' + } > @@ -260,6 +262,7 @@ export function TrainedModelsDeploymentModal({ onClick={saveMappings} data-test-subj="tryAgainModalButton" isLoading={saveMappingsLoading} + disabled={erroredDeployments.length === 0} > {i18n.translate( 'xpack.idxMgmt.indexDetails.trainedModelsDeploymentModal.tryAgainButtonLabel',