-
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] Add validation on operation with no fields #98295
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
@elasticmachine merge upstream |
It's still rendered as an empty dimension - should we make sure to also show an error in the dimension trigger similar to how calculations handle this? The original issue mentions this. |
Yes, I thought about that. I guess we have to decide what to show: in the calculation case it's easier as the referenced column is gone, but the referencing one still holds the label. We could have a placeholder for this case. What do you think? |
@dej611 Not sure what you have in mind as placeholder, but in this situation the visualization still thinks there's a column while the datasource removed it, right? We could detect this situation and render |
Yes, I meant "what to write in the space" as placeholder. I'll add the proposed copy. |
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 tested this and found a new error that this introduces:
- Create 2 metrics
- Delete the field of one metric
- Drag the metric to change its order, and you get an error in
export function hasField(column: BaseIndexPatternColumn): column is FieldBasedIndexPatternColumn {
return 'sourceField' in column;
}
Good point @wylieconlon . This makes me think whether this is the right way of handling backspace for the field in the first place: kibana/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_select.tsx Line 198 in f667aa2
Should we just set the |
@flash1293 would we use your proposal (setting a field to the empty string) when we switch between operations and the field is not compatible? We have two similar cases:
|
@mbondyra IMHO it's nice the last valid state is kept in this case. That got me thinking - maybe we should just not do anything if the user tries to delete the field? We can totally do this - it's as simple as removing the |
Agreed, I also like this option better, let's just test it for fullReference operations too (if it's not worse than the bug we have here #97431) |
@flash1293 backspace does not do anything, but whitespace still clears the field input. I think it's still acceptable as behaviour, just documenting it. If we all agree on that I can do on that direction. |
@dej611 Good point, I think that's fine |
Ok, I'll create a separate PR as this one will need to be completely reverted 😅 |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Summary
Fixes #89032
This PR adds one more level of validation to the datasource, checking for inconsistencies between the data and the visualization states.
Note: datatable has an additional issue #98288 when cleaning up field information, hence it was not possible to show
Rows
andColumns
filled with empty dimensions.Checklist