grafana / scenes

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

${__org.name} does not work #789

Open korinekgergely opened 3 months ago

korinekgergely commented 3 months ago

SCENES Question 1 I tried it in a simple application and the global variable ${__org.name} does not work. The code:

const getOrganizationScene = () => {
  return new EmbeddedScene({
    body: new SceneFlexLayout({
      children: [
        new SceneFlexItem({
          body: PanelBuilders.text().setTitle("Title: ${__org.name}").build(),
        }),
      ],
    }),
  });
};

Result: Monosnap Monview App - Apps - Grafana 2024-06-12 13-02-11 Interestingly, and definitely worth noting, it works on the dashboard. Why not in the app? Have I implemented something incorrectly? I know, it's hard to debug remotely, maybe I missed some important step. Dahboard: Monosnap Edit panel - New dashboard - Dashboards - Grafana 2024-06-12 13-04-59

Question 2

Is it possible to use these global variables in a SceneApp title (like in my example)? Maybe in the future, or somehow already now?

const getScene = () =>
  new SceneApp({
    pages: [
      new SceneAppPage({
        title: 'Organization ${__org.name}',
        url: prefixRoute(`${ROUTES.Organization}`),
        hideFromBreadcrumbs: true,
        getScene: getOrganizationScene,
      }),
    ],
  });
leslie-alldridge commented 1 month ago

Just a guess but I think you might need a custom macro? https://grafana.com/developers/scenes/advanced-variables#custom-variable-macros