-
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
[Discover] Rely on dataSource
for ES|QL mode
#183108
[Discover] Rely on dataSource
for ES|QL mode
#183108
Conversation
/ci |
3 similar comments
/ci |
/ci |
/ci |
034d0a4
to
a936f16
Compare
/ci |
a936f16
to
eb3556d
Compare
/ci |
dataSource
for ES|QL mode
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
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.
Awesome! Thanks for the clean up!
I did not see any issues which would be reproducible. At some point I could not switch to Field Statistics tab, another time the histogram was missing - but I can't get to these issues again, maybe something to keep an eye on.
it('should include DocumentViewModeToggle when isPlainRecord is true', async () => { | ||
const component = await mountComponent({ isPlainRecord: true }); | ||
it('should include DocumentViewModeToggle when in ES|QL mode', async () => { | ||
const component = await mountComponent(); |
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.
These tests look the same now 🤔
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.
Yeah, @davismcphee I think we don't need both
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 catch! I updated the test to correctly set this one to ES|QL mode: 42afbd3.
@@ -215,13 +211,13 @@ export const DiscoverTourProvider = ({ | |||
); | |||
const tourSteps = useMemo( | |||
() => | |||
isPlainRecord |
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.
Oh, I think we don't need this condition anymore. Looks like ES|QL now also supports all the mentioned functionality.
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.
@davismcphee it so nice to see this go away ... the naming wasn't good anyway, I wonder who ... ah .. it was me :)
I wonder why I didn't I name this isBoringRecord
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.
What is it about? What is the mentioned functionality?
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.
@stratoula It's a tour explaining how to use the data grid. For data view mode it has more steps configured.
I can address that separately to show all steps for ES|QL mode too, since we've added more features to it.
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.
Sounds fantastic, thanx Julia!
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.
Makes sense, but yes let's include them in a separate PR to avoid any functionality changes in this one. I opened an issue for it here: #183791.
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.
@@ -416,12 +408,12 @@ function DiscoverDocumentsComponent({ | |||
rowHeightState={rowHeight} | |||
onUpdateRowHeight={onUpdateRowHeight} | |||
isSortEnabled={true} | |||
isPlainRecord={isTextBasedQuery} | |||
isPlainRecord={isEsqlMode} |
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.
Why here we are keeping the isPlainRecord
and we dont change the prop to isEsqlMode
? I see that we are doing this in other places
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.
Because this component is a trick 😄 It's actually inheriting the props from Unified Data Table, and I wanted to keep this PR limited to the Discover codebase. But it would be a good idea to make similar changes within our shared components too separately.
it('should include DocumentViewModeToggle when isPlainRecord is true', async () => { | ||
const component = await mountComponent({ isPlainRecord: true }); | ||
it('should include DocumentViewModeToggle when in ES|QL mode', async () => { | ||
const component = await mountComponent(); |
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.
Yeah, @davismcphee I think we don't need both
@@ -215,13 +211,13 @@ export const DiscoverTourProvider = ({ | |||
); | |||
const tourSteps = useMemo( | |||
() => | |||
isPlainRecord |
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.
What is it about? What is the mentioned functionality?
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @davismcphee |
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.
Thanks @jughosta and @stratoula for the feedback! I fixed the Jest test and created a followup issue for the Discover tour. I'm going to merge this PR now since it's a merge conflict magnet 🧲 with all these file changes.
I did not see any issues which would be reproducible. At some point I could not switch to Field Statistics tab, another time the histogram was missing - but I can't get to these issues again, maybe something to keep an eye on.
This is interesting, although I also tried quite a bit to reproduce and was unable to. I agree, let's proceed with this PR since none of us can reproduce it, and keep an eye out for those issues.
it('should include DocumentViewModeToggle when isPlainRecord is true', async () => { | ||
const component = await mountComponent({ isPlainRecord: true }); | ||
it('should include DocumentViewModeToggle when in ES|QL mode', async () => { | ||
const component = await mountComponent(); |
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 catch! I updated the test to correctly set this one to ES|QL mode: 42afbd3.
@@ -215,13 +211,13 @@ export const DiscoverTourProvider = ({ | |||
); | |||
const tourSteps = useMemo( | |||
() => | |||
isPlainRecord |
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.
Makes sense, but yes let's include them in a separate PR to avoid any functionality changes in this one. I opened an issue for it here: #183791.
@@ -416,12 +408,12 @@ function DiscoverDocumentsComponent({ | |||
rowHeightState={rowHeight} | |||
onUpdateRowHeight={onUpdateRowHeight} | |||
isSortEnabled={true} | |||
isPlainRecord={isTextBasedQuery} | |||
isPlainRecord={isEsqlMode} |
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.
Because this component is a trick 😄 It's actually inheriting the props from Unified Data Table, and I wanted to keep this PR limited to the Discover codebase. But it would be a good idea to make similar changes within our shared components too separately.
Summary
This PR updates Discover to rely on
dataSource
for determining if ES|QL mode is enabled instead of relying onquery
directly. This creates a clearer separation between the modes and moves Discover toward supporting multiple data source types. It also includes a number of cleanups around ES|QL mode that make the intent of the code clearer and removes tech debt / code duplication.Changes included in the PR:
useIsEsqlMode
hook that relies ondataSource
for checking if Discover is in ES|QL mode.dataSource
checks.isPlainRecord
and replace them with ES|QLdataSource
checks.isTextBasedQuery
utility function and replace it with ES|QLdataSource
checks orisOfAggregateQueryType
where casting is necessary.isOfAggregateQueryType
with ES|QLdataSource
checks except where casting is necessary.Closes #181963.
Checklist
For maintainers