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

Add interfaces for layering data on Visualizations #3108

Merged

Conversation

ohltyler
Copy link
Member

@ohltyler ohltyler commented Dec 19, 2022

Description

This PR adds the interfaces related to layering data on top of a visualization. These are persisted in the new vis_augmenter plugin. Also defines the expressions function definition and expressions type for the new vis layers (details on the expression function design in the related issue)

Note that currently the only implemented VisLayer is PointInTimeEventsVisLayer. Details on this design, as well as future possible VisLayer implementations, can be found in the related issue.

Issues Resolved

Closes #2882
Closes #2894

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 requested a review from a team as a code owner December 19, 2022 23:07
@ohltyler ohltyler marked this pull request as draft December 19, 2022 23:07
@ohltyler
Copy link
Member Author

Keeping as draft until #3107 has been reviewed & merged; I will then rebase this PR

@ohltyler ohltyler changed the title Add vis layers Add interface for layering data on Visualizations Dec 19, 2022
@ohltyler ohltyler changed the base branch from main to feature/feature-anywhere December 19, 2022 23:35
@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2022

Codecov Report

Merging #3108 (25276e4) into feature/feature-anywhere (ba6f9eb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@                    Coverage Diff                    @@
##           feature/feature-anywhere    #3108   +/-   ##
=========================================================
  Coverage                     66.67%   66.67%           
=========================================================
  Files                          3219     3220    +1     
  Lines                         61450    61454    +4     
  Branches                       9417     9417           
=========================================================
+ Hits                          40969    40973    +4     
  Misses                        18234    18234           
  Partials                       2247     2247           
Impacted Files Coverage Δ
src/plugins/vis_augmenter/common/types.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ohltyler ohltyler mentioned this pull request Dec 22, 2022
8 tasks
@ohltyler ohltyler changed the title Add interface for layering data on Visualizations Add interfaces for layering data on Visualizations Dec 22, 2022
@ohltyler ohltyler force-pushed the add-vis-layers branch 2 times, most recently from 342bc10 to d42e4fe Compare December 22, 2022 19:26
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
@ohltyler ohltyler added the Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry label Dec 22, 2022
@ohltyler ohltyler marked this pull request as ready for review December 22, 2022 19:34
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
src/plugins/plugin_integration/public/types.ts Outdated Show resolved Hide resolved
src/plugins/plugin_integration/public/types.ts Outdated Show resolved Hide resolved
src/plugins/plugin_integration/public/types.ts Outdated Show resolved Hide resolved
src/plugins/plugin_integration/public/types.ts Outdated Show resolved Hide resolved
src/plugins/vis_augmenter/common/types.ts Show resolved Hide resolved
src/plugins/vis_augmenter/common/types.ts Outdated Show resolved Hide resolved
src/plugins/vis_augmenter/common/types.ts Show resolved Hide resolved
Comment on lines 35 to 39
// used to determine what vis layer's interface is being implemented.
// currently PointInTimeEventsLayer is the only interface extending VisLayer
export const isPointInTimeEventsVisLayer = (obj: any) => {
return 'events' in obj;
};
Copy link
Member

Choose a reason for hiding this comment

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

How are you imagining this to be used? It seems like it would be simpler to have a static type string on the VisLayer interface that you can specify when defining a particular type of VisLayer, and then just access as a value. This type of convenient method may still be helpful, but it's actually implemented as more a capability check.

Copy link
Member Author

@ohltyler ohltyler Dec 24, 2022

Choose a reason for hiding this comment

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

Agreed, existing soln seemed hacky. Updated to use enums in latest commits. Also added a general isValidVisLayer fn that can be ran when verifying the new saved object types are valid or not, based on expression function type

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Copy link
Member

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the improvements and the tests!

Comment on lines 35 to 43
// used to determine what vis layer's interface is being implemented.
// currently PointInTimeEventsLayer is the only interface extending VisLayer
export const isPointInTimeEventsVisLayer = (obj: any) => {
return 'events' in obj;
return obj?.type === VisLayerTypes.PointInTimeEvents;
};

export const isValidVisLayer = (obj: any) => {
return obj?.type in VisLayerTypes;
};
Copy link
Member

Choose a reason for hiding this comment

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

nice, this seems much more clear to me.

@joshuarrrr joshuarrrr added the v2.5.0 'Issues and PRs related to version v2.5.0' label Dec 29, 2022
@manasvinibs
Copy link
Member

Do we know why cypress tests are failing here or is it expected?
Also I see WhiteSource security check failing as 7 new vulnerabilities being flagged with this change. Does it require rebase with the main to include fixes ?

@joshuarrrr
Copy link
Member

Do we know why cypress tests are failing here or is it expected? Also I see WhiteSource security check failing as 7 new vulnerabilities being flagged with this change. Does it require rebase with the main to include fixes ?

Yes, cypress test failures are to be expected for feature branches right now, based on the way those workflows are configured. I also think we can ignore whitesource checks when merging to the feature branch target - that's something we can make sure of as we rebase the feature branch and when we merge it into main.

@joshuarrrr joshuarrrr merged commit e78ccbf into opensearch-project:feature/feature-anywhere Dec 30, 2022
@ohltyler
Copy link
Member Author

ohltyler commented Jan 5, 2023

@joshuarrrr #3107 will need to be merged to 2.x before this backport PR can be opened

@joshuarrrr joshuarrrr removed backport 2.x v2.5.0 'Issues and PRs related to version v2.5.0' labels Jan 5, 2023
@joshuarrrr
Copy link
Member

This shouldn't be backported - sorry, forgot we were working on a feature branch here.

ohltyler added a commit to ohltyler/OpenSearch-Dashboards that referenced this pull request Feb 1, 2023
…t#3108)

* Add vis layer interfaces

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
ohltyler added a commit to ohltyler/OpenSearch-Dashboards that referenced this pull request Feb 1, 2023
…t#3108)

* Add vis layer interfaces

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Anywhere] Add a generic interface for overlaying data on a Visualization
4 participants