-
Notifications
You must be signed in to change notification settings - Fork 915
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 logic to collect VisLayer
s in line chart render flow
#3131
Add logic to collect VisLayer
s in line chart render flow
#3131
Conversation
VisLayer
s in line chart render flow
Some of the new imports won't resolve until earlier PRs have been merged and I can rebase here. Until then you can ignore those |
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## feature/feature-anywhere #3131 +/- ##
============================================================
- Coverage 66.59% 66.53% -0.07%
============================================================
Files 3212 3216 +4
Lines 61468 61506 +38
Branches 9474 9476 +2
============================================================
- Hits 40937 40924 -13
- Misses 18273 18319 +46
- Partials 2258 2263 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
5dc0ee9
to
d061adf
Compare
PR is rebased and ready. Please read PR description before starting the review |
@@ -138,6 +147,7 @@ export class VisualizeEmbeddable | |||
VisualizeByReferenceInput | |||
>, | |||
savedVisualizationsLoader?: SavedVisualizationsLoader, | |||
savedAugmentVisLoader?: SavedAugmentVisLoader, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We can declare this private here which will combine lines 138
and 173
below
private savedAugmentVisLoader?: SavedAugmentVisLoader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean here. It is declared private on 138, and line 150 is just specifying an arg in the constructor. I was following the patterns for the rest of the visualize_embeddable
private fields, and am consistent with the existing savedVisualizationsLoader
objs.forEach((obj: ISavedAugmentVis) => { | ||
visLayerExpressionFns.push( | ||
buildExpressionFunction<VisLayerFunctionDefinition>( | ||
obj.visLayerExpressionFn.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doubt: We call this as expressionFn but I am not sure if it has an actual function implementation associated with it because from the type I see it has a name and args associated with it. Can you point me to a place that can help me understand this better? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure - it's defined in src/plugins/vis_augmenter/public/types.ts
in #3109. Essentially it's an interface that defines how to run a plugin-defined expression function. type
represents the return type of the expression function (same as existing expression functions), name
is the name of the registered function, and args
is the loosely-typed field for plugins to add their own args. An example would be something like an add_anomalies
function defined in the AD plugin, which would collect anomalies and return the return type.
These functions are then read here and parsed out to create a single expressions string pipeline, where when executed, will collect all VisLayer
s.
See details and diagrams in the meta issue #2880
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall.
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
c881755
to
1687089
Compare
@ohltyler I re-ran the tests couple times, seem like it is failing some of the vis builder functional tests.
|
this is unrelated to our change and could be due to the ongoing visbuilder changes and what is currently merged in our feature branch. I think this can be ignored and we can ensure all tests are passing consistently when finally merging into cc @joshuarrrr who is tracking any errors that pop up in these runs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just commented a couple nits.
src/plugins/visualizations/public/embeddable/visualize_embeddable.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
9e88967
to
c0b8771
Compare
@abbyhu2000 I've refactored a few of the types & interfaces into separate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ohltyler Thank you for addressing the comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits and code style suggestions, but no blockers. I think using find
instead of findAll
would be the most significant improvement.
Also, thanks @ohltyler for the useful PR description!
src/plugins/visualizations/public/embeddable/visualize_embeddable.ts
Outdated
Show resolved
Hide resolved
src/plugins/visualizations/public/embeddable/visualize_embeddable.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
2ff94b2
to
4de53b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one linting failure - you should be able to accept my change, and then I'll re-approve.
src/plugins/visualizations/public/embeddable/visualize_embeddable.ts
Outdated
Show resolved
Hide resolved
…ble.ts Signed-off-by: Josh Romero <rmerqg@amazon.com>
Description
This PR adds the logic for collecting & parsing
VisLayer
s to eventually be read by the downstream render expressions functions. More details can be found in the related issueMost of the new logic is happening in the
fetchVisLayers()
function ofvisualize_embeddable
(it is calling new helper functions added inutils
). This is ran whenever there are changes that affect the embeddable such that it needs to be re-rendered. In our use case, we will want to dynamically fetch updatedVisLayer
s whenever there are such changes, since the layers themselves are dynamically generated based on the context for the existing visualization (time range, filter, query). After anyVisLayer
s are collected, they are passed to the finalbuildPipeline
fn which constructs the end-to-end string pipeline to execute and render the entire visualization.The final processing of the
VisLayer
s will be handled in 2 more PRs:toExpressionAst()
fn for line chart visualizations as part of Create switch to render line charts using vega-lite #3106VisLayer
s and dynamically update the vega spec as part of Dynamically update vega spec to showVisLayer
s #3145Other things to note:
vis_augmenter/common
are moved tovis_augmenter/public
. This affects the files themselves + where they were being imported. There is no changes to the content of the files, so they don't need much review/attentionisEligibleForVisLayers()
helper fn is a placeholder for now - deeper logic will be added for that in the related issue [Feature Anywhere] Finalize eligibility based on vis configuration #3268. I've linked that in the code, and will also add a note in that issue to make sure this is tracked properlyIssues Resolved
Closes #3122
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr