mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ML] List all annotations in jobs list annotations table. (#27300)
* [ML] List all annotations in jobs list annotations table even outside analysis time range. * [ML] Adjust the links time range if annotation is outside analysis time range.
This commit is contained in:
parent
b1b5d623cf
commit
c6dc1a1fec
2 changed files with 23 additions and 11 deletions
|
@ -67,8 +67,8 @@ class AnnotationsTable extends Component {
|
|||
// Load annotations for the selected job.
|
||||
ml.annotations.getAnnotations({
|
||||
jobIds: [job.job_id],
|
||||
earliestMs: dataCounts.earliest_record_timestamp,
|
||||
latestMs: dataCounts.latest_record_timestamp,
|
||||
earliestMs: null,
|
||||
latestMs: null,
|
||||
maxAnnotations: ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE
|
||||
}).then((resp) => {
|
||||
this.setState((prevState, props) => ({
|
||||
|
@ -112,7 +112,7 @@ class AnnotationsTable extends Component {
|
|||
const from = new Date(dataCounts.earliest_record_timestamp).toISOString();
|
||||
const to = new Date(dataCounts.latest_record_timestamp).toISOString();
|
||||
|
||||
const _g = rison.encode({
|
||||
const globalSettings = {
|
||||
ml: {
|
||||
jobIds: [this.props.jobs[0].job_id]
|
||||
},
|
||||
|
@ -126,7 +126,7 @@ class AnnotationsTable extends Component {
|
|||
to,
|
||||
mode: 'absolute'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const appState = {
|
||||
filters: [],
|
||||
|
@ -145,8 +145,17 @@ class AnnotationsTable extends Component {
|
|||
to: new Date(annotation.end_timestamp).toISOString()
|
||||
}
|
||||
};
|
||||
|
||||
if (annotation.timestamp < dataCounts.earliest_record_timestamp) {
|
||||
globalSettings.time.from = new Date(annotation.timestamp).toISOString();
|
||||
}
|
||||
|
||||
if (annotation.end_timestamp > dataCounts.latest_record_timestamp) {
|
||||
globalSettings.time.to = new Date(annotation.end_timestamp).toISOString();
|
||||
}
|
||||
}
|
||||
|
||||
const _g = rison.encode(globalSettings);
|
||||
const _a = rison.encode(appState);
|
||||
|
||||
const url = `?_g=${_g}&_a=${_a}`;
|
||||
|
|
|
@ -102,6 +102,8 @@ export function annotationProvider(
|
|||
annotations: {},
|
||||
};
|
||||
|
||||
const boolCriteria: object[] = [];
|
||||
|
||||
// Build the criteria to use in the bool filter part of the request.
|
||||
// Adds criteria for the time range plus any specified job IDs.
|
||||
// The nested must_not time range filter queries make sure that we fetch:
|
||||
|
@ -110,8 +112,8 @@ export function annotationProvider(
|
|||
// - annotations that start before and end after the given time range
|
||||
// - but skip annotation that are completely outside the time range
|
||||
// (the ones that start and end before or after the time range)
|
||||
const boolCriteria: object[] = [
|
||||
{
|
||||
if (earliestMs !== null && latestMs !== null) {
|
||||
boolCriteria.push({
|
||||
bool: {
|
||||
must_not: [
|
||||
{
|
||||
|
@ -160,11 +162,12 @@ export function annotationProvider(
|
|||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
exists: { field: 'annotation' },
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
boolCriteria.push({
|
||||
exists: { field: 'annotation' },
|
||||
});
|
||||
|
||||
if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) {
|
||||
let jobIdFilterStr = '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue