-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Extend Datasource props validation with VisualizationGroups #82607
[Lens] Extend Datasource props validation with VisualizationGroups #82607
Conversation
…lay-error-workspace
…lay-error-workspace
…it as building state
…/datasource-groups-validation
…/datasource-groups-validation
…source-groups-validation
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.
Hey, seems like the getErrorMessages
extension is not complete.
x-pack/plugins/lens/public/types.ts
Outdated
getErrorMessages: (state: T) => Array<{ shortMessage: string; longMessage: string }> | undefined; | ||
getErrorMessages: ( | ||
state: T, | ||
groups?: VisualizationDimensionGroupConfig[] |
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.
You added the groups as an optional parameter here, but in the places getErrorMessages
is actually called they are not passed in (in workspace and suggestion panel)
Pinging @elastic/kibana-app (Team:KibanaApp) |
@@ -104,8 +104,18 @@ export const validateDatasourceAndVisualization = ( | |||
longMessage: string; | |||
}> | |||
| undefined => { | |||
const layersGroups = | |||
currentVisualizationState && | |||
currentVisualization?.getLayerIds(currentVisualizationState).map((layerId) => { |
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 has to be a map (with the keys being the layer id) - otherwise the datasource won't be able to map the right group arrays back to the right internal layer representation.
The type should be
getErrorMessages: (
state: T,
layersGroups?: Record<string, VisualizationDimensionGroupConfig[]>
) => Array<{ shortMessage: string; longMessage: string }> | undefined;
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.
It is an array, so always in order, so it shouldn't be a problem: probably the implementation will need to identify layers index anyway internally to output a better contextual message.
I understand it may be also useful to have a lookup by layerId
, I'll update.
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]async chunks size
History
To update your PR or re-run it, just comment with: |
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, code review only
…lastic#82607) * ✨ First pass with visualization validation + error messages * 🔥 Remove indexpattern error handling for now * 🏷️ Fix type issues * ✅ Add getErrorMessage test for data table * ✅ Add tests for pie and metric error messages * 🌐 Fix i18n checks issues * 🐛 Fix last issue * ✅ Add more tests for the XY visualization validation code * 👌 Included all feedback from first review * ✏️ Off by one message * 🌐 Fix i18n duplicate id * 🌐 Fix last i18n issue * 🐛 Fixed a hook reflow issue * ♻️+✅ Reworked validation flow + tests * 🏷️ Fix type issue * 🐛 Improved XY corner cases validation logic * 🐛 Fix empty datatable scenario * ✨ + ✅ Improved error messages for invalid datasources + tests * 🌐 Add missing i18n translation * 🏷️ Fix type issues * 🌐 Fix i18n issues * ✨ Filter out suggestions which fail to build * 🚚 Migrate datatable validation logic to the building phase, handling it as building state * 🏷️ Fix type issue * ✏️ Add comment for future enhancements * ✏️ Updated comment * :world_with_meridians: Refactor axis labels * 🌐 Reworked few validation messages * 🐛 Fix break down validation + percentage charts * ✅ Align tests with new validation logic * ♻️ Fix suggestion panel validation to match main panel * 🌐 Fix i18n issues * 🔧 Fix some refs for validation checks in suggestions * 🐛 Fix missing key prop in multiple errors scenario * 🐛 Fix swtich issue from XY to partition * 🌐 Fix i18n messages and aligned tests * 🐛 Fix suggestions switching bug * :refactor: Add more validation + refactored validation logic in a single place * ✏️ Add note about lint hooks disable rule * 🚨 Fix linting issue * 🏗️ Add infra API for datasource advanced validation * ✅ Align tests with new API * ✅ Fix type issues in tests * 👌 Early exists added * ✨ Add layers groups to the API * ✅ Fix some broken test after the validation change * 👌 Move to disctionary shape Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…ups (#82607) (#82958) * ✨ First pass with visualization validation + error messages * 🔥 Remove indexpattern error handling for now * 🏷️ Fix type issues * ✅ Add getErrorMessage test for data table * ✅ Add tests for pie and metric error messages * 🌐 Fix i18n checks issues * 🐛 Fix last issue * ✅ Add more tests for the XY visualization validation code * 👌 Included all feedback from first review * ✏️ Off by one message * 🌐 Fix i18n duplicate id * 🌐 Fix last i18n issue * 🐛 Fixed a hook reflow issue * ♻️+✅ Reworked validation flow + tests * 🏷️ Fix type issue * 🐛 Improved XY corner cases validation logic * 🐛 Fix empty datatable scenario * ✨ + ✅ Improved error messages for invalid datasources + tests * 🌐 Add missing i18n translation * 🏷️ Fix type issues * 🌐 Fix i18n issues * ✨ Filter out suggestions which fail to build * 🚚 Migrate datatable validation logic to the building phase, handling it as building state * 🏷️ Fix type issue * ✏️ Add comment for future enhancements * ✏️ Updated comment * :world_with_meridians: Refactor axis labels * 🌐 Reworked few validation messages * 🐛 Fix break down validation + percentage charts * ✅ Align tests with new validation logic * ♻️ Fix suggestion panel validation to match main panel * 🌐 Fix i18n issues * 🔧 Fix some refs for validation checks in suggestions * 🐛 Fix missing key prop in multiple errors scenario * 🐛 Fix swtich issue from XY to partition * 🌐 Fix i18n messages and aligned tests * 🐛 Fix suggestions switching bug * :refactor: Add more validation + refactored validation logic in a single place * ✏️ Add note about lint hooks disable rule * 🚨 Fix linting issue * 🏗️ Add infra API for datasource advanced validation * ✅ Align tests with new API * ✅ Fix type issues in tests * 👌 Early exists added * ✨ Add layers groups to the API * ✅ Fix some broken test after the validation change * 👌 Move to disctionary shape Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
This PR is the second part of #80127, built on top of #81439, so it requires it to be merged before merging this one.
The purpose of this PR is to create a basic infrastructure for future advanced checks on the Dimension Editor in Lens.