-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Navigating from Field statistics tab to text based languages should return to the documents view #152572
Conversation
…es should return to the documents view
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.
@jughosta wanna iterate on that? you seem to have solved the issue in the embeddable, to solve in in the state, it should work like this:
kibana/src/plugins/discover/public/application/main/hooks/use_text_based_query_language.ts
Lines 110 to 114 in c486a16
const nextState = { | |
...(addDataViewToState && { index: dataViewObj.id }), | |
...(addColumnsToState && { columns: nextColumns }), | |
}; |
const nextState = {
...(addDataViewToState && { index: dataViewObj.id }),
...(addColumnsToState && { columns: nextColumns }),
...(viewMode === VIEW_MODE.AGGREGATED_LEVEL && { viewMode: VIEW_MODE.DOCUMENT_LEVEL }),
};
# Conflicts: # src/plugins/discover/public/application/main/components/layout/discover_main_content.tsx
@kertal Thanks! The suggestion works! |
Great, glad I could help! |
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
const recordRawType = getRawRecordType(query); | ||
return recordRawType === RecordRawType.PLAIN; |
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.
isPlainRecord
would also be an option here
export function isPlainRecord(query?: Query | AggregateQuery): query is AggregateQuery { |
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.
Thx for brining this over the finishing line! 👍 Code LGTM
One last thing to consider, given a saved search is already persisted with the aggregated view , then we might take this into consideration when building the initial state
It could be done here
kibana/src/plugins/discover/public/application/main/utils/get_state_defaults.ts
Lines 83 to 86 in fba936c
if (savedSearch.viewMode) { | |
defaultState.viewMode = savedSearch.viewMode; | |
} | |
if (savedSearch.hideAggregatedPreview) { |
Like this:
if (savedSearch.viewMode && !isPlainRecord(query)) {
defaultState.viewMode = savedSearch.viewMode;
}
wdyt?
We might also consider to rename |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsasync chunk count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @jughosta |
@kertal Updated Thanks for the feedback! |
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.
Thx for fixing it, adding tests and making the code prettier 🙇 Tested locally, works as expected. No more desperate people in SQL trying to leave field statistics!
…es should return to the documents view (elastic#152572) Closes elastic#152485 ~Would be better to override this somewhere in app state management logic but I could not find a right place for it.~ Done Current changes make sure that for text-based queries only grid view is possible (both on Discover and as embeddable) and the app state will be updated accordingly. (cherry picked from commit f528b34)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…anguages should return to the documents view (#152572) (#156010) # Backport This will backport the following commits from `main` to `8.8`: - [[Discover] Navigating from Field statistics tab to text based languages should return to the documents view (#152572)](#152572) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Rechkunova","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-04-27T13:43:32Z","message":"[Discover] Navigating from Field statistics tab to text based languages should return to the documents view (#152572)\n\nCloses https://github.com/elastic/kibana/issues/152485\r\n~Would be better to override this somewhere in app state management\r\nlogic but I could not find a right place for it.~ Done\r\n\r\nCurrent changes make sure that for text-based queries only grid view is\r\npossible (both on Discover and as embeddable) and the app state will be\r\nupdated accordingly.","sha":"f528b34512171455a70c89c13d012feca4f67f61","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","release_note:fix","Team:DataDiscovery","backport:prev-minor","v8.9.0"],"number":152572,"url":"https://github.com/elastic/kibana/pull/152572","mergeCommit":{"message":"[Discover] Navigating from Field statistics tab to text based languages should return to the documents view (#152572)\n\nCloses https://github.com/elastic/kibana/issues/152485\r\n~Would be better to override this somewhere in app state management\r\nlogic but I could not find a right place for it.~ Done\r\n\r\nCurrent changes make sure that for text-based queries only grid view is\r\npossible (both on Discover and as embeddable) and the app state will be\r\nupdated accordingly.","sha":"f528b34512171455a70c89c13d012feca4f67f61"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/152572","number":152572,"mergeCommit":{"message":"[Discover] Navigating from Field statistics tab to text based languages should return to the documents view (#152572)\n\nCloses https://github.com/elastic/kibana/issues/152485\r\n~Would be better to override this somewhere in app state management\r\nlogic but I could not find a right place for it.~ Done\r\n\r\nCurrent changes make sure that for text-based queries only grid view is\r\npossible (both on Discover and as embeddable) and the app state will be\r\nupdated accordingly.","sha":"f528b34512171455a70c89c13d012feca4f67f61"}}]}] BACKPORT--> Co-authored-by: Julia Rechkunova <[email protected]>
Closes #152485
Would be better to override this somewhere in app state management logic but I could not find a right place for it.DoneCurrent changes make sure that for text-based queries only grid view is possible (both on Discover and as embeddable) and the app state will be updated accordingly.