grafana / scenes

Build Grafana dashboards directly in your Grafana app plugins.
https://grafana.com/developers/scenes
Apache License 2.0
141 stars 21 forks source link

Dashboard: Util function to build a scene from dashboard json model #401

Open torkelo opened 1 year ago

torkelo commented 1 year ago

There is a request to be able to take a json dashboard and build a view-only scene view from it (like we do in core but without inspect/view and edit panel features and share menu).

So I think a function like what we have in core (transformSaveModelToScene) would make sense to include in the scene framework (But using EmbeddedScene as the top object).

Tricky bits

hwinkel commented 1 year ago

BTW, would it be a good step to extract the Core dashboards bits frfom the core, and have them as "plugin" and a more or less Empty chrome? Than the Dashboard builder can be swapped with a scene app later and the Dev LiveCycle of the Current Dashboard Code can be somhow independent from core? or could be the current Dashboard Code already be wrapped into a scene?

torkelo commented 1 year ago

@hwinkel maybe over time, the core dashboard experience contains editing and viewing panels and a lot of rich dynamic features specific to this use case of a user building a dashboard that can be saved. Exposing all this as a library makes it very hard to make any changes to it. But I think we can expose a simple read-only version of it. that can be embedded in scene apps or in drawers.

But our primary goal now is rewriting the core dashboard features and editing in the scenes framework, most of the core features are already in the scenes lib (variables, time ranges, panels, query execution, annotations, layout grids etc). The thing that is in core now is persited model => migrations => runtime state. Share modal, panel inspect drawer, editing etc.

hwinkel commented 1 year ago

@torkelo I totally understand, that's why I have made intentionally the link to the LoveLace project in Home Assistant which also have this situation of a Human Understandable YAML or Even UI edit Experience. But also allow to add new Widgets (They call them Cards) which implement very specific Features like e.g. a "lawn moover Widget/Card", which in turn follows the YAML (or even UI) Configuration Experience. The Idea is not to use it, but might have a look for inspiration how they have structured this approach.

Example:

https://github.com/Cavemanz/lovelace-gardena-mower-card

IMHO the Combination of scenes as SDK and Custom Panels would be quite similar ?!?