From 87e0129bf7fdce710d3169a21bc601aa829f346a Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Mon, 9 Jan 2023 20:35:21 +0000 Subject: [PATCH] updating confirm modal text --- .../delete_annotation_modal/index.tsx | 38 +++++++++--------- .../delete_rule_modal.test.js.snap | 24 ++--------- .../select_rule_action/delete_rule_modal.js | 30 ++++++-------- .../edit_job_flyout/edit_job_flyout.js | 29 +++++--------- .../settings/calendars/list/calendars_list.js | 38 ++++++++---------- .../delete_filter_list_modal.test.js.snap | 29 ++------------ .../delete_filter_list_modal.js | 40 ++++++++----------- .../models_management/force_stop_dialog.tsx | 32 ++++++--------- 8 files changed, 95 insertions(+), 165 deletions(-) diff --git a/x-pack/plugins/ml/public/application/components/annotations/delete_annotation_modal/index.tsx b/x-pack/plugins/ml/public/application/components/annotations/delete_annotation_modal/index.tsx index 757cf71511ff..58730179aafd 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/delete_annotation_modal/index.tsx +++ b/x-pack/plugins/ml/public/application/components/annotations/delete_annotation_modal/index.tsx @@ -10,7 +10,7 @@ import React, { Fragment } from 'react'; import { EUI_MODAL_CONFIRM_BUTTON, EuiConfirmModal } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; interface Props { cancelAction: () => void; @@ -27,26 +27,26 @@ export const DeleteAnnotationModal: React.FC = ({ {isVisible === true && ( - } + title={i18n.translate( + 'xpack.ml.timeSeriesExplorer.deleteAnnotationModal.deleteAnnotationTitle', + { + defaultMessage: 'Delete this annotation?', + } + )} onCancel={cancelAction} onConfirm={deleteAction} - cancelButtonText={ - - } - confirmButtonText={ - - } + cancelButtonText={i18n.translate( + 'xpack.ml.timeSeriesExplorer.deleteAnnotationModal.cancelButtonLabel', + { + defaultMessage: 'Cancel', + } + )} + confirmButtonText={i18n.translate( + 'xpack.ml.timeSeriesExplorer.deleteAnnotationModal.deleteButtonLabel', + { + defaultMessage: 'Delete', + } + )} buttonColor="danger" defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON} className="eui-textBreakWord" diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap index 3a11531f6c4b..1d4889557002 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap @@ -44,30 +44,12 @@ exports[`DeleteRuleModal renders modal after clicking delete rule link 1`] = ` - } - confirmButtonText={ - - } + cancelButtonText="Cancel" + confirmButtonText="Delete" defaultFocusedButton="confirm" onCancel={[Function]} onConfirm={[Function]} - title={ - - } + title="Delete rule?" /> `; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.js index 1b62ab2907ff..68221bbe5879 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.js @@ -11,6 +11,7 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; +import { i18n } from '@kbn/i18n'; import { EuiConfirmModal, EuiLink, EUI_MODAL_CONFIRM_BUTTON } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -44,27 +45,20 @@ export class DeleteRuleModal extends Component { if (this.state.isModalVisible) { modal = ( - } + title={i18n.translate('xpack.ml.ruleEditor.deleteRuleModal.deleteRuleTitle', { + defaultMessage: 'Delete rule?', + })} onCancel={this.closeModal} onConfirm={this.deleteRule} buttonColor="danger" - cancelButtonText={ - - } - confirmButtonText={ - - } + cancelButtonText={i18n.translate( + 'xpack.ml.ruleEditor.deleteRuleModal.cancelButtonLabel', + { defaultMessage: 'Cancel' } + )} + confirmButtonText={i18n.translate( + 'xpack.ml.ruleEditor.deleteRuleModal.deleteButtonLabel', + { defaultMessage: 'Delete' } + )} defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON} /> ); diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js index 9100b7ffa03a..0f97acdae5c3 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js @@ -475,26 +475,19 @@ export class EditJobFlyoutUI extends Component { if (this.state.isConfirmationModalVisible) { confirmationModal = ( - } + title={i18n.translate('xpack.ml.jobsList.editJobFlyout.unsavedChangesDialogTitle', { + defaultMessage: 'Save changes before leaving?', + })} onCancel={() => this.closeFlyout(true)} onConfirm={() => this.save()} - cancelButtonText={ - - } - confirmButtonText={ - - } + cancelButtonText={i18n.translate( + 'xpack.ml.jobsList.editJobFlyout.leaveAnywayButtonLabel', + { defaultMessage: 'Leave anyway' } + )} + confirmButtonText={i18n.translate( + 'xpack.ml.jobsList.editJobFlyout.saveChangesButtonLabel', + { defaultMessage: 'Save changes' } + )} defaultFocusedButton="confirm" >

diff --git a/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.js b/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.js index 9864078aff69..a3bb900ca1ce 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.js @@ -16,7 +16,6 @@ import { ml } from '../../../services/ml_api_service'; import { mlNodesAvailable } from '../../../ml_nodes_check/check_ml_nodes'; import { deleteCalendars } from './delete_calendars'; import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n-react'; import { withKibana } from '@kbn/kibana-react-plugin/public'; import { getDocLinks } from '../../../util/dependency_cache'; import { HelpMenu } from '../../../components/help_menu'; @@ -105,30 +104,27 @@ export class CalendarsListUI extends Component { destroyModal = ( c.calendar_id).join(', '), - }} - /> - } + }, + } + )} onCancel={this.closeDestroyModal} onConfirm={this.deleteCalendars} - cancelButtonText={ - - } - confirmButtonText={ - - } + cancelButtonText={i18n.translate( + 'xpack.ml.calendarsList.deleteCalendarsModal.cancelButtonLabel', + { defaultMessage: 'Cancel' } + )} + confirmButtonText={i18n.translate( + 'xpack.ml.calendarsList.deleteCalendarsModal.deleteButtonLabel', + { defaultMessage: 'Delete' } + )} buttonColor="danger" defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON} /> diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/__snapshots__/delete_filter_list_modal.test.js.snap b/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/__snapshots__/delete_filter_list_modal.test.js.snap index d4ea0c49612a..00072352c4f5 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/__snapshots__/delete_filter_list_modal.test.js.snap +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/__snapshots__/delete_filter_list_modal.test.js.snap @@ -99,37 +99,14 @@ exports[`DeleteFilterListModal renders modal after clicking delete button 1`] = - } + cancelButtonText="Cancel" className="eui-textBreakWord" - confirmButtonText={ - - } + confirmButtonText="Delete" data-test-subj="mlFilterListDeleteConfirmation" defaultFocusedButton="confirm" onCancel={[Function]} onConfirm={[Function]} - title={ - - } + title="Delete 2 filter lists?" /> `; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.js b/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.js index 8f7fc02ffdb2..8540d6c803b7 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.js @@ -8,6 +8,7 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; import { EuiButton, EuiConfirmModal, EUI_MODAL_CONFIRM_BUTTON } from '@elastic/eui'; @@ -56,34 +57,27 @@ export class DeleteFilterListModal extends Component { let modal; if (this.state.isModalVisible) { - const title = ( - - ); modal = ( - } - confirmButtonText={ - - } + cancelButtonText={i18n.translate( + 'xpack.ml.settings.filterLists.deleteFilterListModal.cancelButtonLabel', + { defaultMessage: 'Cancel' } + )} + confirmButtonText={i18n.translate( + 'xpack.ml.settings.filterLists.deleteFilterListModal.confirmButtonLabel', + { defaultMessage: 'Delete' } + )} buttonColor="danger" defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON} data-test-subj={'mlFilterListDeleteConfirmation'} diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/force_stop_dialog.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/force_stop_dialog.tsx index 6a9713172322..1800f9b13db0 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/force_stop_dialog.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/force_stop_dialog.tsx @@ -8,6 +8,7 @@ import React, { FC } from 'react'; import { EuiConfirmModal } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; import type { OverlayStart, ThemeServiceStart } from '@kbn/core/public'; import { toMountPoint, wrapWithTheme } from '@kbn/kibana-react-plugin/public'; import type { ModelItem } from './models_list'; @@ -25,27 +26,20 @@ export const ForceStopModelConfirmDialog: FC = }) => { return ( - } + title={i18n.translate('xpack.ml.trainedModels.modelsList.forceStopDialog.title', { + defaultMessage: 'Stop model {modelId}?', + values: { modelId: model.model_id }, + })} onCancel={onCancel} onConfirm={onConfirm} - cancelButtonText={ - - } - confirmButtonText={ - - } + cancelButtonText={i18n.translate( + 'xpack.ml.trainedModels.modelsList.forceStopDialog.cancelText', + { defaultMessage: 'Cancel' } + )} + confirmButtonText={i18n.translate( + 'xpack.ml.trainedModels.modelsList.forceStopDialog.confirmText', + { defaultMessage: 'Stop' } + )} buttonColor="danger" >