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

[Discover] Fix toggling multi fields from doc view table #91121

Conversation

kertal
Copy link
Member

@kertal kertal commented Feb 11, 2021

Summary

This PR fixes issue with adding multi fields from the doc viewer table (the parent field was added), and improves the rendering of the Multi field header (just by spanning it's container cell). So it no longer should look like this:

screenshot-20210211-110816

@kertal kertal added the Feature:Discover Discover Application label Feb 11, 2021
@kertal kertal self-assigned this Feb 11, 2021
@kertal kertal added release_note:skip Skip the PR/issue when compiling release notes v7.12.0 v8.0.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Feb 11, 2021
@kertal kertal marked this pull request as ready for review February 11, 2021 15:29
@kertal kertal requested a review from a team February 11, 2021 15:29
@elasticmachine
Copy link
Contributor

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

@kertal kertal requested a review from majagrubic February 11, 2021 15:30
Copy link
Contributor

@majagrubic majagrubic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in Chrome on Mac OSX, works as expected 👍

@@ -54,6 +54,19 @@ export function DocViewTable({
setFieldsWithParents(arr);
}, [indexPattern, hit]);

const toggleColumn = useCallback(
(field: string) => {
if (onRemoveColumn && onAddColumn && Array.isArray(columns)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could just return early here if one of the conditions is not satisfied, so not the entire function would need to be inside an if-statement

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, agreed, it's really 🙈 , will improve

@@ -142,10 +146,12 @@ export function DocViewTable({
displayUnderscoreWarning={displayUnderscoreWarning}
isCollapsed={isCollapsed}
isCollapsible={isCollapsible}
isColumnActive={Array.isArray(columns) && columns.includes(field)}
isColumnActive={Array.isArray(columns) && columns.includes(multiField)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this check if columns is an array? it will always be at least an empty array, won't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it can be undefined in the doc view, however, no need to check for an array here, since it's an array or undefined, good catch!

@kertal
Copy link
Member Author

kertal commented Feb 15, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
discover 69.1KB 69.3KB +146.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kertal kertal merged commit 2db193b into elastic:master Feb 15, 2021
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 15, 2021
…ndition-for-hiding-recommded-allocation

* 'master' of github.com:elastic/kibana:
  [Discover] Fix toggling multi fields from doc view table (elastic#91121)
  [ML] Data Frame Analytics: ROC Curve Chart (elastic#89991)
  skip flaky suite (elastic#86948)
  skip flaky suite (elastic#91191)
  Fix date histogram time zone for rollup index (elastic#90632)
  [Search Source] Fix retrieval of unmapped fields; Add field filters (elastic#89837)
  [Logs UI] Use useMlHref hook for ML links (elastic#90935)
  Fix values of `products.min_price` field in Kibana sample ecommerce data set (elastic#90428)
  [APM] Darker shade for Error group details labels (elastic#91349)
  [Lens] Adjust new copy for 7.12 (elastic#90413)
  [ML] Unskip test. Fix modelMemoryLimit value. (elastic#91280)
  [Lens] Fix empty display name issue in XY chart (elastic#91132)
  [Lens] Improves error messages when in Dashboard (elastic#90668)
  [Lens] Keyboard-selected items follow user traversal of drop zones (elastic#90546)
  [Lens] Improves ranking feature in Top values (elastic#90749)
  [ILM] Rollover min age tooltip and copy fixes (elastic#91110)

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts
kertal added a commit to kertal/kibana that referenced this pull request Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants