mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit is contained in:
parent
1226e0784a
commit
3d26a69c00
1 changed files with 9 additions and 6 deletions
|
@ -21,18 +21,21 @@ import { mlJobService } from 'plugins/ml/services/job_service';
|
|||
import { injectI18n } from '@kbn/i18n/react';
|
||||
|
||||
function getLink(location, jobs) {
|
||||
let from = 0;
|
||||
let to = 0;
|
||||
let from = undefined;
|
||||
let to = undefined;
|
||||
if (jobs.length === 1) {
|
||||
from = jobs[0].earliestTimestampMs;
|
||||
to = jobs[0].latestTimestampMs;
|
||||
} else {
|
||||
from = Math.min(...jobs.map(j => j.earliestTimestampMs));
|
||||
to = Math.max(...jobs.map(j => j.latestTimestampMs));
|
||||
const jobsWithData = jobs.filter(j => (j.earliestTimestampMs !== undefined));
|
||||
if (jobsWithData.length > 0) {
|
||||
from = Math.min(...jobsWithData.map(j => j.earliestTimestampMs));
|
||||
to = Math.max(...jobsWithData.map(j => j.latestTimestampMs));
|
||||
}
|
||||
}
|
||||
|
||||
const fromString = moment(from).format(TIME_FORMAT);
|
||||
const toString = moment(to).format(TIME_FORMAT);
|
||||
const fromString = moment(from).format(TIME_FORMAT); // Defaults to 'now' if 'from' is undefined
|
||||
const toString = moment(to).format(TIME_FORMAT); // Defaults to 'now' if 'to' is undefined
|
||||
|
||||
const jobIds = jobs.map(j => j.id);
|
||||
const url = mlJobService.createResultsUrl(jobIds, fromString, toString, location);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue