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
feat(observability-lib): support AddPanelToRow to support collapsed rows (#1997)
* feat(observability-lib): support AddPanelToRow to support collapsed rows
* fix(observability-lib): linting
* fix(observability-lib): prevent replay built
* fix(observability-lib): trigger error when no name is set
* chore(observability-lib): refactor to add new panel type in unique place
* chore(observability-lib): cannot add panel to row on non existent row
Copy file name to clipboardExpand all lines: observability-lib/README.md
+138-2Lines changed: 138 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,16 @@ Godoc generated documentation is available [here](https://pkg.go.dev/github.com/
27
27
28
28
### Creating a dashboard
29
29
30
-
<details><summary>main.go</summary>
30
+
There are two ways to add panels to a dashboard:
31
+
32
+
-**`AddPanel`**: adds a panel directly to the dashboard as a top-level element. Panels appear in the order they are added.
33
+
-**`AddPanelToRow`**: adds a panel inside a row. Rows with panels are automatically **collapsed** in Grafana, meaning their panels are nested and hidden until the user expands the row.
34
+
35
+
Rows without any panels added via `AddPanelToRow` remain open (not collapsed).
36
+
37
+
You can freely interleave `AddRow`, `AddPanel`, and `AddPanelToRow` calls — the dashboard will preserve the insertion order.
38
+
39
+
#### Basic dashboard with top-level panels
31
40
32
41
```go
33
42
package main
@@ -90,7 +99,134 @@ func main() {
90
99
fmt.Println(string(json))
91
100
}
92
101
```
93
-
</details>
102
+
103
+
#### Dashboard with collapsed rows
104
+
105
+
Use `AddPanelToRow` to nest panels inside a row. The row will be automatically collapsed in Grafana, so users can expand it to see the panels inside.
0 commit comments