From 99fc6efb351e385af06704e53c791e5ae4a65511 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 14 Jul 2021 06:52:03 -0400 Subject: [PATCH] [ML] Improve bucket span estimator error toast (#105457) (#105552) Co-authored-by: James Gowdy --- .../bucket_span_estimator/estimate_bucket_span.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts index 67673901494c7..88ed17cba0003 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts @@ -6,7 +6,7 @@ */ import { useContext, useState } from 'react'; - +import { i18n } from '@kbn/i18n'; import { JobCreatorContext } from '../../../job_creator_context'; import { EVENT_RATE_FIELD_ID } from '../../../../../../../../../common/types/fields'; import { BucketSpanEstimatorData } from '../../../../../../../../../common/types/job_service'; @@ -76,10 +76,16 @@ export function useEstimateBucketSpan() { async function estimateBucketSpan() { setStatus(ESTIMATE_STATUS.RUNNING); - const { name, error, message } = await ml.estimateBucketSpan(data); + const { name, error, message: text } = await ml.estimateBucketSpan(data); setStatus(ESTIMATE_STATUS.NOT_RUNNING); if (error === true) { - getToastNotificationService().displayErrorToast(message); + const title = i18n.translate( + 'xpack.ml.newJob.wizard.pickFieldsStep.bucketSpanEstimator.errorTitle', + { + defaultMessage: 'Bucket span could not be estimated', + } + ); + getToastNotificationService().displayWarningToast({ title, text }); } else { jobCreator.bucketSpan = name; jobCreatorUpdate();