Skip to content

Commit

Permalink
Use scopedHistory-compatible Prompt component
Browse files Browse the repository at this point in the history
  • Loading branch information
weltenwort committed Apr 24, 2020
1 parent fee6041 commit df3eadb
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { useCallback, useMemo } from 'react';
import { Prompt } from 'react-router-dom';
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
import { FieldsConfigurationPanel } from './fields_configuration_panel';
import { IndicesConfigurationPanel } from './indices_configuration_panel';
Expand All @@ -26,6 +25,7 @@ import { LogColumnsConfigurationPanel } from './log_columns_configuration_panel'
import { useLogSourceConfigurationFormState } from './source_configuration_form_state';
import { useLogSourceContext } from '../../../containers/logs/log_source';
import { SourceLoadingPage } from '../../../components/source_loading_page';
import { Prompt } from '../../../utils/navigation_warning_prompt';

export const LogsSettingsPage = () => {
const uiCapabilities = useKibana().services.application?.capabilities;
Expand Down Expand Up @@ -81,12 +81,7 @@ export const LogsSettingsPage = () => {
restrictWidth
data-test-subj="sourceConfigurationContent"
>
<Prompt
when={isFormDirty}
message={i18n.translate('xpack.infra.sourceConfiguration.unsavedFormPrompt', {
defaultMessage: 'Are you sure you want to leave? Changes will be lost',
})}
/>
<Prompt when={isFormDirty} message={unsavedFormPromptMessage} />
<EuiPanel paddingSize="l">
<NameConfigurationPanel
isLoading={isLoading}
Expand Down Expand Up @@ -189,3 +184,10 @@ export const LogsSettingsPage = () => {
</>
);
};

const unsavedFormPromptMessage = i18n.translate(
'xpack.infra.logSourceConfiguration.unsavedFormPromptMessage',
{
defaultMessage: 'Are you sure you want to leave? Changes will be lost',
}
);

0 comments on commit df3eadb

Please sign in to comment.