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

[Dashboard Navigation] Fix reference extract method #171360

Merged

Conversation

Heenawter
Copy link
Contributor

@Heenawter Heenawter commented Nov 15, 2023

Closes #164212
Closes #171328

Summary

In extractReferences, the links in the links array attribute is not extensible - this means that we cannot add or delete properties from each individual link directly. Instead, I've had to create a clone of each dashboard link via the spread operator so that we aren't modifying the original link directly.

How to Test

  1. Create a by-value Links panel
  2. Refresh the dashboard
  3. Save the Links panel to the library via the panel action
  4. The panel should be saved successfully and the panel title should be updated.

Flaky Test Runner

image

Checklist

For maintainers

@Heenawter Heenawter added Feature:Dashboard Dashboard related features release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:small Small Level of Effort impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Project:Dashboard Navigation Related to the Dashboard Navigation Project labels Nov 15, 2023
@Heenawter Heenawter self-assigned this Nov 15, 2023
@Heenawter Heenawter force-pushed the fix-by-val-to-by-ref-links_2023-11-15 branch from 04e517a to 10be425 Compare November 16, 2023 23:20
@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
links 25.2KB 25.2KB -1.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
links 32.8KB 32.9KB +33.0B

History

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

cc @Heenawter

@Heenawter Heenawter marked this pull request as ready for review November 20, 2023 16:23
@Heenawter Heenawter requested a review from a team as a code owner November 20, 2023 16:23
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

This has been a really strange problem, but a shallow clone is a common / acceptable fix even if we can't find exactly what is causing the object to become non-extensible. LGTM!

expect(await dashboardLinks.getNumberOfLinksInPanel()).to.equal(4);
});

it('can save by-value links panel to the library', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Great to see a functional test to cover this.

@Heenawter Heenawter merged commit 49b52fe into elastic:main Nov 20, 2023
26 checks passed
@Heenawter Heenawter deleted the fix-by-val-to-by-ref-links_2023-11-15 branch November 20, 2023 16:40
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.11

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 20, 2023
Closes elastic#164212
Closes elastic#171328

## Summary

In `extractReferences`, the links in the `links` array attribute is [not
extensible](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_define_property_object_not_extensible)
- this means that we cannot add or delete properties from each
individual link directly. Instead, I've had to create a clone of each
dashboard link via the spread operator so that we aren't modifying the
original link directly.

**How to Test**
1. Create a by-value Links panel
2. Refresh the dashboard
3. Save the Links panel to the library via the panel action
4. The panel should be saved successfully **and** the panel title should
be updated.

[**Flaky Test
Runner**](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4024)

![image](https://github.com/elastic/kibana/assets/8698078/b8949d44-697d-414a-9e98-14b0a6f67b31)

### 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
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 49b52fe)
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Nov 21, 2023
…71360) (elastic#171561)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Dashboard Navigation] Fix reference extract method
(elastic#171360)](elastic#171360)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Hannah
Mudge","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-11-20T16:40:07Z","message":"[Dashboard
Navigation] Fix reference extract method (elastic#171360)\n\nCloses
https://github.com/elastic/kibana/issues/164212\r\nCloses
https://github.com/elastic/kibana/issues/171328\r\n\r\n##
Summary\r\n\r\nIn `extractReferences`, the links in the `links` array
attribute is
[not\r\nextensible](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_define_property_object_not_extensible)\r\n-
this means that we cannot add or delete properties from
each\r\nindividual link directly. Instead, I've had to create a clone of
each\r\ndashboard link via the spread operator so that we aren't
modifying the\r\noriginal link directly.\r\n\r\n**How to Test**\r\n1.
Create a by-value Links panel\r\n2. Refresh the dashboard\r\n3. Save the
Links panel to the library via the panel action\r\n4. The panel should
be saved successfully **and** the panel title should\r\nbe
updated.\r\n\r\n[**Flaky
Test\r\nRunner**](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4024)\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/8698078/b8949d44-697d-414a-9e98-14b0a6f67b31)\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- [x] This was
checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"49b52fe76e480c24673c8e1573346fb279ea965f","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Dashboard","release_note:fix","Team:Presentation","loe:small","impact:high","backport:prev-minor","Project:Dashboard
Navigation","v8.12.0"],"number":171360,"url":"https://github.com/elastic/kibana/pull/171360","mergeCommit":{"message":"[Dashboard
Navigation] Fix reference extract method (elastic#171360)\n\nCloses
https://github.com/elastic/kibana/issues/164212\r\nCloses
https://github.com/elastic/kibana/issues/171328\r\n\r\n##
Summary\r\n\r\nIn `extractReferences`, the links in the `links` array
attribute is
[not\r\nextensible](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_define_property_object_not_extensible)\r\n-
this means that we cannot add or delete properties from
each\r\nindividual link directly. Instead, I've had to create a clone of
each\r\ndashboard link via the spread operator so that we aren't
modifying the\r\noriginal link directly.\r\n\r\n**How to Test**\r\n1.
Create a by-value Links panel\r\n2. Refresh the dashboard\r\n3. Save the
Links panel to the library via the panel action\r\n4. The panel should
be saved successfully **and** the panel title should\r\nbe
updated.\r\n\r\n[**Flaky
Test\r\nRunner**](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4024)\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/8698078/b8949d44-697d-414a-9e98-14b0a6f67b31)\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- [x] This was
checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"49b52fe76e480c24673c8e1573346fb279ea965f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/171360","number":171360,"mergeCommit":{"message":"[Dashboard
Navigation] Fix reference extract method (elastic#171360)\n\nCloses
https://github.com/elastic/kibana/issues/164212\r\nCloses
https://github.com/elastic/kibana/issues/171328\r\n\r\n##
Summary\r\n\r\nIn `extractReferences`, the links in the `links` array
attribute is
[not\r\nextensible](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_define_property_object_not_extensible)\r\n-
this means that we cannot add or delete properties from
each\r\nindividual link directly. Instead, I've had to create a clone of
each\r\ndashboard link via the spread operator so that we aren't
modifying the\r\noriginal link directly.\r\n\r\n**How to Test**\r\n1.
Create a by-value Links panel\r\n2. Refresh the dashboard\r\n3. Save the
Links panel to the library via the panel action\r\n4. The panel should
be saved successfully **and** the panel title should\r\nbe
updated.\r\n\r\n[**Flaky
Test\r\nRunner**](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4024)\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/8698078/b8949d44-697d-414a-9e98-14b0a6f67b31)\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- [x] This was
checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"49b52fe76e480c24673c8e1573346fb279ea965f"}}]}]
BACKPORT-->

Co-authored-by: Hannah Mudge <[email protected]>
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) Feature:Dashboard Dashboard related features impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:small Small Level of Effort Project:Dashboard Navigation Related to the Dashboard Navigation Project release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.11.2 v8.12.0
Projects
None yet
5 participants