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

[map embeddable] fix panel disappears from dashboard when canceling edit after dashboard save #193911

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Sep 24, 2024

Part of #193905. Broke work into separate PRs to backport map embeddable changes to 8.15.

Resolves issue for Map embeddable. The problem is that Map embeddable is using a stale result from parentApi.getAppContext. Dashboard's getAppContext changes the getCurrentPath when the dashboard has a saved object id. By using the stale results, getCurrentPath returned #/create instead of #/view/.

Test steps

  1. create new dashboard
  2. Click "Add panel" (problem also exists when using "Add from library")
  3. Select "Maps"
  4. In editor, click "Save and return"
  5. Save dashboard
  6. Click "Edit" in panel context menu
  7. In editor, click "Cancel"
  8. Ensure map panel is still displayed in dashboard

@nreese nreese added v9.0.0 v8.16.0 backport:version Backport to applied version labels v8.15.3 labels Sep 24, 2024
@nreese
Copy link
Contributor Author

nreese commented Sep 24, 2024

/ci

@nreese nreese changed the title [map] fix panel disappears from dashboard when canceling edit after dashboard save [map embeddable] fix panel disappears from dashboard when canceling edit after dashboard save Sep 24, 2024
return MAP_EMBEDDABLE_NAME;
},
onEdit: async () => {
const parentApiContext = parentApi.getAppContext();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the fix. Call getAppContext inside the scope of onEdit

@nreese nreese marked this pull request as ready for review September 24, 2024 19:39
@nreese nreese requested a review from a team as a code owner September 24, 2024 19:39
@nreese nreese added release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas labels Sep 24, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@nickpeihl nickpeihl self-requested a review September 24, 2024 20:39
Copy link
Member

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

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

lgtm!

code review and tested that the map panel does not disappear when migrating away and back to the dashboard

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

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
maps 3.0MB 3.0MB -16.0B

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

@nreese nreese merged commit 882b6fb into elastic:main Sep 24, 2024
22 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 24, 2024
…dit after dashboard save (elastic#193911)

Part of elastic#193905. Broke work into
separate PRs to backport map embeddable changes to 8.15.

Resolves issue for Map embeddable. The problem is that Map embeddable is
using a stale result from `parentApi.getAppContext`. Dashboard's
`getAppContext` changes the `getCurrentPath` when the dashboard has a
saved object id. By using the stale results, `getCurrentPath` returned
`#/create` instead of `#/view/`.

### Test steps
1. create new dashboard
2. Click "Add panel" (problem also exists when using "Add from library")
3. Select "Maps"
4.  In editor, click "Save and return"
5. Save dashboard
6. Click "Edit" in panel context menu
7. In editor, click "Cancel"
8. Ensure map panel is still displayed in dashboard

(cherry picked from commit 882b6fb)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 24, 2024
…dit after dashboard save (elastic#193911)

Part of elastic#193905. Broke work into
separate PRs to backport map embeddable changes to 8.15.

Resolves issue for Map embeddable. The problem is that Map embeddable is
using a stale result from `parentApi.getAppContext`. Dashboard's
`getAppContext` changes the `getCurrentPath` when the dashboard has a
saved object id. By using the stale results, `getCurrentPath` returned
`#/create` instead of `#/view/`.

### Test steps
1. create new dashboard
2. Click "Add panel" (problem also exists when using "Add from library")
3. Select "Maps"
4.  In editor, click "Save and return"
5. Save dashboard
6. Click "Edit" in panel context menu
7. In editor, click "Cancel"
8. Ensure map panel is still displayed in dashboard

(cherry picked from commit 882b6fb)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15
8.x

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 24, 2024
…ling edit after dashboard save (#193911) (#193929)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[map embeddable] fix panel disappears from dashboard when canceling
edit after dashboard save
(#193911)](#193911)

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

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

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-24T22:13:10Z","message":"[map
embeddable] fix panel disappears from dashboard when canceling edit
after dashboard save (#193911)\n\nPart of
#193905. Broke work
into\r\nseparate PRs to backport map embeddable changes to
8.15.\r\n\r\nResolves issue for Map embeddable. The problem is that Map
embeddable is\r\nusing a stale result from `parentApi.getAppContext`.
Dashboard's\r\n`getAppContext` changes the `getCurrentPath` when the
dashboard has a\r\nsaved object id. By using the stale results,
`getCurrentPath` returned\r\n`#/create` instead of `#/view/`.\r\n\r\n###
Test steps\r\n1. create new dashboard\r\n2. Click \"Add panel\" (problem
also exists when using \"Add from library\")\r\n3. Select \"Maps\"\r\n4.
In editor, click \"Save and return\"\r\n5. Save dashboard\r\n6. Click
\"Edit\" in panel context menu\r\n7. In editor, click \"Cancel\"\r\n8.
Ensure map panel is still displayed in
dashboard","sha":"882b6fb2f5ebef289dcbbf487ce42f83b95cc58e","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","v9.0.0","v8.16.0","backport:version","v8.15.3"],"title":"[map
embeddable] fix panel disappears from dashboard when canceling edit
after dashboard
save","number":193911,"url":"https://github.com/elastic/kibana/pull/193911","mergeCommit":{"message":"[map
embeddable] fix panel disappears from dashboard when canceling edit
after dashboard save (#193911)\n\nPart of
#193905. Broke work
into\r\nseparate PRs to backport map embeddable changes to
8.15.\r\n\r\nResolves issue for Map embeddable. The problem is that Map
embeddable is\r\nusing a stale result from `parentApi.getAppContext`.
Dashboard's\r\n`getAppContext` changes the `getCurrentPath` when the
dashboard has a\r\nsaved object id. By using the stale results,
`getCurrentPath` returned\r\n`#/create` instead of `#/view/`.\r\n\r\n###
Test steps\r\n1. create new dashboard\r\n2. Click \"Add panel\" (problem
also exists when using \"Add from library\")\r\n3. Select \"Maps\"\r\n4.
In editor, click \"Save and return\"\r\n5. Save dashboard\r\n6. Click
\"Edit\" in panel context menu\r\n7. In editor, click \"Cancel\"\r\n8.
Ensure map panel is still displayed in
dashboard","sha":"882b6fb2f5ebef289dcbbf487ce42f83b95cc58e"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193911","number":193911,"mergeCommit":{"message":"[map
embeddable] fix panel disappears from dashboard when canceling edit
after dashboard save (#193911)\n\nPart of
#193905. Broke work
into\r\nseparate PRs to backport map embeddable changes to
8.15.\r\n\r\nResolves issue for Map embeddable. The problem is that Map
embeddable is\r\nusing a stale result from `parentApi.getAppContext`.
Dashboard's\r\n`getAppContext` changes the `getCurrentPath` when the
dashboard has a\r\nsaved object id. By using the stale results,
`getCurrentPath` returned\r\n`#/create` instead of `#/view/`.\r\n\r\n###
Test steps\r\n1. create new dashboard\r\n2. Click \"Add panel\" (problem
also exists when using \"Add from library\")\r\n3. Select \"Maps\"\r\n4.
In editor, click \"Save and return\"\r\n5. Save dashboard\r\n6. Click
\"Edit\" in panel context menu\r\n7. In editor, click \"Cancel\"\r\n8.
Ensure map panel is still displayed in
dashboard","sha":"882b6fb2f5ebef289dcbbf487ce42f83b95cc58e"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <[email protected]>
kibanamachine added a commit that referenced this pull request Sep 24, 2024
…eling edit after dashboard save (#193911) (#193928)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[map embeddable] fix panel disappears from dashboard when canceling
edit after dashboard save
(#193911)](#193911)

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

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

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-24T22:13:10Z","message":"[map
embeddable] fix panel disappears from dashboard when canceling edit
after dashboard save (#193911)\n\nPart of
#193905. Broke work
into\r\nseparate PRs to backport map embeddable changes to
8.15.\r\n\r\nResolves issue for Map embeddable. The problem is that Map
embeddable is\r\nusing a stale result from `parentApi.getAppContext`.
Dashboard's\r\n`getAppContext` changes the `getCurrentPath` when the
dashboard has a\r\nsaved object id. By using the stale results,
`getCurrentPath` returned\r\n`#/create` instead of `#/view/`.\r\n\r\n###
Test steps\r\n1. create new dashboard\r\n2. Click \"Add panel\" (problem
also exists when using \"Add from library\")\r\n3. Select \"Maps\"\r\n4.
In editor, click \"Save and return\"\r\n5. Save dashboard\r\n6. Click
\"Edit\" in panel context menu\r\n7. In editor, click \"Cancel\"\r\n8.
Ensure map panel is still displayed in
dashboard","sha":"882b6fb2f5ebef289dcbbf487ce42f83b95cc58e","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","v9.0.0","v8.16.0","backport:version","v8.15.3"],"title":"[map
embeddable] fix panel disappears from dashboard when canceling edit
after dashboard
save","number":193911,"url":"https://github.com/elastic/kibana/pull/193911","mergeCommit":{"message":"[map
embeddable] fix panel disappears from dashboard when canceling edit
after dashboard save (#193911)\n\nPart of
#193905. Broke work
into\r\nseparate PRs to backport map embeddable changes to
8.15.\r\n\r\nResolves issue for Map embeddable. The problem is that Map
embeddable is\r\nusing a stale result from `parentApi.getAppContext`.
Dashboard's\r\n`getAppContext` changes the `getCurrentPath` when the
dashboard has a\r\nsaved object id. By using the stale results,
`getCurrentPath` returned\r\n`#/create` instead of `#/view/`.\r\n\r\n###
Test steps\r\n1. create new dashboard\r\n2. Click \"Add panel\" (problem
also exists when using \"Add from library\")\r\n3. Select \"Maps\"\r\n4.
In editor, click \"Save and return\"\r\n5. Save dashboard\r\n6. Click
\"Edit\" in panel context menu\r\n7. In editor, click \"Cancel\"\r\n8.
Ensure map panel is still displayed in
dashboard","sha":"882b6fb2f5ebef289dcbbf487ce42f83b95cc58e"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193911","number":193911,"mergeCommit":{"message":"[map
embeddable] fix panel disappears from dashboard when canceling edit
after dashboard save (#193911)\n\nPart of
#193905. Broke work
into\r\nseparate PRs to backport map embeddable changes to
8.15.\r\n\r\nResolves issue for Map embeddable. The problem is that Map
embeddable is\r\nusing a stale result from `parentApi.getAppContext`.
Dashboard's\r\n`getAppContext` changes the `getCurrentPath` when the
dashboard has a\r\nsaved object id. By using the stale results,
`getCurrentPath` returned\r\n`#/create` instead of `#/view/`.\r\n\r\n###
Test steps\r\n1. create new dashboard\r\n2. Click \"Add panel\" (problem
also exists when using \"Add from library\")\r\n3. Select \"Maps\"\r\n4.
In editor, click \"Save and return\"\r\n5. Save dashboard\r\n6. Click
\"Edit\" in panel context menu\r\n7. In editor, click \"Cancel\"\r\n8.
Ensure map panel is still displayed in
dashboard","sha":"882b6fb2f5ebef289dcbbf487ce42f83b95cc58e"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels project:embeddableRebuild release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.15.2 v8.15.3 v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants