Skip to content

Commit

Permalink
Disabling try again button while model is still deploying
Browse files Browse the repository at this point in the history
  • Loading branch information
Samiul-TheSoccerFan committed Oct 30, 2024
1 parent 7d673b8 commit 518a96e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
}
>
<EuiModalHeader>
<EuiModalHeaderTitle title={modalTitleId}>
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 518a96e

Please sign in to comment.