Skip to content
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

[Lens] Bugs in table rendering caused by toExpression function #74900

Closed
wylieconlon opened this issue Aug 12, 2020 · 1 comment · Fixed by #74902
Closed

[Lens] Bugs in table rendering caused by toExpression function #74900

wylieconlon opened this issue Aug 12, 2020 · 1 comment · Fixed by #74902
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@wylieconlon
Copy link
Contributor

The table configuration should always be matched in the table expression, which is not happening for in several cases.

Steps to reproduce:

  1. Use the chart switcher and go to an empty datatable
  2. Drag the Records field and you should get a suggestion with 2 columns
  3. Drag a new string field into the empty dimension labeled "Drop a field here"
  4. The order shown in the table will not match the order shown on the right side

The fix for this issue should be to use the same logic in both getConfiguration and toExpression, which is to sort the table columns by the datasource order using this snippet from getConfiguration.

    const datasource = frame.datasourceLayers[layer.layerId];
    const originalOrder = datasource.getTableSpec().map(({ columnId }) => columnId);
    // When we add a column it could be empty, and therefore have no order
    const sortedColumns = Array.from(new Set(originalOrder.concat(layer.columns)));

This small change should fix the bug and guarantee consistent order.

@wylieconlon wylieconlon added bug Fixes for quality problems that affect the customer experience Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Aug 12, 2020
@wylieconlon wylieconlon self-assigned this Aug 12, 2020
@wylieconlon wylieconlon added this to Long-term goals in Lens via automation Aug 12, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293 flash1293 moved this from Long-term goals to Minor bugs in Lens Aug 14, 2020
@flash1293 flash1293 removed this from Minor bugs in Lens Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants