You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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"]
}
}
The text was updated successfully, but these errors were encountered:
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.
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.
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.The text was updated successfully, but these errors were encountered: