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

[Tags] Expose saved object tagging on server #206948

Open
nickpeihl opened this issue Jan 16, 2025 · 2 comments · May be fixed by #207010
Open

[Tags] Expose saved object tagging on server #206948

nickpeihl opened this issue Jan 16, 2025 · 2 comments · May be fixed by #207010
Assignees
Labels
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:medium Medium Level of Effort Project:Dashboards API Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)

Comments

@nickpeihl
Copy link
Member

nickpeihl commented Jan 16, 2025

To support Dashboards-as-code (as well as future *-as-code initiatives) some plugins need access to the TagsClient on the server.

For Dashboards-as-code, specifically the Dashboard HTTP API, we want to remove the consumer concern for saved object references. This means the pre-save and pre-load hooks for extracting and injecting references should be moved to each plugin's StorageHandler rather than by the UI as they are now.

This would require adding a server component to the saved-objects-taggiing-oss bridge plugin that optionally provides the TagsClient in the start contract.

Consider the following examples of creating a dashboard with tags using the Dashboard HTTP API.

Current workflow for creating a dashboard with tags

Assumes the "foo" and "bar" tag saved objects already exist and the consumer knows the saved object id for both. If the saved objects for the referenced tags do not already exist, they will not be created which results in dangling references.


POST kbn:/api/dashboards/dashboard
{
    "attributes": {
        "title": "my empty dashboard with tags"
    },
    "references": [
      {
        "type": "tag",
        "id": "75474dd0-fec8-4d7d-b935-767257be09d6", // corresponds to "foo" tag
        "name": "tag-ref-75474dd0-fec8-4d7d-b935-767257be09d6"
      },
      {
        "type": "tag",
        "id": "2e4f5f21-4f1c-4f89-abc5-bf4c9537f7da", // corresponds to "bar" tag
        "name": "tag-ref-2e4f5f21-4f1c-4f89-abc5-bf4c9537f7da"
      }
    ],
}
Preferred workflow for creating a dashboard with tags

In this example, the consumer does not need to know the saved object id of the tags. They add an array of tags for their dashboard and the tags are automatically referenced during the StorageHandler's create method and added to the saved object. When loading the dashboard, the tags are dereferenced from the saved object and populate the "tags" array.

If the tag does not exist, we return an error and maybe a suggestion for how to create the tag using the /api/saved_objects_tagging/tags/create endpoint.

POST kbn:/api/dashboards/dashboard
{
    "attributes": {
        "title": "my empty dashboard with tags",
        "tags": ["foo", "bar"]
    }
}

@nickpeihl nickpeihl self-assigned this Jan 16, 2025
@nickpeihl nickpeihl added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) labels Jan 16, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@elasticmachine
Copy link
Contributor

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

@ThomThomson ThomThomson added Project:Dashboards API loe:medium Medium Level of Effort impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Feature:Dashboard Dashboard related features labels Jan 16, 2025
@nickpeihl nickpeihl linked a pull request Jan 16, 2025 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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:medium Medium Level of Effort Project:Dashboards API Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants