-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve visualization typings #79128
Changes from all commits
7048212
5c2f793
feabd17
deb5450
2c03b43
37261b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,10 @@ const vislibCharts: string[] = [ | |
'line', | ||
]; | ||
|
||
export const getSchemas = (vis: Vis, { timeRange, timefilter }: BuildPipelineParams): Schemas => { | ||
export const getSchemas = <TVisParams>( | ||
vis: Vis<TVisParams>, | ||
{ timeRange, timefilter }: BuildPipelineParams | ||
): Schemas => { | ||
const createSchemaConfig = (accessor: number, agg: IAggConfig): SchemaConfig => { | ||
if (isDateHistogramBucketAggConfig(agg)) { | ||
agg.params.timeRange = timeRange; | ||
|
@@ -155,7 +158,8 @@ export const getSchemas = (vis: Vis, { timeRange, timefilter }: BuildPipelinePar | |
} | ||
} | ||
if (schemaName === 'split') { | ||
schemaName = `split_${vis.params.row ? 'row' : 'column'}`; | ||
// TODO: We should check if there's a better way then casting to `any` here | ||
schemaName = `split_${(vis.params as any).row ? 'row' : 'column'}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could restrict |
||
skipMetrics = responseAggs.length - metrics.length > 1; | ||
} | ||
if (!schemas[schemaName]) { | ||
|
@@ -410,7 +414,7 @@ export const buildPipeline = async (vis: Vis, params: BuildPipelineParams) => { | |
pipeline += `esaggs | ||
${prepareString('index', indexPattern!.id)} | ||
metricsAtAllLevels=${vis.isHierarchical()} | ||
partialRows=${vis.type.requiresPartialRows || vis.params.showPartialRows || false} | ||
partialRows=${vis.params.showPartialRows || false} | ||
${prepareJson('aggConfigs', vis.data.aggs!.aggs)} | `; | ||
} | ||
|
||
|
@@ -433,7 +437,7 @@ export const buildPipeline = async (vis: Vis, params: BuildPipelineParams) => { | |
pipeline += `visualization type='${vis.type.name}' | ||
${prepareJson('visConfig', visConfig)} | ||
metricsAtAllLevels=${vis.isHierarchical()} | ||
partialRows=${vis.type.requiresPartialRows || vis.params.showPartialRows || false} `; | ||
partialRows=${vis.params.showPartialRows || false} `; | ||
if (indexPattern) { | ||
pipeline += `${prepareString('index', indexPattern.id)} `; | ||
if (vis.data.aggs) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ This flag was never passed through the BaseVisType, so it seems this feature is no longer needed for anything and I removed the flag completely.