Skip to content

Commit

Permalink
[Table Visualization][BUG] partical rows shows metrics for all columns (
Browse files Browse the repository at this point in the history
#2648)

Currently, when we enable Show partial rows in the Options panel, we see metrics been
added to every column even though Show metrics for every bucket/level is not enabled.

Metrics are added and returned when we enable the partial rows. This PR fixed the bug
by slice the returned data to allow only the last set of metrices.

Partially resolved:
#2579 (comment)

Signed-off-by: Anan Zhuang <[email protected]>
  • Loading branch information
ananzh authored Oct 25, 2022
1 parent 5aac0d8 commit 9d4bc57
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugins/vis_type_table/public/to_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ export const toExpressionAst = (vis: Vis, params: any) => {
);

const schemas = getVisSchemas(vis, params);
// manul slice to remove duplicate metrics
const metrics =
schemas.bucket && vis.params.showPartialRows && !vis.params.showMetricsAtAllLevels
? schemas.metric.slice(-1 * (schemas.metric.length / schemas.bucket.length))
: schemas.metric;

const tableData = {
title: vis.title,
metrics: schemas.metric,
metrics,
buckets: schemas.bucket || [],
splitRow: schemas.split_row,
splitColumn: schemas.split_column,
Expand Down

0 comments on commit 9d4bc57

Please sign in to comment.