diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_action_status.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_action_status.test.tsx index a2e9c7c7c55fa..d8c320a3c101c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_action_status.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_action_status.test.tsx @@ -82,7 +82,23 @@ describe('useActionStatus', () => { }); expect(mockSendPostCancelAction).toHaveBeenCalledWith('action1'); expect(mockOnAbortSuccess).toHaveBeenCalled(); - expect(mockOpenConfirm).toHaveBeenCalledWith('This action will abort upgrade of 1 agents', { + expect(mockOpenConfirm).toHaveBeenCalledWith('This action will abort upgrade of 1 agent', { + title: 'Abort upgrade?', + }); + }); + + it('should post abort and invoke callback on abort upgrade - plural', async () => { + mockSendPostCancelAction.mockResolvedValue({}); + let result: any | undefined; + await act(async () => { + ({ result } = renderHook(() => useActionStatus(mockOnAbortSuccess, false))); + }); + await act(async () => { + await result.current.abortUpgrade({ ...mockActionStatuses[0], nbAgentsAck: 0 }); + }); + expect(mockSendPostCancelAction).toHaveBeenCalledWith('action1'); + expect(mockOnAbortSuccess).toHaveBeenCalled(); + expect(mockOpenConfirm).toHaveBeenCalledWith('This action will abort upgrade of 2 agents', { title: 'Abort upgrade?', }); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_action_status.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_action_status.tsx index bc8e20b17ee00..3a6e1b2e54292 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_action_status.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_action_status.tsx @@ -54,7 +54,8 @@ export function useActionStatus(onAbortSuccess: () => void, refreshAgentActivity try { const confirmRes = await overlays.openConfirm( i18n.translate('xpack.fleet.currentUpgrade.confirmDescription', { - defaultMessage: 'This action will abort upgrade of {nbAgents} agents', + defaultMessage: + 'This action will abort upgrade of {nbAgents, plural, one {# agent} other {# agents}}', values: { nbAgents: action.nbAgentsActioned - action.nbAgentsAck, }, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_update_tags.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_update_tags.test.tsx index d5d72c3deaeeb..89059d5a17971 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_update_tags.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_update_tags.test.tsx @@ -45,7 +45,7 @@ describe('useUpdateTags', () => { await act(() => result.current.updateTags('agent1', ['tag1'], mockOnSuccess)); expect(mockOnSuccess).toHaveBeenCalled(); expect(useStartServices().notifications.toasts.addSuccess as jest.Mock).toHaveBeenCalledWith( - 'Tags updated' + 'Tag(s) updated' ); }); @@ -57,7 +57,7 @@ describe('useUpdateTags', () => { expect(mockOnSuccess).not.toHaveBeenCalled(); expect(useStartServices().notifications.toasts.addError as jest.Mock).toHaveBeenCalledWith( 'error', - { title: 'Tags update failed' } + { title: 'Tag(s) update failed' } ); }); @@ -68,7 +68,7 @@ describe('useUpdateTags', () => { await act(() => result.current.bulkUpdateTags('query', ['tag1'], [], mockOnSuccess)); expect(mockOnSuccess).toHaveBeenCalled(); expect(useStartServices().notifications.toasts.addSuccess as jest.Mock).toHaveBeenCalledWith( - 'Tags updated' + 'Tag(s) updated' ); }); @@ -80,7 +80,7 @@ describe('useUpdateTags', () => { expect(mockOnSuccess).not.toHaveBeenCalled(); expect(useStartServices().notifications.toasts.addError as jest.Mock).toHaveBeenCalledWith( 'error', - { title: 'Tags update failed' } + { title: 'Tag(s) update failed' } ); }); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_update_tags.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_update_tags.tsx index 969b9caa4d02f..96e619db12f09 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_update_tags.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/hooks/use_update_tags.tsx @@ -34,7 +34,7 @@ export const useUpdateTags = () => { const message = successMessage ?? i18n.translate('xpack.fleet.updateAgentTags.successNotificationTitle', { - defaultMessage: 'Tags updated', + defaultMessage: 'Tag(s) updated', }); notifications.toasts.addSuccess(message); @@ -43,7 +43,7 @@ export const useUpdateTags = () => { const errorTitle = errorMessage ?? i18n.translate('xpack.fleet.updateAgentTags.errorNotificationTitle', { - defaultMessage: 'Tags update failed', + defaultMessage: 'Tag(s) update failed', }); notifications.toasts.addError(error, { title: errorTitle }); }