This repository has been archived by the owner on Apr 21, 2021. It is now read-only.
forked from grafana/grafonnet-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrow.libsonnet
47 lines (47 loc) · 1.57 KB
/
row.libsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
/**
* Creates a [row](https://grafana.com/docs/grafana/latest/features/dashboard/dashboards/#rows).
* Rows are logical dividers within a dashboard and used to group panels together.
*
* @name row.new
*
* @param title The title of the row.
* @param showTitle (default `true` if title is set) Whether to show the row title
* @paral titleSize (default `'h6'`) The size of the title
* @param collapse (default `false`) The initial state of the row when opening the dashboard. Panels in a collapsed row are not load until the row is expanded.
* @param repeat (optional) Name of variable that should be used to repeat this row. It is recommended to use the variable in the row title as well.
*
* @method addPanels(panels) Appends an array of nested panels
* @method addPanel(panel,gridPos) Appends a nested panel, with an optional grid position in grid coordinates, e.g. `gridPos={'x':0, 'y':0, 'w':12, 'h': 9}`
*/
new(
title='Dashboard Row',
height=null,
collapse=false,
repeat=null,
showTitle=null,
titleSize='h6'
):: {
collapse: collapse,
collapsed: collapse,
[if height != null then 'height']: height,
panels: [],
repeat: repeat,
repeatIteration: null,
repeatRowId: null,
showTitle:
if showTitle != null then
showTitle
else
title != 'Dashboard Row',
title: title,
type: 'row',
titleSize: titleSize,
addPanels(panels):: self {
panels+: panels,
},
addPanel(panel, gridPos={}):: self {
panels+: [panel { gridPos: gridPos }],
},
},
}