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

[Feature Anywhere] Fix bug of tooltip showing 'undefined' in certain cases #4281

Conversation

ohltyler
Copy link
Member

Description

There is a bug where the event tooltips will show 'undefined' when there are multiple source resource types, but not all are populated for a particular time bucket. This fixes that by pre-populated 0 values for all resource type columns, such that when any are non-zero, the rest will show as 0.

Note there is some optimizations and potential vega upgrades that can solve this, but the current solution would require modifying the spec at the vega-level to implement the tooltip via signals. To keep things simplified, we go with this approach to keep things at the abstracted vega-lite level (example of using signals to validate datapoints: see here)

Screenshot

Before:
Screenshot 2023-06-13 at 10 24 09 AM

After:
Screenshot 2023-06-13 at 10 45 43 AM

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@ohltyler ohltyler added bug Something isn't working feature-anywhere v2.9.0 labels Jun 13, 2023
@ohltyler ohltyler changed the title [Feature Anywhere] Fix bug of tooltip showing 'undefined' when multiple resource types where not all are populated [Feature Anywhere] Fix bug of tooltip showing 'undefined' in certain cases Jun 13, 2023
@ohltyler
Copy link
Member Author

ohltyler commented Jun 13, 2023

Tests pass for these changes. Existing test failures are fixed in #4269 - can rebase there to ensure all are passing after that one is merged.

// below case should not happen since only VisLayers with a populated
// set of events should be passed from the plugins. but, if it does
// happen, we can handle it more gracefully instead of throwing an error
it('vis layer with empty events adds nothing to datatable', function () {
Copy link
Member

Choose a reason for hiding this comment

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

Why are we removing this test? Is it because it would not be empty and have placeholder 0 values? If so, we should modify the test for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

The test is invalid now, since it was testing that nothing would be added to the datatable. But now we add 0s. The rest of the tests handle such scenarios

Copy link
Member Author

Choose a reason for hiding this comment

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

Additionally the test was hacky to begin with. The scenario should never happen and other tests to ensure the logic should never reach this state are already tested.

@codecov
Copy link

codecov bot commented Jun 13, 2023

Codecov Report

Merging #4281 (9ffdafc) into feature/feature-anywhere (1009efe) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@                     Coverage Diff                      @@
##           feature/feature-anywhere    #4281      +/-   ##
============================================================
+ Coverage                     66.29%   66.35%   +0.05%     
============================================================
  Files                          3271     3271              
  Lines                         62943    62947       +4     
  Branches                       9741     9741              
============================================================
+ Hits                          41731    41766      +35     
+ Misses                        18865    18838      -27     
+ Partials                       2347     2343       -4     
Flag Coverage Δ
Linux 66.30% <100.00%> (+<0.01%) ⬆️
Windows 66.29% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/plugins/vis_augmenter/public/test_constants.ts 100.00% <100.00%> (ø)
src/plugins/vis_augmenter/public/vega/helpers.ts 78.67% <100.00%> (-0.12%) ⬇️

... and 6 files with indirect coverage changes

@lezzago lezzago merged commit 83e2ff9 into opensearch-project:feature/feature-anywhere Jun 15, 2023
@ohltyler ohltyler deleted the fix-undefined-tooltip branch June 15, 2023 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants