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

[Dashboards] [Embeddables] Allow embeddables to register a panel config schema #201474

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickpeihl
Copy link
Member

@nickpeihl nickpeihl commented Nov 22, 2024

This is a WIP example for allowing embeddables to register a panel config schema that allows the Dashboard to validate panel content via the public HTTP or internal RPC CRUD endpoints.

Initially, this adds validation for Lens data table charts. An example of a chart that gets validated against the schema is below. Other Lens charts will be validated against a generic schema. Embeddables that do not register a schema are not validated.

curl --request POST \
  --url http://localhost:5601/api/dashboards/dashboard \
  --header 'accept: application/json' \
  --header 'authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
  --header 'elastic-api-version: 2023-10-31' \
  --header 'kbn-xsrf: true' \
  --data '{"attributes": {"title": "a table lens panel","panels": [{"type": "lens","gridData": {"x": 0,"y": 0,"w": 24,"h": 15},"panelIndex": "666ba2ac-babb-4226-ad8b-9e30fec7dd74","panelConfig": {"attributes": {"visualizationType": "lnsDatatable","title": "my data table","state": {"datasourceStates": {"formBased": {"layers": {"53c6e98c-6267-4d97-876b-29f5df00e39b": {"columns": {"963714a8-b8a2-4e7d-889e-3851c74a0212": {"dataType": "string","isBucketed": true,"operationType": "terms","sourceField": "machine.os.keyword","params": {"size": 5,"orderBy": {"type": "alphabetical"}}},"627d787d-f907-46d2-861f-7752cd1001b9": {"dataType": "number","isBucketed": false,"label": "Count of records","operationType": "count","sourceField": "___records___"}},"columnOrder": ["963714a8-b8a2-4e7d-889e-3851c74a0212","627d787d-f907-46d2-861f-7752cd1001b9"]}}}},"visualization": {"layerId": "53c6e98c-6267-4d97-876b-29f5df00e39b","layerType": "data","columns": [{"columnId": "627d787d-f907-46d2-861f-7752cd1001b9"},{"columnId": "963714a8-b8a2-4e7d-889e-3851c74a0212"}]},"query": {"query": "","language": "kuery"},"filters": []},"references": [{"type": "index-pattern","id": "90943e30-9a47-11e8-b64d-95841ca0b247","name": "indexpattern-datasource-layer-53c6e98c-6267-4d97-876b-29f5df00e39b"}]}}}]},"references": [{"type": "index-pattern","id": "90943e30-9a47-11e8-b64d-95841ca0b247","name": "666ba2ac-babb-4226-ad8b-9e30fec7dd74:indexpattern-datasource-layer-53c6e98c-6267-4d97-876b-29f5df00e39b"}]}'

Summary

Summarize your PR. If it involves visual changes include a screenshot or gif.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

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.

@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants