From 00a299d74f9ea6f63d2b7528f7b5400ff53a40ee Mon Sep 17 00:00:00 2001 From: Diana Derevyankina <54894989+DziyanaDzeraviankina@users.noreply.github.com> Date: Wed, 20 May 2020 15:25:00 +0300 Subject: [PATCH] Timelion graph is not refreshing content after searching or filtering (#67023) * Timelion graph is not refreshing content after searching or filtering in Kibana Closes #66560 * Change test beforeEach configuration to match request body * Remove unused TimelionRequestQuery --- .../vis_type_timelion/server/routes/run.ts | 24 ------------------- .../server/series_functions/es/es.test.js | 4 ++-- .../series_functions/es/lib/build_request.js | 2 +- src/plugins/vis_type_timelion/server/types.ts | 1 - 4 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/plugins/vis_type_timelion/server/routes/run.ts b/src/plugins/vis_type_timelion/server/routes/run.ts index b773bba68ea81..1efc7c4101518 100644 --- a/src/plugins/vis_type_timelion/server/routes/run.ts +++ b/src/plugins/vis_type_timelion/server/routes/run.ts @@ -31,30 +31,6 @@ import { ConfigManager } from '../lib/config_manager'; const timelionDefaults = getNamespacesSettings(); -export interface TimelionRequestQuery { - payload: { - sheet: string[]; - extended?: { - es: { - filter: { - bool: { - filter: string[] | object; - must: string[]; - should: string[]; - must_not: string[]; - }; - }; - }; - }; - }; - time?: { - from?: string; - interval: string; - timezone: string; - to?: string; - }; -} - export function runRoute( router: IRouter, { diff --git a/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js b/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js index 4bd37b03f01fe..56d4b6812d3d9 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js +++ b/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js @@ -239,7 +239,7 @@ describe('es', () => { to: 5, }, request: { - payload: { + body: { extended: { es: { filter: { @@ -258,7 +258,7 @@ describe('es', () => { }); }); - it('adds the contents of payload.extended.es.filter to a filter clause of the bool', () => { + it('adds the contents of body.extended.es.filter to a filter clause of the bool', () => { config.kibana = true; const request = fn(config, tlConfig, emptyScriptedFields); const filter = request.body.query.bool.filter.bool; diff --git a/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js b/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js index 2149e44125be0..38618ccf66d6f 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js +++ b/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js @@ -38,7 +38,7 @@ export default function buildRequest(config, tlConfig, scriptedFields, timeout) // Use the kibana filter bar filters if (config.kibana) { - bool.filter = _.get(tlConfig, 'request.payload.extended.es.filter'); + bool.filter = _.get(tlConfig, 'request.body.extended.es.filter'); } const aggs = { diff --git a/src/plugins/vis_type_timelion/server/types.ts b/src/plugins/vis_type_timelion/server/types.ts index a035d64f764f1..9fc8734a560b7 100644 --- a/src/plugins/vis_type_timelion/server/types.ts +++ b/src/plugins/vis_type_timelion/server/types.ts @@ -18,4 +18,3 @@ */ export { TimelionFunctionInterface, TimelionFunctionConfig } from './lib/classes/timelion_function'; -export { TimelionRequestQuery } from './routes/run';