Skip to content

Commit

Permalink
[ML] Disabling single metric viewer links for non-applicable jobs (#2…
Browse files Browse the repository at this point in the history
…2809) (#22823)

* [ML] Disabling single metric viewer links for non-applicable jobs

* renaming variable

* renaming variable again
  • Loading branch information
jgowdyelastic committed Sep 7, 2018
1 parent da0c398 commit ee478de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -40,9 +40,11 @@ function getLink(location, jobs) {

export function ResultLinks({ jobs }) {
const tooltipJobs = (jobs.length === 1) ? jobs[0].id : `${jobs.length} jobs`;
const singleMetricVisible = (jobs.length < 2);
const singleMetricEnabled = (jobs.length === 1 && jobs[0].isSingleMetricViewerJob);
return (
<React.Fragment>
{(jobs.length < 2) &&
{(singleMetricVisible) &&
<EuiToolTip
position="bottom"
content={`Open ${tooltipJobs} in Single Metric Viewer`}
Expand All @@ -52,7 +54,7 @@ export function ResultLinks({ jobs }) {
iconType="stats"
aria-label="View results in single metric viewer"
className="results-button"

isDisabled={(singleMetricEnabled === false)}
/>
</EuiToolTip>
}
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/ml/server/models/job_service/jobs.js
Expand Up @@ -10,6 +10,7 @@ import { datafeedsProvider } from './datafeeds';
import { jobAuditMessagesProvider } from '../job_audit_messages';
import { CalendarManager } from '../calendar';
import { fillResultsWithTimeouts, isRequestTimeout } from './error_utils';
import { isTimeSeriesViewJob } from '../../../common/util/job_utils';
import moment from 'moment';
import { uniq } from 'lodash';

Expand Down Expand Up @@ -112,6 +113,7 @@ export function jobsProvider(callWithRequest) {
datafeedState: (hasDatafeed && job.datafeed_config.state) ? job.datafeed_config.state : '',
latestTimestampMs,
earliestTimestampMs,
isSingleMetricViewerJob: isTimeSeriesViewJob(job),
nodeName: (job.node) ? job.node.name : undefined,
};
if (jobIds.find(j => (j === tempJob.id))) {
Expand Down

0 comments on commit ee478de

Please sign in to comment.