-
Notifications
You must be signed in to change notification settings - Fork 916
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
[Vis Builder] Misc Bar chart fixes #2401
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2401 +/- ##
=======================================
Coverage 66.75% 66.75%
=======================================
Files 3194 3196 +2
Lines 60803 60813 +10
Branches 9238 9240 +2
=======================================
+ Hits 40587 40596 +9
- Misses 18008 18009 +1
Partials 2208 2208
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: Ashwin P Chandran <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>
4a6b704
to
7ee788a
Compare
Signed-off-by: Ashwin P Chandran <[email protected]>
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. Verified.
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.
A couple minor questions, but looks good!
"dashboard", | ||
"data", | ||
"embeddable", | ||
"expressions", | ||
"navigation", | ||
"savedObjects", | ||
"visualizations" | ||
], | ||
"requiredBundles": [ | ||
"charts", | ||
"data", | ||
"opensearchDashboardsReact", | ||
"opensearchDashboardsUtils", | ||
"savedObjects", | ||
"embeddable", | ||
"expressions", | ||
"dashboard", | ||
"visualizations", | ||
"opensearchUiShared", | ||
"visDefaultEditor", | ||
"visTypeVislib" | ||
], |
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.
Nice! Do you think we need better docs about when to use requiredPlugins
vs requiredBundles
?
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.
Yep! we should also add required bundles to the Plugin generation template too. I didnt know about them until you called it out
export const createHistogramConfig = (): VisualizationTypeOptions<HistogramOptionsDefaults> => ({ | ||
name: 'histogram', | ||
title: 'Histogram', | ||
title: 'Bar', |
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.
So do you still think it makes sense for the vis type name to be "histogram" (as well as the filenames), even thought the title is bar? Or would it be better to just rename to "bar" more globally?
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.
I did not update the key to bar
because vislib refers to it as histogram
. When we update the visualization to use the new library we can fix this there.
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.
ah, makes sense, thanks.
const metricAggs = useMemo( | ||
() => | ||
indexPattern | ||
? aggService.createAggConfigs( | ||
indexPattern, | ||
cloneDeep( | ||
aggConfigParams.filter((aggConfigParam) => aggConfigParam.schema === 'metric') | ||
) | ||
).aggs | ||
: [], | ||
[aggConfigParams, aggService, indexPattern] | ||
); |
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.
This seems like a bit of a hack (to have metric visualization-specific logic here instead of in /visualizations/metric
), but I may be misunderstanding what aggConfigParam.schema === 'metric'
means in this context. A comment may be helpful to clarify either way.
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.
Good call, will add a comment in a followup PR, but yes metric aggregations are different from the metric visualization. Aggregations are classiied into 2 main categories, metric and bucket aggregations. The bar, line and area chart visualizations need to know if any metric aggregations are performed to correctly calculate the auto bounds of a histogram visualization.
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.
ah, got it, that makes sense
@@ -65,6 +69,7 @@ export const TopNav = () => { | |||
config={config} | |||
setMenuMountPoint={setHeaderActionMenu} | |||
indexPatterns={indexPattern ? [indexPattern] : []} | |||
showDatePicker={!!indexPattern?.timeFieldName ?? true} |
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 - with the boolean cast, do you still need nullish coalescing?
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.
good call. will fix in followup :)
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-2401-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 83f13067fd4d5e5270037734b6ae82784ec692a5
# Push it to GitHub
git push --set-upstream origin backport/backport-2401-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.3 2.3
# Navigate to the new working tree
cd .worktrees/backport-2.3
# Create a new branch
git switch --create backport/backport-2401-to-2.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 83f13067fd4d5e5270037734b6ae82784ec692a5
# Push it to GitHub
git push --set-upstream origin backport/backport-2401-to-2.3
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.3 Then, create a pull request where the |
* consolidates state to saved object serialization Signed-off-by: Ashwin P Chandran <[email protected]> * fixes histogram agg Signed-off-by: Ashwin P Chandran <[email protected]> * fixes orderBy Signed-off-by: Ashwin P Chandran <[email protected]> * style fixes Signed-off-by: Ashwin P Chandran <[email protected]> * updates base test Signed-off-by: Ashwin P Chandran <[email protected]> * Updates changelog Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: Ashwin P Chandran <[email protected]> (cherry picked from commit 83f1306)
* consolidates state to saved object serialization Signed-off-by: Ashwin P Chandran <[email protected]> * fixes histogram agg Signed-off-by: Ashwin P Chandran <[email protected]> * fixes orderBy Signed-off-by: Ashwin P Chandran <[email protected]> * style fixes Signed-off-by: Ashwin P Chandran <[email protected]> * updates base test Signed-off-by: Ashwin P Chandran <[email protected]> * Updates changelog Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: Ashwin P Chandran <[email protected]> (cherry picked from commit 83f1306)
* consolidates state to saved object serialization Signed-off-by: Ashwin P Chandran <[email protected]> * fixes histogram agg Signed-off-by: Ashwin P Chandran <[email protected]> * fixes orderBy Signed-off-by: Ashwin P Chandran <[email protected]> * style fixes Signed-off-by: Ashwin P Chandran <[email protected]> * updates base test Signed-off-by: Ashwin P Chandran <[email protected]> * Updates changelog Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: Ashwin P Chandran <[email protected]> (cherry picked from commit 83f1306) Co-authored-by: Ashwin P Chandran <[email protected]>
* consolidates state to saved object serialization Signed-off-by: Ashwin P Chandran <[email protected]> * fixes histogram agg Signed-off-by: Ashwin P Chandran <[email protected]> * fixes orderBy Signed-off-by: Ashwin P Chandran <[email protected]> * style fixes Signed-off-by: Ashwin P Chandran <[email protected]> * updates base test Signed-off-by: Ashwin P Chandran <[email protected]> * Updates changelog Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: Ashwin P Chandran <[email protected]> (cherry picked from commit 83f1306) Co-authored-by: Ashwin P Chandran <[email protected]>
* consolidates state to saved object serialization Signed-off-by: Ashwin P Chandran <[email protected]> * fixes histogram agg Signed-off-by: Ashwin P Chandran <[email protected]> * fixes orderBy Signed-off-by: Ashwin P Chandran <[email protected]> * style fixes Signed-off-by: Ashwin P Chandran <[email protected]> * updates base test Signed-off-by: Ashwin P Chandran <[email protected]> * Updates changelog Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: Sergey V. Osipov <[email protected]>
Description
This fixes the following issues with the VisBuilder bar chart:
src/plugins/wizard/public/visualizations/vislib/common/create_vis.ts
metricAggs
insrc/plugins/wizard/public/application/components/data_tab/secondary_panel.tsx
Misc styling fixes in
src/plugins/wizard/public/application/components/workspace.scss
: Reduces animation impactsrc/plugins/wizard/public/application/components/data_tab/config_panel.scss
: fixes incorrect margin for custom styledvisEditorAggParam
Misc improvements:
src/plugins/wizard/public/saved_visualizations/transforms.ts
requiredBundles
insrc/plugins/wizard/opensearch_dashboards.json
The changes are split by commits.
Issues Resolved
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr