JSON model of row panel


I use scripted dashboards with version 5.1.3, and it is not fully clear how should rows work.
I checked the JSON structure of my gui created dashboard and it seems a row panel can have nested panels again (which makes perfect sense to me) but if I tried to generate that structure my board had the rows in weird order than no graphs inside. If I use repeat it seems then the nested panels get displayed.
If I do not use the nested panels just insert the row panel before its content panels it works as well.
Is it intentional, or I am doing something wrong?

UPDATE: if I mix the un-nested with the repeated and nested then the panels which should not be repeated will be repeated, and the nested panels are still not visible.

Thanks for the help!

they only have nested panels if they are collapsed, otherwise the row contains panels up to the next row.

thanks! so if I generate collapsed and non collapsed rows one has to be nested and the row marked collapsed and the others next to each other, right?
it is a bit confusing any plan to unify it in the future?

@torkel I seem to have another issue. I generate a panel list like:
{row object},
{graph object},
{graph object},
{graph object},
{collapsed row object with repeat and internal panels}

the order is this in the json what I print out, but the json of rendered dashboard is different:
{collapsed rows},
{panels for the first row},

I think that this is really confusing behaviour. A row should always contains its graphs whenever it’s collapsed or not… Could you fix this in the upcoming releases?

I just re-discovered the order change when using collapsed. I honestly not that bothered by the no need to nest if its not collapsed (even though its weird) but I would say the re-ordering of panels and rows when I have a collapsed and my first panels are not in a row is a bug. I do not want to put those panels in a row because then they can be hidden, and since 5.0 there is no option to hide the row header, now we lack previously existing functionality. Any chance this gets fixed?
It seems to me the json I generate from the dashboard script has the same structure compared to doing the collapses by hand and looking at the json what grafana says the dashboard has. So the issue must be in the transformation part of the scripted dashboards
I was thinking about adding an MR with a test where I demonstrate the ordering issue, but as far as I can see there are no tests for DashboardLoaderSrv so not sure how to start with that. Also could not find any test elsewhere for scripted dashboards. Then I was thinking I can debug it in the browser, but the minification is making it impossible. Is there a way to get grafana to not serve minified versions of the scripts?

Some update. In my code I did not added a gridpos when I was generating hidden panels. It seems if I add it as I would with non hidden panels it works. So there is no issue it seems just a bit of confusing structure?

Hi everyone,

I had to face the same issue to generate dashboard from json, and finally found what makes problem here ! please check that :

  • for collapse = true , you have to put row’s pannels inside the row definition , in panels[ ] section.
  • for collapse = false, you have to put row’s pannels below the row definition.

But that is not so simple ! You have also to check :

  • panel IDs are increasing from top to bottom. If you mix higher and lower IDs or duplicate it will be buggy.
  • Don’t forget to set Y axe on each pannel , indeed if your next row has an axe Y lower than your previous pannels from the previous row, it will just slide above !

Hope it will help some people here

1 Like