diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts index 7ef5984960e26..146f31eab8a97 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts @@ -55,7 +55,7 @@ const MOCK_CLIENT_DATA = crawlerDataServerToClient(MOCK_SERVER_DATA); describe('CrawlerOverviewLogic', () => { const { mount } = new LogicMounter(CrawlerOverviewLogic); const { http } = mockHttpValues; - const { flashAPIErrors, setSuccessMessage } = mockFlashMessageHelpers; + const { flashAPIErrors, flashSuccessToast } = mockFlashMessageHelpers; beforeEach(() => { jest.clearAllMocks(); @@ -138,7 +138,7 @@ describe('CrawlerOverviewLogic', () => { expect(CrawlerOverviewLogic.actions.onReceiveCrawlerData).toHaveBeenCalledWith( MOCK_CLIENT_DATA ); - expect(setSuccessMessage).toHaveBeenCalled(); + expect(flashSuccessToast).toHaveBeenCalled(); }); it('calls flashApiErrors when there is an error', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts index dceb4e205487d..3f64cbbd9a866 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts @@ -9,7 +9,7 @@ import { kea, MakeLogicType } from 'kea'; import { i18n } from '@kbn/i18n'; -import { flashAPIErrors, setSuccessMessage } from '../../../shared/flash_messages'; +import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { EngineLogic } from '../engine'; @@ -21,7 +21,7 @@ export const DELETE_DOMAIN_MESSAGE = (domainUrl: string) => i18n.translate( 'xpack.enterpriseSearch.appSearch.crawler.domainsTable.action.delete.successMessage', { - defaultMessage: 'Successfully deleted "{domainUrl}"', + defaultMessage: "Domain '{domainUrl}' was deleted", values: { domainUrl, }, @@ -90,7 +90,7 @@ export const CrawlerOverviewLogic = kea< ); const crawlerData = crawlerDataServerToClient(response); actions.onReceiveCrawlerData(crawlerData); - setSuccessMessage(DELETE_DOMAIN_MESSAGE(domain.url)); + flashSuccessToast(DELETE_DOMAIN_MESSAGE(domain.url)); } catch (e) { flashAPIErrors(e); } diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/constants.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/constants.ts index 0fb118548a67b..6a5f3df0e86f6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/constants.ts @@ -20,15 +20,21 @@ export enum ApiTokenTypes { Search = 'search', } -export const CREATE_MESSAGE = i18n.translate('xpack.enterpriseSearch.appSearch.tokens.created', { - defaultMessage: 'Successfully created key.', -}); -export const UPDATE_MESSAGE = i18n.translate('xpack.enterpriseSearch.appSearch.tokens.update', { - defaultMessage: 'Successfully updated API Key.', -}); -export const DELETE_MESSAGE = i18n.translate('xpack.enterpriseSearch.appSearch.tokens.deleted', { - defaultMessage: 'Successfully deleted key.', -}); +export const CREATE_MESSAGE = (name: string) => + i18n.translate('xpack.enterpriseSearch.appSearch.tokens.created', { + defaultMessage: "API key '{name}' was created", + values: { name }, + }); +export const UPDATE_MESSAGE = (name: string) => + i18n.translate('xpack.enterpriseSearch.appSearch.tokens.update', { + defaultMessage: "API key '{name}' was updated", + values: { name }, + }); +export const DELETE_MESSAGE = (name: string) => + i18n.translate('xpack.enterpriseSearch.appSearch.tokens.deleted', { + defaultMessage: "API key '{name}' was deleted", + values: { name }, + }); export const SEARCH_DISPLAY = i18n.translate( 'xpack.enterpriseSearch.appSearch.tokens.permissions.display.search', diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts index 7192488e49746..a12c174b9478c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts @@ -31,7 +31,7 @@ import { CredentialsLogic } from './credentials_logic'; describe('CredentialsLogic', () => { const { mount } = new LogicMounter(CredentialsLogic); const { http } = mockHttpValues; - const { clearFlashMessages, setSuccessMessage, flashAPIErrors } = mockFlashMessageHelpers; + const { clearFlashMessages, flashSuccessToast, flashAPIErrors } = mockFlashMessageHelpers; const DEFAULT_VALUES = { activeApiToken: { @@ -1110,7 +1110,7 @@ describe('CredentialsLogic', () => { await nextTick(); expect(CredentialsLogic.actions.fetchCredentials).toHaveBeenCalled(); - expect(setSuccessMessage).toHaveBeenCalled(); + expect(flashSuccessToast).toHaveBeenCalled(); }); it('handles errors', async () => { @@ -1142,7 +1142,7 @@ describe('CredentialsLogic', () => { }); await nextTick(); expect(CredentialsLogic.actions.onApiTokenCreateSuccess).toHaveBeenCalledWith(createdToken); - expect(setSuccessMessage).toHaveBeenCalled(); + expect(flashSuccessToast).toHaveBeenCalled(); }); it('calls a PUT endpoint that updates the active token if it already exists', async () => { @@ -1169,7 +1169,7 @@ describe('CredentialsLogic', () => { }); await nextTick(); expect(CredentialsLogic.actions.onApiTokenUpdateSuccess).toHaveBeenCalledWith(updatedToken); - expect(setSuccessMessage).toHaveBeenCalled(); + expect(flashSuccessToast).toHaveBeenCalled(); }); it('handles errors', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.ts index 2841282704189..60282bc0a3316 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.ts @@ -11,7 +11,7 @@ import { Meta } from '../../../../../common/types'; import { DEFAULT_META } from '../../../shared/constants'; import { clearFlashMessages, - setSuccessMessage, + flashSuccessToast, flashAPIErrors, } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; @@ -261,7 +261,7 @@ export const CredentialsLogic = kea({ await http.delete(`/api/app_search/credentials/${tokenName}`); actions.fetchCredentials(); - setSuccessMessage(DELETE_MESSAGE); + flashSuccessToast(DELETE_MESSAGE(tokenName)); } catch (e) { flashAPIErrors(e); } @@ -289,11 +289,11 @@ export const CredentialsLogic = kea({ if (id) { const response = await http.put(`/api/app_search/credentials/${name}`, { body }); actions.onApiTokenUpdateSuccess(response); - setSuccessMessage(UPDATE_MESSAGE); + flashSuccessToast(UPDATE_MESSAGE(name)); } else { const response = await http.post('/api/app_search/credentials', { body }); actions.onApiTokenCreateSuccess(response); - setSuccessMessage(CREATE_MESSAGE); + flashSuccessToast(CREATE_MESSAGE(name)); } } catch (e) { flashAPIErrors(e); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/constants.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/constants.ts index c490910184a69..f8c3e3efdbc1d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/constants.ts @@ -40,7 +40,7 @@ export const DELETE_MESSAGE = i18n.translate( ); export const SUCCESS_MESSAGE = i18n.translate( 'xpack.enterpriseSearch.appSearch.engine.curations.deleteSuccessMessage', - { defaultMessage: 'Successfully removed curation.' } + { defaultMessage: 'Your curation was deleted' } ); export const RESTORE_CONFIRMATION = i18n.translate( 'xpack.enterpriseSearch.appSearch.engine.curations.restoreConfirmation', diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts index f00f744f730ab..9268da8eb02b5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts @@ -23,7 +23,7 @@ describe('CurationsLogic', () => { const { mount } = new LogicMounter(CurationsLogic); const { http } = mockHttpValues; const { navigateToUrl } = mockKibanaValues; - const { clearFlashMessages, setSuccessMessage, flashAPIErrors } = mockFlashMessageHelpers; + const { clearFlashMessages, flashSuccessToast, flashAPIErrors } = mockFlashMessageHelpers; const MOCK_CURATIONS_RESPONSE = { meta: { @@ -154,7 +154,7 @@ describe('CurationsLogic', () => { '/api/app_search/engines/some-engine/curations/some-curation-id' ); expect(CurationsLogic.actions.loadCurations).toHaveBeenCalled(); - expect(setSuccessMessage).toHaveBeenCalledWith('Successfully removed curation.'); + expect(flashSuccessToast).toHaveBeenCalledWith('Your curation was deleted'); }); it('handles errors', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.ts index f4916f54fbc22..89d170a83a4c8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.ts @@ -11,7 +11,7 @@ import { Meta } from '../../../../../common/types'; import { DEFAULT_META } from '../../../shared/constants'; import { clearFlashMessages, - setSuccessMessage, + flashSuccessToast, flashAPIErrors, } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; @@ -95,7 +95,7 @@ export const CurationsLogic = kea { const { mount } = new LogicMounter(DocumentDetailLogic); const { http } = mockHttpValues; const { navigateToUrl } = mockKibanaValues; - const { setQueuedSuccessMessage, flashAPIErrors } = mockFlashMessageHelpers; + const { flashSuccessToast, flashAPIErrors } = mockFlashMessageHelpers; const DEFAULT_VALUES = { dataLoading: true, @@ -101,9 +101,9 @@ describe('DocumentDetailLogic', () => { expect(http.delete).toHaveBeenCalledWith('/api/app_search/engines/engine1/documents/1'); await nextTick(); - expect(setQueuedSuccessMessage).toHaveBeenCalledWith( - 'Successfully marked document for deletion. It will be deleted momentarily.' - ); + expect(flashSuccessToast).toHaveBeenCalledWith('Your document was marked for deletion', { + text: 'It will be deleted momentarily.', + }); expect(navigateToUrl).toHaveBeenCalledWith('/engines/engine1/documents'); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.ts index 17c2c788523d0..c7a68ec0f8131 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.ts @@ -9,7 +9,7 @@ import { kea, MakeLogicType } from 'kea'; import { i18n } from '@kbn/i18n'; -import { flashAPIErrors, setQueuedSuccessMessage } from '../../../shared/flash_messages'; +import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { KibanaLogic } from '../../../shared/kibana'; @@ -79,19 +79,20 @@ export const DocumentDetailLogic = kea({ 'xpack.enterpriseSearch.appSearch.documentDetail.confirmDelete', { defaultMessage: 'Are you sure you want to delete this document?' } ); - const DELETE_SUCCESS = i18n.translate( + const DELETE_SUCCESS_TITLE = i18n.translate( 'xpack.enterpriseSearch.appSearch.documentDetail.deleteSuccess', - { - defaultMessage: - 'Successfully marked document for deletion. It will be deleted momentarily.', - } + { defaultMessage: 'Your document was marked for deletion' } + ); + const DELETE_SUCCESS_TEXT = i18n.translate( + 'xpack.enterpriseSearch.appSearch.documentDetail.deleteSuccessDescription', + { defaultMessage: 'It will be deleted momentarily.' } ); if (window.confirm(CONFIRM_DELETE)) { try { const { http } = HttpLogic.values; await http.delete(`/api/app_search/engines/${engineName}/documents/${documentId}`); - setQueuedSuccessMessage(DELETE_SUCCESS); + flashSuccessToast(DELETE_SUCCESS_TITLE, { text: DELETE_SUCCESS_TEXT }); navigateToUrl(generateEnginePath(ENGINE_DOCUMENTS_PATH)); } catch (e) { flashAPIErrors(e); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/constants.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/constants.ts index 0647eeba78786..1f28be2282562 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/constants.ts @@ -65,12 +65,11 @@ export const ENGINE_CREATION_FORM_SUBMIT_BUTTON_LABEL = i18n.translate( } ); -export const ENGINE_CREATION_SUCCESS_MESSAGE = i18n.translate( - 'xpack.enterpriseSearch.appSearch.engineCreation.successMessage', - { - defaultMessage: 'Successfully created engine.', - } -); +export const ENGINE_CREATION_SUCCESS_MESSAGE = (name: string) => + i18n.translate('xpack.enterpriseSearch.appSearch.engineCreation.successMessage', { + defaultMessage: "Engine '{name}' was created", + values: { name }, + }); export const SUPPORTED_LANGUAGES = [ { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts index 1e87b3ef21f03..2001ac3646e5f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts @@ -20,7 +20,7 @@ describe('EngineCreationLogic', () => { const { mount } = new LogicMounter(EngineCreationLogic); const { http } = mockHttpValues; const { navigateToUrl } = mockKibanaValues; - const { setQueuedSuccessMessage, flashAPIErrors } = mockFlashMessageHelpers; + const { flashSuccessToast, flashAPIErrors } = mockFlashMessageHelpers; const DEFAULT_VALUES = { isLoading: false, @@ -99,8 +99,8 @@ describe('EngineCreationLogic', () => { jest.clearAllMocks(); }); - it('should set a success message', () => { - expect(setQueuedSuccessMessage).toHaveBeenCalledWith('Successfully created engine.'); + it('should show a success message', () => { + expect(flashSuccessToast).toHaveBeenCalledWith("Engine 'test' was created"); }); it('should navigate the user to the engine page', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts index 844cd8fb4088a..4e41cdf4c3949 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts @@ -9,7 +9,7 @@ import { generatePath } from 'react-router-dom'; import { kea, MakeLogicType } from 'kea'; -import { flashAPIErrors, setQueuedSuccessMessage } from '../../../shared/flash_messages'; +import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { KibanaLogic } from '../../../shared/kibana'; import { ENGINE_PATH } from '../../routes'; @@ -85,7 +85,7 @@ export const EngineCreationLogic = kea i18n.translate( 'xpack.enterpriseSearch.appSearch.enginesOverview.table.action.delete.successMessage', { - defaultMessage: 'Successfully deleted "{engineName}"', + defaultMessage: "Engine '{engineName}' was deleted", values: { engineName, }, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts index eb95d1ce148da..c699f6cf2eb43 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts @@ -22,7 +22,7 @@ import { EnginesLogic } from './'; describe('EnginesLogic', () => { const { mount } = new LogicMounter(EnginesLogic); const { http } = mockHttpValues; - const { flashAPIErrors, setSuccessMessage } = mockFlashMessageHelpers; + const { flashAPIErrors, flashSuccessToast } = mockFlashMessageHelpers; const DEFAULT_VALUES = { dataLoading: true, @@ -199,10 +199,10 @@ describe('EnginesLogic', () => { mount(); }); - it('should call setSuccessMessage', () => { + it('should call flashSuccessToast', () => { EnginesLogic.actions.onDeleteEngineSuccess(MOCK_ENGINE); - expect(setSuccessMessage).toHaveBeenCalled(); + expect(flashSuccessToast).toHaveBeenCalled(); }); it('should call loadEngines if engine.type === default', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.ts index 36c31f9891f6e..a33f317d71e52 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.ts @@ -9,7 +9,7 @@ import { kea, MakeLogicType } from 'kea'; import { Meta } from '../../../../../common/types'; import { DEFAULT_META } from '../../../shared/constants'; -import { flashAPIErrors, setSuccessMessage } from '../../../shared/flash_messages'; +import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { updateMetaPageIndex } from '../../../shared/table_pagination'; @@ -141,7 +141,7 @@ export const EnginesLogic = kea>({ actions.onMetaEnginesLoad(response); }, onDeleteEngineSuccess: async ({ engine }) => { - setSuccessMessage(DELETE_ENGINE_MESSAGE(engine.name)); + flashSuccessToast(DELETE_ENGINE_MESSAGE(engine.name)); if ([EngineTypes.default, EngineTypes.indexed].includes(engine.type)) { actions.loadEngines(); } else if (engine.type === EngineTypes.meta) { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/constants.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/constants.tsx index aff5942d497a8..9659fa3f2dfc0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/constants.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/constants.tsx @@ -111,9 +111,8 @@ export const META_ENGINE_CREATION_FORM_MAX_SOURCE_ENGINES_WARNING_TITLE = ( } ); -export const META_ENGINE_CREATION_SUCCESS_MESSAGE = i18n.translate( - 'xpack.enterpriseSearch.appSearch.metaEngineCreation.successMessage', - { - defaultMessage: 'Successfully created meta engine.', - } -); +export const META_ENGINE_CREATION_SUCCESS_MESSAGE = (name: string) => + i18n.translate('xpack.enterpriseSearch.appSearch.metaEngineCreation.successMessage', { + defaultMessage: "Meta engine '{name}' was created", + values: { name }, + }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts index 137a8afc5c4fe..6434e8a7df99a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts @@ -20,7 +20,7 @@ describe('MetaEngineCreationLogic', () => { const { mount } = new LogicMounter(MetaEngineCreationLogic); const { http } = mockHttpValues; const { navigateToUrl } = mockKibanaValues; - const { setQueuedSuccessMessage, flashAPIErrors } = mockFlashMessageHelpers; + const { flashSuccessToast, flashAPIErrors } = mockFlashMessageHelpers; const DEFAULT_VALUES = { isLoading: false, @@ -152,8 +152,8 @@ describe('MetaEngineCreationLogic', () => { MetaEngineCreationLogic.actions.onEngineCreationSuccess(); }); - it('should set a success message', () => { - expect(setQueuedSuccessMessage).toHaveBeenCalledWith('Successfully created meta engine.'); + it('should show a success message', () => { + expect(flashSuccessToast).toHaveBeenCalledWith("Meta engine 'test' was created"); }); it('should navigate the user to the engine page', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts index 472a0dee12b7f..4df3bc4bff162 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts @@ -11,7 +11,7 @@ import { kea, MakeLogicType } from 'kea'; import { Meta } from '../../../../../common/types'; import { DEFAULT_META } from '../../../shared/constants'; -import { flashAPIErrors, setQueuedSuccessMessage } from '../../../shared/flash_messages'; +import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { KibanaLogic } from '../../../shared/kibana'; import { ENGINE_PATH } from '../../routes'; @@ -113,7 +113,7 @@ export const MetaEngineCreationLogic = kea< const { navigateToUrl } = KibanaLogic.values; const enginePath = generatePath(ENGINE_PATH, { engineName: name }); - setQueuedSuccessMessage(META_ENGINE_CREATION_SUCCESS_MESSAGE); + flashSuccessToast(META_ENGINE_CREATION_SUCCESS_MESSAGE(name)); navigateToUrl(enginePath); }, submitEngine: async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/constants.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/constants.ts index 796bc9242dd98..105ab8b9618b5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/constants.ts @@ -27,16 +27,22 @@ export const RELEVANCE_TUNING_TITLE = i18n.translate( export const UPDATE_SUCCESS_MESSAGE = i18n.translate( 'xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.updateSuccess', { - defaultMessage: 'Relevance successfully tuned. The changes will impact your results shortly.', + defaultMessage: 'Relevance was tuned', } ); export const DELETE_SUCCESS_MESSAGE = i18n.translate( 'xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.deleteSuccess', { - defaultMessage: - 'Relevance has been reset to default values. The change will impact your results shortly.', + defaultMessage: 'Relevance was reset to default values', } ); +export const SUCCESS_CHANGES_MESSAGE = i18n.translate( + 'xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.successDescription', + { + defaultMessage: 'The changes will impact your results shortly.', + } +); + export const RESET_CONFIRMATION_MESSAGE = i18n.translate( 'xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.resetConfirmation', { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts index 1d143ed0ca938..8cb5b3b35d97c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts @@ -229,7 +229,7 @@ describe('RelevanceTuningLogic', () => { describe('listeners', () => { const { http } = mockHttpValues; - const { flashAPIErrors, setSuccessMessage, clearFlashMessages } = mockFlashMessageHelpers; + const { flashAPIErrors, flashSuccessToast, clearFlashMessages } = mockFlashMessageHelpers; let scrollToSpy: jest.SpyInstance; let confirmSpy: jest.SpyInstance; @@ -521,9 +521,9 @@ describe('RelevanceTuningLogic', () => { body: JSON.stringify(searchSettingsWithoutNewBoostProp), } ); - expect(setSuccessMessage).toHaveBeenCalledWith( - 'Relevance successfully tuned. The changes will impact your results shortly.' - ); + expect(flashSuccessToast).toHaveBeenCalledWith('Relevance was tuned', { + text: 'The changes will impact your results shortly.', + }); expect(RelevanceTuningLogic.actions.onSearchSettingsSuccess).toHaveBeenCalledWith( searchSettingsWithoutNewBoostProp ); @@ -577,9 +577,9 @@ describe('RelevanceTuningLogic', () => { expect(http.post).toHaveBeenCalledWith( '/api/app_search/engines/test-engine/search_settings/reset' ); - expect(setSuccessMessage).toHaveBeenCalledWith( - 'Relevance has been reset to default values. The change will impact your results shortly.' - ); + expect(flashSuccessToast).toHaveBeenCalledWith('Relevance was reset to default values', { + text: 'The changes will impact your results shortly.', + }); expect(RelevanceTuningLogic.actions.onSearchSettingsSuccess).toHaveBeenCalledWith( searchSettings ); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.ts index b3c795d14b8e1..00896c923616b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.ts @@ -9,7 +9,7 @@ import { kea, MakeLogicType } from 'kea'; import { omit, cloneDeep, isEmpty } from 'lodash'; import { - setSuccessMessage, + flashSuccessToast, flashAPIErrors, clearFlashMessages, } from '../../../shared/flash_messages'; @@ -24,6 +24,7 @@ import { RESET_CONFIRMATION_MESSAGE, DELETE_SUCCESS_MESSAGE, DELETE_CONFIRMATION_MESSAGE, + SUCCESS_CHANGES_MESSAGE, BOOST_TYPE_TO_EMPTY_BOOST, } from './constants'; import { Boost, BoostFunction, BoostOperation, BoostType, SearchSettings } from './types'; @@ -304,7 +305,7 @@ export const RelevanceTuningLogic = kea< const response = await http.put(url, { body: JSON.stringify(removeBoostStateProps(values.searchSettings)), }); - setSuccessMessage(UPDATE_SUCCESS_MESSAGE); + flashSuccessToast(UPDATE_SUCCESS_MESSAGE, { text: SUCCESS_CHANGES_MESSAGE }); actions.onSearchSettingsSuccess(response); } catch (e) { flashAPIErrors(e); @@ -326,7 +327,7 @@ export const RelevanceTuningLogic = kea< try { const response = await http.post(url); - setSuccessMessage(DELETE_SUCCESS_MESSAGE); + flashSuccessToast(DELETE_SUCCESS_MESSAGE, { text: SUCCESS_CHANGES_MESSAGE }); actions.onSearchSettingsSuccess(response); } catch (e) { flashAPIErrors(e); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.ts index e7ac94e9f9d2d..13530c2c29ef0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.ts @@ -10,7 +10,7 @@ import { omit, isEqual } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { flashAPIErrors, setSuccessMessage } from '../../../shared/flash_messages'; +import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { Schema, SchemaConflicts } from '../../../shared/schema/types'; import { EngineLogic } from '../engine'; @@ -333,11 +333,11 @@ export const ResultSettingsLogic = kea { const { http } = mockHttpValues; - const { clearFlashMessages, flashAPIErrors, setSuccessMessage } = mockFlashMessageHelpers; + const { clearFlashMessages, flashAPIErrors, flashSuccessToast } = mockFlashMessageHelpers; const { mount } = new LogicMounter(RoleMappingsLogic); const DEFAULT_VALUES = { attributes: [], @@ -519,7 +519,7 @@ describe('RoleMappingsLogic', () => { await nextTick(); expect(initializeRoleMappingsSpy).toHaveBeenCalled(); - expect(setSuccessMessage).toHaveBeenCalled(); + expect(flashSuccessToast).toHaveBeenCalled(); }); it('sends array when "accessAllEngines" is false', () => { @@ -670,7 +670,7 @@ describe('RoleMappingsLogic', () => { await nextTick(); expect(initializeRoleMappingsSpy).toHaveBeenCalled(); - expect(setSuccessMessage).toHaveBeenCalled(); + expect(flashSuccessToast).toHaveBeenCalled(); }); it('handles error', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.ts index fb574a3588989..8647f4f1df357 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.ts @@ -10,7 +10,7 @@ import { kea, MakeLogicType } from 'kea'; import { clearFlashMessages, flashAPIErrors, - setSuccessMessage, + flashSuccessToast, } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { @@ -396,7 +396,7 @@ export const RoleMappingsLogic = kea { const { mount } = new LogicMounter(SampleEngineCreationCtaLogic); const { http } = mockHttpValues; const { navigateToUrl } = mockKibanaValues; - const { setQueuedSuccessMessage, flashAPIErrors } = mockFlashMessageHelpers; + const { flashSuccessToast, flashAPIErrors } = mockFlashMessageHelpers; const DEFAULT_VALUES = { isLoading: false, @@ -82,10 +82,10 @@ describe('SampleEngineCreationCtaLogic', () => { }); }); - it('onSampleEngineCreationSuccess should set a success message and navigate the user to the engine page', () => { + it('onSampleEngineCreationSuccess should show a success message and navigate the user to the engine page', () => { SampleEngineCreationCtaLogic.actions.onSampleEngineCreationSuccess(); - expect(setQueuedSuccessMessage).toHaveBeenCalledWith('Successfully created engine.'); + expect(flashSuccessToast).toHaveBeenCalledWith("Engine 'national-parks-demo' was created"); expect(navigateToUrl).toHaveBeenCalledWith('/engines/national-parks-demo'); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.ts index 37570d4e3cfe7..bea85ea4fb3a5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.ts @@ -9,7 +9,7 @@ import { generatePath } from 'react-router-dom'; import { kea, MakeLogicType } from 'kea'; -import { flashAPIErrors, setQueuedSuccessMessage } from '../../../shared/flash_messages'; +import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { KibanaLogic } from '../../../shared/kibana'; import { ENGINE_PATH } from '../../routes'; @@ -65,7 +65,7 @@ export const SampleEngineCreationCtaLogic = kea< const { navigateToUrl } = KibanaLogic.values; const enginePath = generatePath(ENGINE_PATH, { engineName: 'national-parks-demo' }); - setQueuedSuccessMessage(ENGINE_CREATION_SUCCESS_MESSAGE); + flashSuccessToast(ENGINE_CREATION_SUCCESS_MESSAGE('national-parks-demo')); navigateToUrl(enginePath); }, }), diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/i18n.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/i18n.ts index 4e3f4f81d5a9f..66421f218a44f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/i18n.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/i18n.ts @@ -37,7 +37,7 @@ export const ADD_SOURCE_ENGINES_SUCCESS_MESSAGE = (sourceEngineNames: string[]) 'xpack.enterpriseSearch.appSearch.engine.souceEngines.addSourceEnginesSuccessMessage', { defaultMessage: - '{sourceEnginesCount, plural, one {# engine has} other {# engines have}} been added to this meta engine.', + '{sourceEnginesCount, plural, one {# engine was} other {# engines were}} added to this meta engine', values: { sourceEnginesCount: sourceEngineNames.length }, } ); @@ -61,7 +61,7 @@ export const REMOVE_SOURCE_ENGINE_SUCCESS_MESSAGE = (engineName: string) => i18n.translate( 'xpack.enterpriseSearch.appSearch.engine.souceEngines.removeSourceEngineSuccessMessage', { - defaultMessage: 'Engine {engineName} has been removed from this meta engine.', + defaultMessage: "Engine '{engineName}' was removed from this meta engine", values: { engineName }, } ); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts index c39a25276a43c..eababb9d93c58 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts @@ -23,7 +23,7 @@ import { SourceEnginesLogic } from './source_engines_logic'; describe('SourceEnginesLogic', () => { const { http } = mockHttpValues; const { mount } = new LogicMounter(SourceEnginesLogic); - const { flashAPIErrors, setSuccessMessage } = mockFlashMessageHelpers; + const { flashAPIErrors, flashSuccessToast } = mockFlashMessageHelpers; const DEFAULT_VALUES = { dataLoading: true, @@ -292,8 +292,8 @@ describe('SourceEnginesLogic', () => { { name: 'source-engine-3' }, { name: 'source-engine-4' }, ]); - expect(setSuccessMessage).toHaveBeenCalledWith( - '2 engines have been added to this meta engine.' + expect(flashSuccessToast).toHaveBeenCalledWith( + '2 engines were added to this meta engine' ); }); @@ -352,8 +352,8 @@ describe('SourceEnginesLogic', () => { SourceEnginesLogic.actions.removeSourceEngine('source-engine-2'); await nextTick(); - expect(setSuccessMessage).toHaveBeenCalledWith( - 'Engine source-engine-2 has been removed from this meta engine.' + expect(flashSuccessToast).toHaveBeenCalledWith( + "Engine 'source-engine-2' was removed from this meta engine" ); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.ts index c10f11a7de327..21ae24357bcea 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.ts @@ -7,7 +7,7 @@ import { kea, MakeLogicType } from 'kea'; -import { flashAPIErrors, setSuccessMessage } from '../../../shared/flash_messages'; +import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { recursivelyFetchEngines } from '../../utils/recursively_fetch_engines'; import { EngineLogic } from '../engine'; @@ -143,7 +143,7 @@ export const SourceEnginesLogic = kea< ); actions.onSourceEnginesAdd(sourceEnginesToAdd); - setSuccessMessage(ADD_SOURCE_ENGINES_SUCCESS_MESSAGE(sourceEngineNames)); + flashSuccessToast(ADD_SOURCE_ENGINES_SUCCESS_MESSAGE(sourceEngineNames)); EngineLogic.actions.initializeEngine(); } catch (e) { flashAPIErrors(e); @@ -176,7 +176,7 @@ export const SourceEnginesLogic = kea< ); actions.onSourceEngineRemove(sourceEngineName); - setSuccessMessage(REMOVE_SOURCE_ENGINE_SUCCESS_MESSAGE(sourceEngineName)); + flashSuccessToast(REMOVE_SOURCE_ENGINE_SUCCESS_MESSAGE(sourceEngineName)); // Changing source engines can change schema conflicts and invalid boosts, // so we re-initialize the engine to re-fetch that data diff --git a/x-pack/plugins/enterprise_search/public/applications/index.tsx b/x-pack/plugins/enterprise_search/public/applications/index.tsx index 414957656467a..e6acb7f176ee5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/index.tsx @@ -20,7 +20,7 @@ import { InitialAppData } from '../../common/types'; import { PluginsStart, ClientConfigType, ClientData } from '../plugin'; import { externalUrl } from './shared/enterprise_search_url'; -import { mountFlashMessagesLogic } from './shared/flash_messages'; +import { mountFlashMessagesLogic, Toasts } from './shared/flash_messages'; import { mountHttpLogic } from './shared/http'; import { mountKibanaLogic } from './shared/kibana'; import { mountLicensingLogic } from './shared/licensing'; @@ -71,6 +71,7 @@ export const renderApp = ( + , diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.test.tsx index 6f4f3853fa8c9..757e5509773ac 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.test.tsx @@ -13,88 +13,76 @@ import { shallow } from 'enzyme'; import { EuiCallOut, EuiGlobalToastList } from '@elastic/eui'; -import { FlashMessages, Callouts, Toasts } from './flash_messages'; +import { FlashMessages, Toasts } from './flash_messages'; describe('FlashMessages', () => { - beforeEach(() => { - jest.clearAllMocks(); - }); + it('renders an array of callouts', () => { + const mockMessages = [ + { type: 'success', message: 'Hello world!!' }, + { + type: 'error', + message: 'Whoa nelly!', + description:
Something went wrong
, + }, + { type: 'info', message: 'Everything is fine, nothing is ruined' }, + { type: 'warning', message: 'Uh oh' }, + { type: 'info', message: 'Testing multiples of same type' }, + ]; + setMockValues({ messages: mockMessages }); - it('renders callout and toast flash messages', () => { const wrapper = shallow(); - expect(wrapper.find(Callouts)).toHaveLength(1); - expect(wrapper.find(Toasts)).toHaveLength(1); - }); - - describe('callouts', () => { - it('renders an array of flash messages & types', () => { - const mockMessages = [ - { type: 'success', message: 'Hello world!!' }, - { - type: 'error', - message: 'Whoa nelly!', - description:
Something went wrong
, - }, - { type: 'info', message: 'Everything is fine, nothing is ruined' }, - { type: 'warning', message: 'Uh oh' }, - { type: 'info', message: 'Testing multiples of same type' }, - ]; - setMockValues({ messages: mockMessages }); - - const wrapper = shallow(); - - expect(wrapper.find(EuiCallOut)).toHaveLength(5); - expect(wrapper.find(EuiCallOut).first().prop('color')).toEqual('success'); - expect(wrapper.find('[data-test-subj="error"]')).toHaveLength(1); - expect(wrapper.find(EuiCallOut).last().prop('iconType')).toEqual('iInCircle'); - }); - it('renders any children', () => { - setMockValues({ messages: [{ type: 'success' }] }); - - const wrapper = shallow( - - - - ); - - expect(wrapper.find('[data-test-subj="testing"]').text()).toContain('Some action'); - }); + expect(wrapper.find(EuiCallOut)).toHaveLength(5); + expect(wrapper.find(EuiCallOut).first().prop('color')).toEqual('success'); + expect(wrapper.find('[data-test-subj="error"]')).toHaveLength(1); + expect(wrapper.find(EuiCallOut).last().prop('iconType')).toEqual('iInCircle'); }); - describe('toasts', () => { - const actions = { dismissToastMessage: jest.fn() }; - beforeAll(() => setMockActions(actions)); + it('renders any children', () => { + setMockValues({ messages: [{ type: 'success' }] }); - it('renders an EUI toast list', () => { - const mockToasts = [ - { id: 'test', title: 'Hello world!!' }, - { - color: 'success', - iconType: 'check', - title: 'Success!', - toastLifeTimeMs: 500, - id: 'successToastId', - }, - { - color: 'danger', - iconType: 'alert', - title: 'Oh no!', - text:
Something went wrong
, - id: 'errorToastId', - }, - ]; - setMockValues({ toastMessages: mockToasts }); + const wrapper = shallow( + + + + ); - const wrapper = shallow(); - const euiToastList = wrapper.find(EuiGlobalToastList); + expect(wrapper.find('[data-test-subj="testing"]').text()).toContain('Some action'); + }); +}); - expect(euiToastList).toHaveLength(1); - expect(euiToastList.prop('toasts')).toEqual(mockToasts); - expect(euiToastList.prop('dismissToast')).toEqual(actions.dismissToastMessage); - expect(euiToastList.prop('toastLifeTimeMs')).toEqual(5000); - }); +describe('Toasts', () => { + const actions = { dismissToastMessage: jest.fn() }; + beforeAll(() => setMockActions(actions)); + + it('renders an EUI toast list', () => { + const mockToasts = [ + { id: 'test', title: 'Hello world!!' }, + { + color: 'success', + iconType: 'check', + title: 'Success!', + toastLifeTimeMs: 500, + id: 'successToastId', + }, + { + color: 'danger', + iconType: 'alert', + title: 'Oh no!', + text:
Something went wrong
, + id: 'errorToastId', + }, + ]; + setMockValues({ toastMessages: mockToasts }); + + const wrapper = shallow(); + const euiToastList = wrapper.find(EuiGlobalToastList); + + expect(euiToastList).toHaveLength(1); + expect(euiToastList.prop('toasts')).toEqual(mockToasts); + expect(euiToastList.prop('dismissToast')).toEqual(actions.dismissToastMessage); + expect(euiToastList.prop('toastLifeTimeMs')).toEqual(5000); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.tsx index cf4e1a2d6cabc..ba42b89d6ab56 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/flash_messages.tsx @@ -15,14 +15,7 @@ import { i18n } from '@kbn/i18n'; import { FLASH_MESSAGE_TYPES, DEFAULT_TOAST_TIMEOUT } from './constants'; import { FlashMessagesLogic } from './flash_messages_logic'; -export const FlashMessages: React.FC = ({ children }) => ( - <> - {children} - - -); - -export const Callouts: React.FC = ({ children }) => { +export const FlashMessages: React.FC = ({ children }) => { const { messages } = useValues(FlashMessagesLogic); return ( @@ -51,6 +44,11 @@ export const Callouts: React.FC = ({ children }) => { ); }; +/* + * NOTE: Toasts are rendered at the highest app level (@see public/applications/index.tsx) + * so that they don't rerender/reset their timers when navigating between pages, + * and also to prevent z-index issues with flyouts and modals + */ export const Toasts: React.FC = () => { const { toastMessages } = useValues(FlashMessagesLogic); const { dismissToastMessage } = useActions(FlashMessagesLogic); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts index f08ac493f20b3..38a5d6e8b0b30 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { FlashMessages } from './flash_messages'; +export { FlashMessages, Toasts } from './flash_messages'; export { FlashMessagesLogic, mountFlashMessagesLogic } from './flash_messages_logic'; export { IFlashMessage } from './types'; export { flashAPIErrors } from './handle_api_errors'; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 4c69c6f106873..1b44200566405 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7510,7 +7510,8 @@ "xpack.enterpriseSearch.appSearch.documentCreation.uploadJsonFile.title": ".jsonをドラッグアンドドロップ", "xpack.enterpriseSearch.appSearch.documentCreation.warningsTitle": "警告!", "xpack.enterpriseSearch.appSearch.documentDetail.confirmDelete": "このドキュメントを削除しますか?", - "xpack.enterpriseSearch.appSearch.documentDetail.deleteSuccess": "正常にドキュメントが削除に設定されました。すぐに削除されます。", + "xpack.enterpriseSearch.appSearch.documentDetail.deleteSuccess": "正常にドキュメントが削除に設定されました。", + "xpack.enterpriseSearch.appSearch.documentDetail.deleteSuccessDescription": "すぐに削除されます。", "xpack.enterpriseSearch.appSearch.documentDetail.fieldHeader": "フィールド", "xpack.enterpriseSearch.appSearch.documentDetail.title": "ドキュメント:{documentId}", "xpack.enterpriseSearch.appSearch.documentDetail.valueHeader": "値", @@ -7689,9 +7690,10 @@ "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.manageFields.title": "フィールドを管理", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.manageFields.weight.label": "重み", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.deleteConfirmation": "このブーストを削除しますか?", - "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.deleteSuccess": "関連性はデフォルト値にリセットされました。変更はすぐに結果に影響します。", + "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.deleteSuccess": "関連性はデフォルト値にリセットされました。", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.resetConfirmation": "関連性のデフォルトを復元しますか?", - "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.updateSuccess": "関連性は正常に調整されました。変更はすぐに結果に影響します。", + "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.successDescription": "変更はすぐに結果に影響します。", + "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.updateSuccess": "関連性は正常に調整されました。", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.preview.enterQueryMessage": "検索結果を表示するにはクエリを入力します", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.preview.noResultsMessage": "一致するコンテンツが見つかりません", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.preview.searchPlaceholder": "{engineName}を検索", @@ -7749,7 +7751,6 @@ "xpack.enterpriseSearch.appSearch.engineCreation.form.engineName.sanitizedNameHelpText": "エンジン名が変更されます", "xpack.enterpriseSearch.appSearch.engineCreation.form.submitButton.buttonLabel": "エンジンを作成", "xpack.enterpriseSearch.appSearch.engineCreation.form.title": "エンジン名を指定", - "xpack.enterpriseSearch.appSearch.engineCreation.successMessage": "エンジンが正常に作成されました。", "xpack.enterpriseSearch.appSearch.engineCreation.supportedLanguages.chineseDropDownOptionLabel": "中国語", "xpack.enterpriseSearch.appSearch.engineCreation.supportedLanguages.danishDropDownOptionLabel": "デンマーク語", "xpack.enterpriseSearch.appSearch.engineCreation.supportedLanguages.dutchDropDownOptionLabel": "オランダ語", @@ -7808,7 +7809,6 @@ "xpack.enterpriseSearch.appSearch.metaEngineCreation.form.sourceEngines.maxSourceEnginesWarningTitle": "メタエンジンのソースエンジンの上限は{maxEnginesPerMetaEngine}です", "xpack.enterpriseSearch.appSearch.metaEngineCreation.form.submitButton.buttonLabel": "メタエンジンを作成", "xpack.enterpriseSearch.appSearch.metaEngineCreation.form.title": "メタエンジン名を指定", - "xpack.enterpriseSearch.appSearch.metaEngineCreation.successMessage": "メタエンジンが正常に作成されました。", "xpack.enterpriseSearch.appSearch.metaEngineCreation.title": "メタエンジンを作成", "xpack.enterpriseSearch.appSearch.metaEngines.title": "メタエンジン", "xpack.enterpriseSearch.appSearch.multiInputRows.addValueButtonLabel": "値を追加", @@ -7849,8 +7849,6 @@ "xpack.enterpriseSearch.appSearch.setupGuide.videoAlt": "App Searchの基本という短い動画では、App Searchを起動して実行する方法について説明します。", "xpack.enterpriseSearch.appSearch.tokens.admin.description": "資格情報APIとの連携では、非公開管理キーが使用されます。", "xpack.enterpriseSearch.appSearch.tokens.admin.name": "非公開管理キー", - "xpack.enterpriseSearch.appSearch.tokens.created": "キーの作成が正常に完了しました。", - "xpack.enterpriseSearch.appSearch.tokens.deleted": "正常にキーが削除されました。", "xpack.enterpriseSearch.appSearch.tokens.permissions.display.all": "すべて", "xpack.enterpriseSearch.appSearch.tokens.permissions.display.readonly": "読み取り専用", "xpack.enterpriseSearch.appSearch.tokens.permissions.display.readwrite": "読み取り/書き込み", @@ -7860,7 +7858,6 @@ "xpack.enterpriseSearch.appSearch.tokens.private.name": "非公開APIキー", "xpack.enterpriseSearch.appSearch.tokens.search.description": "エンドポイントのみの検索では、公開検索キーが使用されます。", "xpack.enterpriseSearch.appSearch.tokens.search.name": "公開検索キー", - "xpack.enterpriseSearch.appSearch.tokens.update": "正常に API キーを更新しました。", "xpack.enterpriseSearch.emailLabel": "メール", "xpack.enterpriseSearch.enterpriseSearch.setupGuide.description": "場所を問わず、何でも検索。組織を支える多忙なチームのために、パワフルでモダンな検索エクスペリエンスを簡単に導入できます。Webサイトやアプリ、ワークプレイスに事前調整済みの検索をすばやく追加しましょう。何でもシンプルに検索できます。", "xpack.enterpriseSearch.enterpriseSearch.setupGuide.notConfigured": "エンタープライズサーチはまだKibanaインスタンスで構成されていません。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 9230021c296da..9636aa9ba5282 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7573,7 +7573,8 @@ "xpack.enterpriseSearch.appSearch.documentCreation.uploadJsonFile.title": "拖放 .json", "xpack.enterpriseSearch.appSearch.documentCreation.warningsTitle": "警告!", "xpack.enterpriseSearch.appSearch.documentDetail.confirmDelete": "是否确定要删除此文档?", - "xpack.enterpriseSearch.appSearch.documentDetail.deleteSuccess": "成功标记要删除的文档。文档将被暂时删除。", + "xpack.enterpriseSearch.appSearch.documentDetail.deleteSuccess": "成功标记要删除的文档。", + "xpack.enterpriseSearch.appSearch.documentDetail.deleteSuccessDescription": "文档将被暂时删除。", "xpack.enterpriseSearch.appSearch.documentDetail.fieldHeader": "字段", "xpack.enterpriseSearch.appSearch.documentDetail.title": "文档:{documentId}", "xpack.enterpriseSearch.appSearch.documentDetail.valueHeader": "值", @@ -7753,9 +7754,10 @@ "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.manageFields.title": "管理字段", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.manageFields.weight.label": "权重", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.deleteConfirmation": "是否确定要删除此权重提升?", - "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.deleteSuccess": "相关性已重置为默认值。更改将短暂地影响您的结果。", + "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.deleteSuccess": "相关性已重置为默认值。", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.resetConfirmation": "确定要还原相关性默认值?", - "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.updateSuccess": "相关性已成功微调。更改将短暂地影响您的结果。", + "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.successDescription": "更改将短暂地影响您的结果。", + "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.messages.updateSuccess": "相关性已成功微调。", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.preview.enterQueryMessage": "输入查询以查看搜索结果", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.preview.noResultsMessage": "未找到匹配内容", "xpack.enterpriseSearch.appSearch.engine.relevanceTuning.preview.searchPlaceholder": "搜索 {engineName}", @@ -7814,7 +7816,6 @@ "xpack.enterpriseSearch.appSearch.engineCreation.form.engineName.sanitizedNameHelpText": "您的引擎将命名为", "xpack.enterpriseSearch.appSearch.engineCreation.form.submitButton.buttonLabel": "创建引擎", "xpack.enterpriseSearch.appSearch.engineCreation.form.title": "命名您的引擎", - "xpack.enterpriseSearch.appSearch.engineCreation.successMessage": "已成功创建引擎。", "xpack.enterpriseSearch.appSearch.engineCreation.supportedLanguages.chineseDropDownOptionLabel": "中文", "xpack.enterpriseSearch.appSearch.engineCreation.supportedLanguages.danishDropDownOptionLabel": "丹麦语", "xpack.enterpriseSearch.appSearch.engineCreation.supportedLanguages.dutchDropDownOptionLabel": "荷兰语", @@ -7875,7 +7876,6 @@ "xpack.enterpriseSearch.appSearch.metaEngineCreation.form.sourceEngines.maxSourceEnginesWarningTitle": "元引擎的源引擎数目限制为 {maxEnginesPerMetaEngine}", "xpack.enterpriseSearch.appSearch.metaEngineCreation.form.submitButton.buttonLabel": "创建元引擎", "xpack.enterpriseSearch.appSearch.metaEngineCreation.form.title": "命名您的元引擎", - "xpack.enterpriseSearch.appSearch.metaEngineCreation.successMessage": "已成功创建元引擎。", "xpack.enterpriseSearch.appSearch.metaEngineCreation.title": "创建元引擎", "xpack.enterpriseSearch.appSearch.metaEngines.title": "元引擎", "xpack.enterpriseSearch.appSearch.multiInputRows.addValueButtonLabel": "添加值", @@ -7917,8 +7917,6 @@ "xpack.enterpriseSearch.appSearch.setupGuide.videoAlt": "App Search 入门 - 在此视频中,我们将指导您如何开始使用 App Search", "xpack.enterpriseSearch.appSearch.tokens.admin.description": "私有管理员密钥用于与凭据 API 进行交互。", "xpack.enterpriseSearch.appSearch.tokens.admin.name": "私有管理员密钥", - "xpack.enterpriseSearch.appSearch.tokens.created": "已成功创建密钥。", - "xpack.enterpriseSearch.appSearch.tokens.deleted": "已成功删除密钥。", "xpack.enterpriseSearch.appSearch.tokens.permissions.display.all": "全部", "xpack.enterpriseSearch.appSearch.tokens.permissions.display.readonly": "只读", "xpack.enterpriseSearch.appSearch.tokens.permissions.display.readwrite": "读取/写入", @@ -7928,7 +7926,6 @@ "xpack.enterpriseSearch.appSearch.tokens.private.name": "私有 API 密钥", "xpack.enterpriseSearch.appSearch.tokens.search.description": "公有搜索密钥仅用于搜索终端。", "xpack.enterpriseSearch.appSearch.tokens.search.name": "公有搜索密钥", - "xpack.enterpriseSearch.appSearch.tokens.update": "成功更新 API 密钥。", "xpack.enterpriseSearch.emailLabel": "电子邮件", "xpack.enterpriseSearch.enterpriseSearch.setupGuide.description": "随时随地进行全面搜索。为工作繁忙的团队轻松实现强大的现代搜索体验。将预先调整的搜索功能快速添加到您的网站、应用或工作区。全面搜索就是这么简单。", "xpack.enterpriseSearch.enterpriseSearch.setupGuide.notConfigured": "企业搜索尚未在您的 Kibana 实例中配置。",