Skip to content

Commit

Permalink
[Rollup] [Phase 1] Table View - research the query to ES - sorting is…
Browse files Browse the repository at this point in the history
… not wokring
  • Loading branch information
alexwizp committed Jan 31, 2019
1 parent 1540961 commit 2656503
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ interface Schemas {
[key: string]: any[] | undefined;
}

type buildVisFunction = (visState: VisState, schemas: Schemas) => string;
type buildVisFunction = (visState: VisState, schemas: Schemas, uiState: any) => string;

interface BuildPipelineVisFunction {
[key: string]: buildVisFunction;
Expand Down Expand Up @@ -201,8 +201,11 @@ export const buildPipelineVisFunction: BuildPipelineVisFunction = {
input_control_vis: visState => {
return `input_control_vis ${prepareJson('visConfig', visState.params)}`;
},
metrics: visState => {
return `tsvb ${prepareJson('params', visState.params)}`;
metrics: (visState, schemas, uiState) => {
const params = prepareJson('params', visState.params);
const uiState = prepareJson('uiState', uiState);

return `tsvb ${params} ${uiState}`;
},
timelion: visState => {
const expression = prepareString('expression', visState.params.expression);
Expand Down Expand Up @@ -300,6 +303,7 @@ export const buildPipeline = (
const query = searchSource.getField('query');
const filters = searchSource.getField('filter');
const visState = vis.getCurrentState();
const uiState = vis.getUiState();

// context
let pipeline = `kibana | kibana_context `;
Expand All @@ -325,7 +329,7 @@ export const buildPipeline = (

const schemas = getSchemas(vis, params.timeRange);
if (buildPipelineVisFunction[vis.type.name]) {
pipeline += buildPipelineVisFunction[vis.type.name](visState, schemas);
pipeline += buildPipelineVisFunction[vis.type.name](visState, schemas, uiState);
} else if (vislibCharts.includes(vis.type.name)) {
const visConfig = visState.params;
visConfig.dimensions = buildVislibDimensions(vis, params.timeRange);
Expand Down

0 comments on commit 2656503

Please sign in to comment.