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

[BUG][Discover] "_source" Not Added to Side Nav on Removing All Columns with doc_table:hideTimeColumn Enabled #5538

Closed
MadaniKK opened this issue Nov 27, 2023 · 4 comments
Assignees
Labels
bug Something isn't working data explorer Issues related to the Data Explorer project discover for discover reinvent v2.12.0

Comments

@MadaniKK
Copy link
Contributor

Describe the bug

A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to discover: advanced setting
  2. set doc_table:hideTimeColum to ON
  3. Go to Discover
  4. Select a column, then remove it in the canvas
image image

Expected behavior
A clear and concise description of what you expected to happen.
"_source" should be in the selected field when all columns are removed and no other field is selected.
OpenSearch Version
3.0.0

Dashboards Version
Please list the version of OpenSearch Dashboards being used.

Plugins

Please list all plugins currently enabled.

Screenshots

If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Browser and version [e.g. 22]

Additional context

Add any other context about the problem here.

@MadaniKK MadaniKK added bug Something isn't working untriaged labels Nov 27, 2023
@MadaniKK
Copy link
Contributor Author

May I take this issue? Ty.

@ananzh
Copy link
Member

ananzh commented Dec 2, 2023

In the legacy Discover, there is no time field. But in new Discover, we could see a time field in the left nav.
Screenshot 2023-12-01 at 5 10 58 PM

But add it or remove it from left nav won't make any differences. The correct behavior should be, and pls help me verify

  • No time field in side nav
  • When display a time based index pattern, time field is displayed in the table by default
  • When doc_table:hideTimeColumn is on, time field is not displayed in the table

@ananzh ananzh added discover for discover reinvent v2.12.0 and removed v2.12.0 labels Dec 13, 2023
@MadaniKK
Copy link
Contributor Author

  1. I suggest keeping the time field in the side nav bar because it exists in the legacy cover, and when the hide time column is off, we can still add the time column to the selected field and use drag-drop to arrange column order.
  2. I think for the canvas, the removeColumn probably is off, it doesn't guarantee the column array with a safe fallback. I saw in the code that we added an extra buildColumn(columns) before rendering the canvas, which is why the canvas still behaves correctly when removing columns.
    let adjustedColumns = buildColumns(columns);
    // handle case where the user removes selected filed and leaves only time column
    if (
    adjustedColumns.length === 1 &&
    indexPattern &&
    adjustedColumns[0] === indexPattern.timeFieldName
    ) {
    adjustedColumns = [...adjustedColumns, '_source'];
    }

    And this problem doesn't show when hideTime is off might be because the time field gets automatically added to columns every time we remove a column from canvas (just as described in issue [BUG][Disocver] Timefield of an indexPattern would get added to selected field in the side nav when removing a column from the canvas #5527 ) I think adding a buildColumn(columns) before rendering the side bar like in the canvas code, would be an easy solution. But in the future, we should check with removeColumn functions and see why it didn't trigger the removing function with the safe fallback.

@ananzh
Copy link
Member

ananzh commented Dec 21, 2023

Close it as it is resolved in #5537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data explorer Issues related to the Data Explorer project discover for discover reinvent v2.12.0
Projects
None yet
Development

No branches or pull requests

3 participants