[ML] Disabling single metric viewer links for non-applicable jobs (#22809) (#22823)

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

* renaming variable

* renaming variable again
This commit is contained in:
James Gowdy 2018-09-07 18:09:03 +01:00 committed by GitHub
parent da0c3981c2
commit ee478de9d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -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`}
@ -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>
}

View file

@ -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';
@ -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))) {