[8.x] [Dashboard] Inject / extract tag references (#214788)#217590
Merged
nickpeihl merged 2 commits intoelastic:8.xfrom Apr 9, 2025
Merged
[8.x] [Dashboard] Inject / extract tag references (#214788)#217590nickpeihl merged 2 commits intoelastic:8.xfrom
nickpeihl merged 2 commits intoelastic:8.xfrom
Conversation
Fixes elastic#210619 ## Summary Provides a tags array on the request and response bodies of dashboards. This allows consumers of the Dashboards HTTP API and internal RPC API to add an array of tag names to the attributes in the body of create and update endpoints. The dashboard server will be responsible for converting the tag names into references in the saved object. If, during creation or update, a tag name does not have a matching tag saved object, a new tag saved object will be created. If the user lacks permissions to manage tags, then an error will be logged in the server and the tag will not be added to the dashboard. The server also injects the tag references as an array of tag names in the attributes of the response body of get and search endpoints of the HTTP and RPC APIs. For backwards compatibility in create and update endpoints, tags can alternatively be specified in the `references` array in the options instead of (or in addition to) the `attributes.tags` in the request body. Similarly, for backwards compatibility, tag references are returned in the `references` of the response body of get and search endpoints. Client-side tag handling is out of scope for this PR. Dashboards listing page and dashboard settings continue to use the tag references and do not use the `tags` attribute in the response. For example: Here's how we currently create a dashboard with tag references. ``` ## Creating a dashboard with tag references POST kbn:/api/dashboards/dashboard { "attributes": { "title": "my tagged dashboard" }, "references": [ { "type": "tag", "id": "37aab5de-a34d-47cb-9aa5-9375d5db595f", "name": "tag-ref-37aab5de-a34d-47cb-9aa5-9375d5db595f" }, { "type": "tag", "id": "5ed29bba-c14d-4302-9a8c-9602e40dbc2a", "name": "tag-ref-5ed29bba-c14d-4302-9a8c-9602e40dbc2a" }, { "type": "tag", "id": "fc7890e8-c00f-44a1-88a2-250e4d27e61d", "name": "tag-ref-fc7890e8-c00f-44a1-88a2-250e4d27e61d" } ] } ``` With this PR, creating a dashboard with tags is much simpler. ``` ## Creating a dashboard with tag names POST kbn:/api/dashboards/dashboard { "attributes": { "title": "my tagged dashboard", "tags": [ "boo", "foo", "bingo", "bongo" ] } } ``` ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [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] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] If there are more than one tag saved objects with the same name, only one of the tag references will be added to the saved object when creating a dashboard. Creating tags with duplicate names are not permitted via the UI. But there is no such restrictions when creating tags from imported saved objects. Having multiple tags with the same name is an edge case that Kibana guards against with reasonable restrictions, so I think we should not be too concerned about it. - [ ] ... --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit c4f7c64) # Conflicts: # src/platform/plugins/shared/dashboard/server/content_management/dashboard_storage.ts # src/platform/plugins/shared/dashboard/server/plugin.ts
4 tasks
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
|
Heenawter
approved these changes
Apr 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.x:Questions ?
Please refer to the Backport tool documentation