Skip to content

Commit

Permalink
[ML] Disable Overview view links for analytics jobs with no results (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
peteharverson authored Aug 24, 2020
1 parent 2ec08f2 commit f0ce720
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,23 +28,28 @@ export const ViewLink: FC<Props> = ({ 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 (
<EuiToolTip position="bottom" content={openJobsInAnomalyExplorerText}>
<EuiToolTip position="bottom" content={tooltipText}>
<EuiButtonEmpty
color="text"
size="xs"
onClick={clickHandler}
iconType="visTable"
aria-label={openJobsInAnomalyExplorerText}
aria-label={viewJobResultsButtonText}
className="results-button"
data-test-subj="mlAnalyticsJobViewButton"
isDisabled={disabled}
>
{i18n.translate('xpack.ml.overview.analytics.viewActionName', {
defaultMessage: 'View',
Expand Down

0 comments on commit f0ce720

Please sign in to comment.