From 400e4ab3d47ed5400a11adc48f8539e45b1ed734 Mon Sep 17 00:00:00 2001 From: ppisljar Date: Tue, 5 Mar 2019 04:46:50 -0800 Subject: [PATCH 1/3] fixing pipeline_data_loader --- .../public/renderers/visualization.js | 2 +- .../loader/embedded_visualize_handler.ts | 2 +- .../loader/pipeline_helpers/build_pipeline.ts | 30 +++++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/legacy/core_plugins/interpreter/public/renderers/visualization.js b/src/legacy/core_plugins/interpreter/public/renderers/visualization.js index df789ae0affd5..a04431c8c4467 100644 --- a/src/legacy/core_plugins/interpreter/public/renderers/visualization.js +++ b/src/legacy/core_plugins/interpreter/public/renderers/visualization.js @@ -49,7 +49,7 @@ export const visualization = () => ({ handlers.onDestroy(() => visualizationLoader.destroy()); - await visualizationLoader.render(domNode, handlers.vis, visData, uiState, params).then(() => { + await visualizationLoader.render(domNode, handlers.vis, visData, visConfig || handlers.vis.params, uiState, params).then(() => { if (handlers.done) handlers.done(); }); }, diff --git a/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts b/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts index be1c531ef272c..88251f7ccfc43 100644 --- a/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts +++ b/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts @@ -71,7 +71,7 @@ export class EmbeddedVisualizeHandler { * This should not be used by any plugin. * @ignore */ - public static readonly __ENABLE_PIPELINE_DATA_LOADER__: boolean = false; + public static readonly __ENABLE_PIPELINE_DATA_LOADER__: boolean = true; public readonly data$: Rx.Observable; public readonly inspectorAdapters: Adapters = {}; private vis: Vis; diff --git a/src/legacy/ui/public/visualize/loader/pipeline_helpers/build_pipeline.ts b/src/legacy/ui/public/visualize/loader/pipeline_helpers/build_pipeline.ts index 05ab628a3c689..a855f2489577a 100644 --- a/src/legacy/ui/public/visualize/loader/pipeline_helpers/build_pipeline.ts +++ b/src/legacy/ui/public/visualize/loader/pipeline_helpers/build_pipeline.ts @@ -224,27 +224,45 @@ export const buildPipelineVisFunction: BuildPipelineVisFunction = { return `kibana_markdown ${expression}${visConfig}`; }, table: (visState, schemas) => { - const visConfig = buildVisConfig.table(schemas); + const visConfig = { + ...visState.params, + ...buildVisConfig.table(schemas), + }; return `kibana_table ${prepareJson('visConfig', visConfig)}`; }, metric: (visState, schemas) => { - const visConfig = buildVisConfig.metric(schemas); + const visConfig = { + ...visState.params, + ...buildVisConfig.metric(schemas), + }; return `kibana_metric ${prepareJson('visConfig', visConfig)}`; }, tagcloud: (visState, schemas) => { - const visConfig = buildVisConfig.tagcloud(schemas); + const visConfig = { + ...visState.params, + ...buildVisConfig.tagcloud(schemas), + }; return `tagcloud ${prepareJson('visConfig', visConfig)}`; }, region_map: (visState, schemas) => { - const visConfig = buildVisConfig.region_map(schemas); + const visConfig = { + ...visState.params, + ...buildVisConfig.region_map(schemas), + }; return `regionmap ${prepareJson('visConfig', visConfig)}`; }, tile_map: (visState, schemas) => { - const visConfig = buildVisConfig.tile_map(schemas); + const visConfig = { + ...visState.params, + ...buildVisConfig.tile_map(schemas), + }; return `tilemap ${prepareJson('visConfig', visConfig)}`; }, pie: (visState, schemas) => { - const visConfig = buildVisConfig.pie(schemas); + const visConfig = { + ...visState.params, + ...buildVisConfig.pie(schemas), + }; return `kibana_pie ${prepareJson('visConfig', visConfig)}`; }, }; From 1671d6bea36b2764807dd8e1b3f0797a1f2f0d29 Mon Sep 17 00:00:00 2001 From: ppisljar Date: Wed, 6 Mar 2019 00:53:32 -0800 Subject: [PATCH 2/3] updating test snapshots --- .../__snapshots__/build_pipeline.test.js.snap | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/legacy/ui/public/visualize/loader/pipeline_helpers/__snapshots__/build_pipeline.test.js.snap b/src/legacy/ui/public/visualize/loader/pipeline_helpers/__snapshots__/build_pipeline.test.js.snap index 3b919e4eb483a..ae592282316ef 100644 --- a/src/legacy/ui/public/visualize/loader/pipeline_helpers/__snapshots__/build_pipeline.test.js.snap +++ b/src/legacy/ui/public/visualize/loader/pipeline_helpers/__snapshots__/build_pipeline.test.js.snap @@ -4,9 +4,9 @@ exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunct exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles markdown function 1`] = `"kibana_markdown expression='## hello _markdown_' visConfig='{\\"markdown\\":\\"## hello _markdown_\\",\\"foo\\":\\"bar\\"}' "`; -exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles metric function with buckets 1`] = `"kibana_metric visConfig='{\\"dimensions\\":{\\"metrics\\":[0,1],\\"bucket\\":2}}' "`; +exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles metric function with buckets 1`] = `"kibana_metric visConfig='{\\"metric\\":{},\\"dimensions\\":{\\"metrics\\":[0,1],\\"bucket\\":2}}' "`; -exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles metric function without buckets 1`] = `"kibana_metric visConfig='{\\"dimensions\\":{\\"metrics\\":[0,1]}}' "`; +exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles metric function without buckets 1`] = `"kibana_metric visConfig='{\\"metric\\":{},\\"dimensions\\":{\\"metrics\\":[0,1]}}' "`; exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles metrics/tsvb function 1`] = `"tsvb params='{\\"foo\\":\\"bar\\"}' uiState='{}' "`; @@ -16,17 +16,17 @@ exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunct exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles region_map function without buckets 1`] = `"regionmap visConfig='{\\"metric\\":0}' "`; -exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles table function with splits 1`] = `"kibana_table visConfig='{\\"dimensions\\":{\\"metrics\\":[0],\\"buckets\\":[],\\"splitRow\\":[1,2]}}' "`; +exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles table function with splits 1`] = `"kibana_table visConfig='{\\"foo\\":\\"bar\\",\\"dimensions\\":{\\"metrics\\":[0],\\"buckets\\":[],\\"splitRow\\":[1,2]}}' "`; -exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles table function with splits and buckets 1`] = `"kibana_table visConfig='{\\"dimensions\\":{\\"metrics\\":[0,1],\\"buckets\\":[3],\\"splitRow\\":[2,4]}}' "`; +exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles table function with splits and buckets 1`] = `"kibana_table visConfig='{\\"foo\\":\\"bar\\",\\"dimensions\\":{\\"metrics\\":[0,1],\\"buckets\\":[3],\\"splitRow\\":[2,4]}}' "`; -exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles table function without splits or buckets 1`] = `"kibana_table visConfig='{\\"dimensions\\":{\\"metrics\\":[0,1],\\"buckets\\":[]}}' "`; +exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles table function without splits or buckets 1`] = `"kibana_table visConfig='{\\"foo\\":\\"bar\\",\\"dimensions\\":{\\"metrics\\":[0,1],\\"buckets\\":[]}}' "`; exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles tagcloud function with buckets 1`] = `"tagcloud visConfig='{\\"metric\\":0,\\"bucket\\":1}' "`; exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles tagcloud function without buckets 1`] = `"tagcloud visConfig='{\\"metric\\":0}' "`; -exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles tile_map function 1`] = `"tilemap visConfig='{\\"dimensions\\":{\\"metric\\":0,\\"geohash\\":1,\\"geocentroid\\":3}}' "`; +exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles tile_map function 1`] = `"tilemap visConfig='{\\"metric\\":{},\\"dimensions\\":{\\"metric\\":0,\\"geohash\\":1,\\"geocentroid\\":3}}' "`; exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles timelion function 1`] = `"timelion_vis expression='foo' interval='bar' "`; From 855f0f1879bca8315d2587fe2d260ad12ea701a1 Mon Sep 17 00:00:00 2001 From: ppisljar Date: Wed, 6 Mar 2019 00:55:44 -0800 Subject: [PATCH 3/3] pipeline switch back to false --- .../ui/public/visualize/loader/embedded_visualize_handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts b/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts index 88251f7ccfc43..be1c531ef272c 100644 --- a/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts +++ b/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts @@ -71,7 +71,7 @@ export class EmbeddedVisualizeHandler { * This should not be used by any plugin. * @ignore */ - public static readonly __ENABLE_PIPELINE_DATA_LOADER__: boolean = true; + public static readonly __ENABLE_PIPELINE_DATA_LOADER__: boolean = false; public readonly data$: Rx.Observable; public readonly inspectorAdapters: Adapters = {}; private vis: Vis;