From f0ce7200f4bdaa21cb2a4a1c60a768ae57f812ea Mon Sep 17 00:00:00 2001 From: Pete Harverson Date: Mon, 24 Aug 2020 18:02:38 +0100 Subject: [PATCH] [ML] Disable Overview view links for analytics jobs with no results (#75740) (#75769) --- .../overview/components/analytics_panel/actions.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/ml/public/application/overview/components/analytics_panel/actions.tsx b/x-pack/plugins/ml/public/application/overview/components/analytics_panel/actions.tsx index 081101e241990..c4508a8c19c5b 100644 --- a/x-pack/plugins/ml/public/application/overview/components/analytics_panel/actions.tsx +++ b/x-pack/plugins/ml/public/application/overview/components/analytics_panel/actions.tsx @@ -14,6 +14,7 @@ import { getResultsUrl, DataFrameAnalyticsListRow, } from '../../../data_frame_analytics/pages/analytics_management/components/analytics_list/common'; +import { getViewLinkStatus } from '../../../data_frame_analytics/pages/analytics_management/components/action_view/get_view_link_status'; interface Props { item: DataFrameAnalyticsListRow; @@ -27,23 +28,28 @@ export const ViewLink: FC = ({ item }) => { navigateToPath(getResultsUrl(item.id, analysisType)); }, []); - const openJobsInAnomalyExplorerText = i18n.translate( + const { disabled, tooltipContent } = getViewLinkStatus(item); + + const viewJobResultsButtonText = i18n.translate( 'xpack.ml.overview.analytics.resultActions.openJobText', { defaultMessage: 'View job results', } ); + const tooltipText = disabled === false ? viewJobResultsButtonText : tooltipContent; + return ( - + {i18n.translate('xpack.ml.overview.analytics.viewActionName', { defaultMessage: 'View',