[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:
Walter Rafelsberger 2018-12-18 09:24:24 +01:00 committed by GitHub
parent b1b5d623cf
commit c6dc1a1fec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 11 deletions

View file

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

View file

@ -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 = '';