Skip to content
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] View mode changes should trigger Unsaved changes badge in ES|QL #187244

Merged
merged 5 commits into from
Jul 5, 2024

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Jul 1, 2024

Summary

This PR updates the logic to show Unsaved changes badge when view mode changes in ES|QL mode.

Checklist

@jughosta jughosta added release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Jul 1, 2024
@jughosta jughosta self-assigned this Jul 1, 2024
@jughosta
Copy link
Contributor Author

jughosta commented Jul 1, 2024

/ci

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #90 / cases security and spaces enabled: basic Common migrations migrations 8.0 id migration awesome space "before all" hook in "awesome space"

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 809.1KB 809.3KB +140.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jughosta

@jughosta jughosta marked this pull request as ready for review July 1, 2024 14:30
@jughosta jughosta requested a review from a team as a code owner July 1, 2024 14:30
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Comment on lines +410 to +414
if (fieldName === 'viewMode') {
// By default, viewMode: undefined is equivalent to documents view
// So they should be treated as same
return savedSearch.viewMode ?? VIEW_MODE.DOCUMENT_LEVEL;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and this PR fixes the issue 👍. one ask, this is the actual fix of the problem, right? Could you add a unit test for it in discover_saved_search_container.test.ts? it would be great to increase coverage in this case 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kertal The actual fix is in src/plugins/discover/public/application/main/state_management/utils/build_state_subscribe.ts. Here it's only a stylistic choice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added more tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it, thx a lot for adding more tests anyway 👍

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx a lot for fixing this, and adding more tests on top, even if they were not necessary for catching the bug 👍

@jughosta jughosta enabled auto-merge (squash) July 5, 2024 13:22
@jughosta jughosta merged commit 25d7346 into elastic:main Jul 5, 2024
22 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 809.1KB 809.3KB +140.0B

History

cc @jughosta

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 5, 2024
…ES|QL (elastic#187244)

- Closes elastic#184624

## Summary

This PR updates the logic to show Unsaved changes badge when view mode
changes in ES|QL mode.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Matthias Wilhelm <[email protected]>
(cherry picked from commit 25d7346)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 8, 2024
kibanamachine added a commit that referenced this pull request Jul 9, 2024
…dge in ES|QL (#187244) (#187687)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Discover] View mode changes should trigger Unsaved changes badge in
ES|QL (#187244)](#187244)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julia
Rechkunova","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-05T14:46:00Z","message":"[Discover]
View mode changes should trigger Unsaved changes badge in ES|QL
(#187244)\n\n- Closes
https://github.com/elastic/kibana/issues/184624\r\n\r\n##
Summary\r\n\r\nThis PR updates the logic to show Unsaved changes badge
when view mode\r\nchanges in ES|QL mode.\r\n\r\n### Checklist\r\n\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Matthias Wilhelm
<[email protected]>","sha":"25d73466c3e1afff0c17b7f8800f92449e9480a8","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:DataDiscovery","backport:prev-minor","v8.16.0"],"title":"[Discover]
View mode changes should trigger Unsaved changes badge in
ES|QL","number":187244,"url":"https://github.com/elastic/kibana/pull/187244","mergeCommit":{"message":"[Discover]
View mode changes should trigger Unsaved changes badge in ES|QL
(#187244)\n\n- Closes
https://github.com/elastic/kibana/issues/184624\r\n\r\n##
Summary\r\n\r\nThis PR updates the logic to show Unsaved changes badge
when view mode\r\nchanges in ES|QL mode.\r\n\r\n### Checklist\r\n\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Matthias Wilhelm
<[email protected]>","sha":"25d73466c3e1afff0c17b7f8800f92449e9480a8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/187244","number":187244,"mergeCommit":{"message":"[Discover]
View mode changes should trigger Unsaved changes badge in ES|QL
(#187244)\n\n- Closes
https://github.com/elastic/kibana/issues/184624\r\n\r\n##
Summary\r\n\r\nThis PR updates the logic to show Unsaved changes badge
when view mode\r\nchanges in ES|QL mode.\r\n\r\n### Checklist\r\n\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Matthias Wilhelm
<[email protected]>","sha":"25d73466c3e1afff0c17b7f8800f92449e9480a8"}}]}]
BACKPORT-->

Co-authored-by: Julia Rechkunova <[email protected]>
@kibanamachine kibanamachine added v8.15.0 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Jul 9, 2024
@jughosta jughosta deleted the 184624-fix-view-mode-state branch July 9, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.15.0 v8.16.0
Projects
None yet
5 participants