grafana / cog

Code Generation with a human touch
Apache License 2.0
48 stars 2 forks source link

Expose a way to manually position panels in a dashboard #401

Closed K-Phoen closed 5 months ago

K-Phoen commented 5 months ago

While the span/height-based automatic layout for panels is convenient, having a way to manually position panels in a dashboard can be useful (especially when users want a specific and non-standard layout)

github-actions[bot] commented 5 months ago

Note: in addition to the changes introduced by this PR, the diff includes unreleased changes living in main.

### 🔎 Changes to `grafana-foundation-sdk@next+cog-v0.0.x` ```patch diff --git a/go/annotationslist/panel_builder_gen.go b/go/annotationslist/panel_builder_gen.go index 874a5d6..2881eb1 100644 --- a/go/annotationslist/panel_builder_gen.go +++ b/go/annotationslist/panel_builder_gen.go @@ -108,6 +108,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/barchart/panel_builder_gen.go b/go/barchart/panel_builder_gen.go index afca4e0..75164a3 100644 --- a/go/barchart/panel_builder_gen.go +++ b/go/barchart/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/bargauge/panel_builder_gen.go b/go/bargauge/panel_builder_gen.go index 72e11e2..eb2f169 100644 --- a/go/bargauge/panel_builder_gen.go +++ b/go/bargauge/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/candlestick/panel_builder_gen.go b/go/candlestick/panel_builder_gen.go index d3e17cf..608ab63 100644 --- a/go/candlestick/panel_builder_gen.go +++ b/go/candlestick/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/canvas/panel_builder_gen.go b/go/canvas/panel_builder_gen.go index 532b982..6abb2dd 100644 --- a/go/canvas/panel_builder_gen.go +++ b/go/canvas/panel_builder_gen.go @@ -108,6 +108,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/dashboard/dashboard_builder_gen.go b/go/dashboard/dashboard_builder_gen.go index c3d4ad8..2436bc7 100644 --- a/go/dashboard/dashboard_builder_gen.go +++ b/go/dashboard/dashboard_builder_gen.go @@ -208,9 +208,15 @@ func (builder *DashboardBuilder) WithPanel(panel cog.Builder[Panel]) *DashboardB return builder } - // Position the panel on the grid - panelResource.GridPos.X = builder.currentX - panelResource.GridPos.Y = builder.currentY + if panelResource.GridPos == nil { + panelResource.GridPos = &GridPos{} + } + // The panel either has no position set, or it is the first panel of the dashboard. + // In that case, we position it on the grid + if panelResource.GridPos.X == 0 && panelResource.GridPos.Y == 0 { + panelResource.GridPos.X = builder.currentX + panelResource.GridPos.Y = builder.currentY + } builder.internal.Panels = append(builder.internal.Panels, PanelOrRowPanel{ Panel: &panelResource, }) @@ -255,9 +261,12 @@ func (builder *DashboardBuilder) WithRow(rowPanel cog.Builder[RowPanel]) *Dashbo // Position the row's panels on the grid for _, panel := range rowPanelResource.Panels { - // Position the panel on the grid - panel.GridPos.X = builder.currentX - panel.GridPos.Y = builder.currentY + // The panel either has no position set, or it is the first panel of the dashboard. + // In that case, we position it on the grid + if panel.GridPos.X == 0 && panel.GridPos.Y == 0 { + panel.GridPos.X = builder.currentX + panel.GridPos.Y = builder.currentY + } // Prepare the coordinates for the next panel builder.currentX += panel.GridPos.W diff --git a/go/dashboard/panel_builder_gen.go b/go/dashboard/panel_builder_gen.go index 9776d61..98fcc5e 100644 --- a/go/dashboard/panel_builder_gen.go +++ b/go/dashboard/panel_builder_gen.go @@ -117,6 +117,13 @@ func (builder *PanelBuilder) Datasource(datasource DataSourceRef) *PanelBuilder return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/dashboardlist/panel_builder_gen.go b/go/dashboardlist/panel_builder_gen.go index 68175fa..2b6adb6 100644 --- a/go/dashboardlist/panel_builder_gen.go +++ b/go/dashboardlist/panel_builder_gen.go @@ -108,6 +108,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/datagrid/panel_builder_gen.go b/go/datagrid/panel_builder_gen.go index b2d0e36..6e34484 100644 --- a/go/datagrid/panel_builder_gen.go +++ b/go/datagrid/panel_builder_gen.go @@ -108,6 +108,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/debug/panel_builder_gen.go b/go/debug/panel_builder_gen.go index ea4ef3b..53b6443 100644 --- a/go/debug/panel_builder_gen.go +++ b/go/debug/panel_builder_gen.go @@ -108,6 +108,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/gauge/panel_builder_gen.go b/go/gauge/panel_builder_gen.go index 599fbab..bc2835b 100644 --- a/go/gauge/panel_builder_gen.go +++ b/go/gauge/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/geomap/panel_builder_gen.go b/go/geomap/panel_builder_gen.go index 31e4c74..63e6a39 100644 --- a/go/geomap/panel_builder_gen.go +++ b/go/geomap/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/heatmap/panel_builder_gen.go b/go/heatmap/panel_builder_gen.go index 5823b44..9c62343 100644 --- a/go/heatmap/panel_builder_gen.go +++ b/go/heatmap/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/histogram/panel_builder_gen.go b/go/histogram/panel_builder_gen.go index 5096096..4b8be40 100644 --- a/go/histogram/panel_builder_gen.go +++ b/go/histogram/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/logs/panel_builder_gen.go b/go/logs/panel_builder_gen.go index f33317a..0992db9 100644 --- a/go/logs/panel_builder_gen.go +++ b/go/logs/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/news/panel_builder_gen.go b/go/news/panel_builder_gen.go index b7c562f..dd596be 100644 --- a/go/news/panel_builder_gen.go +++ b/go/news/panel_builder_gen.go @@ -108,6 +108,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/nodegraph/panel_builder_gen.go b/go/nodegraph/panel_builder_gen.go index c3d4ba3..f3c338e 100644 --- a/go/nodegraph/panel_builder_gen.go +++ b/go/nodegraph/panel_builder_gen.go @@ -108,6 +108,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/piechart/panel_builder_gen.go b/go/piechart/panel_builder_gen.go index dbd6263..cc774cd 100644 --- a/go/piechart/panel_builder_gen.go +++ b/go/piechart/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/stat/panel_builder_gen.go b/go/stat/panel_builder_gen.go index 67991f9..f3223dd 100644 --- a/go/stat/panel_builder_gen.go +++ b/go/stat/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/statetimeline/panel_builder_gen.go b/go/statetimeline/panel_builder_gen.go index cc1b3ea..41abfc0 100644 --- a/go/statetimeline/panel_builder_gen.go +++ b/go/statetimeline/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/statushistory/panel_builder_gen.go b/go/statushistory/panel_builder_gen.go index 1a65e47..d588bee 100644 --- a/go/statushistory/panel_builder_gen.go +++ b/go/statushistory/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/table/panel_builder_gen.go b/go/table/panel_builder_gen.go index 34f7ad6..b96934b 100644 --- a/go/table/panel_builder_gen.go +++ b/go/table/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/text/panel_builder_gen.go b/go/text/panel_builder_gen.go index fa8b124..a61c95a 100644 --- a/go/text/panel_builder_gen.go +++ b/go/text/panel_builder_gen.go @@ -108,6 +108,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/timeseries/panel_builder_gen.go b/go/timeseries/panel_builder_gen.go index b711079..fb6c217 100644 --- a/go/timeseries/panel_builder_gen.go +++ b/go/timeseries/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/trend/panel_builder_gen.go b/go/trend/panel_builder_gen.go index 02ed429..c676d1e 100644 --- a/go/trend/panel_builder_gen.go +++ b/go/trend/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/go/xychart/panel_builder_gen.go b/go/xychart/panel_builder_gen.go index 9d98bc0..ae92c69 100644 --- a/go/xychart/panel_builder_gen.go +++ b/go/xychart/panel_builder_gen.go @@ -109,6 +109,13 @@ func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *Pan return builder } +// Grid position. +func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder { + builder.internal.GridPos = &gridPos + + return builder +} + // Panel height. The height is the number of rows from the top edge of the panel. func (builder *PanelBuilder) Height(h uint32) *PanelBuilder { if !(h > 0) { diff --git a/python/grafana_foundation_sdk/builders/annotationslist.py b/python/grafana_foundation_sdk/builders/annotationslist.py index bf46a87..332afbd 100644 --- a/python/grafana_foundation_sdk/builders/annotationslist.py +++ b/python/grafana_foundation_sdk/builders/annotationslist.py @@ -89,6 +89,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/barchart.py b/python/grafana_foundation_sdk/builders/barchart.py index 6640ccc..f87b628 100644 --- a/python/grafana_foundation_sdk/builders/barchart.py +++ b/python/grafana_foundation_sdk/builders/barchart.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/bargauge.py b/python/grafana_foundation_sdk/builders/bargauge.py index a13d21c..9131997 100644 --- a/python/grafana_foundation_sdk/builders/bargauge.py +++ b/python/grafana_foundation_sdk/builders/bargauge.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/candlestick.py b/python/grafana_foundation_sdk/builders/candlestick.py index b1884fc..e2b54be 100644 --- a/python/grafana_foundation_sdk/builders/candlestick.py +++ b/python/grafana_foundation_sdk/builders/candlestick.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/canvas.py b/python/grafana_foundation_sdk/builders/canvas.py index 74e5464..970e144 100644 --- a/python/grafana_foundation_sdk/builders/canvas.py +++ b/python/grafana_foundation_sdk/builders/canvas.py @@ -89,6 +89,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/dashboard.py b/python/grafana_foundation_sdk/builders/dashboard.py index 51eb399..164ed31 100644 --- a/python/grafana_foundation_sdk/builders/dashboard.py +++ b/python/grafana_foundation_sdk/builders/dashboard.py @@ -203,12 +203,14 @@ class Dashboard(cogbuilder.Builder[dashboard.Dashboard]): panel_resource = panel.build() - # Position the panel on the grid if panel_resource.grid_pos is None: panel_resource.grid_pos = dashboard.GridPos() - panel_resource.grid_pos.x = self.__current_x - panel_resource.grid_pos.y = self.__current_y + # The panel either has no position set, or it is the first panel of the dashboard. + # In that case, we position it on the grid + if panel_resource.grid_pos.x == 0 and panel_resource.grid_pos.y == 0: + panel_resource.grid_pos.x = self.__current_x + panel_resource.grid_pos.y = self.__current_y self._internal.panels.append(panel_resource) # Prepare the coordinates for the next panel @@ -249,8 +251,11 @@ class Dashboard(cogbuilder.Builder[dashboard.Dashboard]): if panel.grid_pos is None: panel.grid_pos = dashboard.GridPos() - panel.grid_pos.x = self.__current_x - panel.grid_pos.y = self.__current_y + # The panel either has no position set, or it is the first panel of the dashboard. + # In that case, we position it on the grid + if panel.grid_pos.x == 0 and panel.grid_pos.y == 0: + panel.grid_pos.x = self.__current_x + panel.grid_pos.y = self.__current_y # Prepare the coordinates for the next panel self.__current_x += panel.grid_pos.w @@ -1091,6 +1096,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/dashboardlist.py b/python/grafana_foundation_sdk/builders/dashboardlist.py index 8e94d15..e103bd0 100644 --- a/python/grafana_foundation_sdk/builders/dashboardlist.py +++ b/python/grafana_foundation_sdk/builders/dashboardlist.py @@ -89,6 +89,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/datagrid.py b/python/grafana_foundation_sdk/builders/datagrid.py index f335edb..af9705f 100644 --- a/python/grafana_foundation_sdk/builders/datagrid.py +++ b/python/grafana_foundation_sdk/builders/datagrid.py @@ -89,6 +89,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/debug.py b/python/grafana_foundation_sdk/builders/debug.py index 014895a..b8e1516 100644 --- a/python/grafana_foundation_sdk/builders/debug.py +++ b/python/grafana_foundation_sdk/builders/debug.py @@ -89,6 +89,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/gauge.py b/python/grafana_foundation_sdk/builders/gauge.py index ef13844..04deffb 100644 --- a/python/grafana_foundation_sdk/builders/gauge.py +++ b/python/grafana_foundation_sdk/builders/gauge.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/geomap.py b/python/grafana_foundation_sdk/builders/geomap.py index d37582c..e9e3072 100644 --- a/python/grafana_foundation_sdk/builders/geomap.py +++ b/python/grafana_foundation_sdk/builders/geomap.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/heatmap.py b/python/grafana_foundation_sdk/builders/heatmap.py index 9023c24..fc6d8af 100644 --- a/python/grafana_foundation_sdk/builders/heatmap.py +++ b/python/grafana_foundation_sdk/builders/heatmap.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/histogram.py b/python/grafana_foundation_sdk/builders/histogram.py index 6610a93..28fc72b 100644 --- a/python/grafana_foundation_sdk/builders/histogram.py +++ b/python/grafana_foundation_sdk/builders/histogram.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/logs.py b/python/grafana_foundation_sdk/builders/logs.py index 181ea00..5bed101 100644 --- a/python/grafana_foundation_sdk/builders/logs.py +++ b/python/grafana_foundation_sdk/builders/logs.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/news.py b/python/grafana_foundation_sdk/builders/news.py index 0d01489..f60ad28 100644 --- a/python/grafana_foundation_sdk/builders/news.py +++ b/python/grafana_foundation_sdk/builders/news.py @@ -89,6 +89,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/nodegraph.py b/python/grafana_foundation_sdk/builders/nodegraph.py index f0a2e7a..9334f6d 100644 --- a/python/grafana_foundation_sdk/builders/nodegraph.py +++ b/python/grafana_foundation_sdk/builders/nodegraph.py @@ -89,6 +89,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/piechart.py b/python/grafana_foundation_sdk/builders/piechart.py index d36c997..c1d9a20 100644 --- a/python/grafana_foundation_sdk/builders/piechart.py +++ b/python/grafana_foundation_sdk/builders/piechart.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/stat.py b/python/grafana_foundation_sdk/builders/stat.py index 7a231e1..cf3b22b 100644 --- a/python/grafana_foundation_sdk/builders/stat.py +++ b/python/grafana_foundation_sdk/builders/stat.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/statetimeline.py b/python/grafana_foundation_sdk/builders/statetimeline.py index b0c6b96..c1a8989 100644 --- a/python/grafana_foundation_sdk/builders/statetimeline.py +++ b/python/grafana_foundation_sdk/builders/statetimeline.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/statushistory.py b/python/grafana_foundation_sdk/builders/statushistory.py index 3da8356..7f6d9fe 100644 --- a/python/grafana_foundation_sdk/builders/statushistory.py +++ b/python/grafana_foundation_sdk/builders/statushistory.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/table.py b/python/grafana_foundation_sdk/builders/table.py index 737c21f..302cdb0 100644 --- a/python/grafana_foundation_sdk/builders/table.py +++ b/python/grafana_foundation_sdk/builders/table.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/text.py b/python/grafana_foundation_sdk/builders/text.py index b0f58d6..ca25c49 100644 --- a/python/grafana_foundation_sdk/builders/text.py +++ b/python/grafana_foundation_sdk/builders/text.py @@ -89,6 +89,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/timeseries.py b/python/grafana_foundation_sdk/builders/timeseries.py index b95c651..90e9ae6 100644 --- a/python/grafana_foundation_sdk/builders/timeseries.py +++ b/python/grafana_foundation_sdk/builders/timeseries.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/trend.py b/python/grafana_foundation_sdk/builders/trend.py index 67d5011..7b6a66f 100644 --- a/python/grafana_foundation_sdk/builders/trend.py +++ b/python/grafana_foundation_sdk/builders/trend.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/builders/xychart.py b/python/grafana_foundation_sdk/builders/xychart.py index 21b6650..e935279 100644 --- a/python/grafana_foundation_sdk/builders/xychart.py +++ b/python/grafana_foundation_sdk/builders/xychart.py @@ -90,6 +90,15 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def grid_pos(self, grid_pos: dashboard.GridPos) -> typing.Self: + """ + Grid position. + """ + + self._internal.grid_pos = grid_pos + + return self + def height(self, h: int) -> typing.Self: """ Panel height. The height is the number of rows from the top edge of the panel. diff --git a/python/grafana_foundation_sdk/cog/plugins.py b/python/grafana_foundation_sdk/cog/plugins.py index 61218cf..ec0d2b1 100644 --- a/python/grafana_foundation_sdk/cog/plugins.py +++ b/python/grafana_foundation_sdk/cog/plugins.py @@ -1,39 +1,39 @@ # Code generated - EDITING IS FUTILE. DO NOT EDIT. -from ..models import bargauge -from ..models import elasticsearch -from ..models import geomap -from ..models import histogram -from ..models import loki +from ..models import azuremonitor +from ..models import logs from ..models import table -from ..models import tempo -from ..models import barchart -from ..models import xychart -from ..models import gauge -from ..models import nodegraph from ..models import text -from ..models import trend +from ..models import prometheus from ..models import annotationslist -from ..models import canvas +from ..models import barchart +from ..models import geomap from ..models import googlecloudmonitoring -from ..models import stat +from ..models import cloudwatch from ..models import debug -from ..models import parca -from ..models import grafanapyroscope from ..models import piechart -from ..models import statushistory -from ..models import expr +from ..models import stat +from ..models import grafanapyroscope +from ..models import loki +from ..models import tempo +from ..models import bargauge +from ..models import candlestick +from ..models import elasticsearch +from ..models import news +from ..models import canvas from ..models import dashboardlist -from ..models import heatmap +from ..models import datagrid +from ..models import gauge +from ..models import histogram +from ..models import nodegraph +from ..models import parca from ..models import statetimeline -from ..models import cloudwatch +from ..models import statushistory +from ..models import heatmap from ..models import timeseries -from ..models import prometheus -from ..models import candlestick -from ..models import azuremonitor -from ..models import datagrid -from ..models import logs -from ..models import news +from ..models import trend +from ..models import xychart +from ..models import expr from . import runtime as cogruntime diff --git a/python/grafana_foundation_sdk/models/cloudwatch.py b/python/grafana_foundation_sdk/models/cloudwatch.py index fac0fa9..8ef9b81 100644 --- a/python/grafana_foundation_sdk/models/cloudwatch.py +++ b/python/grafana_foundation_sdk/models/cloudwatch.py @@ -332,7 +332,7 @@ class SQLExpression: if "select" in data: args["select"] = QueryEditorFunctionExpression.from_json(data["select"]) if "from" in data: - decoding_map: dict[str, typing.Union[typing.Type[QueryEditorPropertyExpression], typing.Type[QueryEditorFunctionExpression]]] = {"property": QueryEditorPropertyExpression, "function": QueryEditorFunctionExpression} + decoding_map: dict[str, typing.Union[typing.Type[QueryEditorFunctionExpression], typing.Type[QueryEditorPropertyExpression]]] = {"function": QueryEditorFunctionExpression, "property": QueryEditorPropertyExpression} args["from_val"] = decoding_map[data["from"]["type"]].from_json(data["from"]) if "where" in data: args["where"] = QueryEditorArrayExpression.from_json(data["where"]) diff --git a/python/grafana_foundation_sdk/models/expr.py b/python/grafana_foundation_sdk/models/expr.py index 8297051..ea417d3 100644 --- a/python/grafana_foundation_sdk/models/expr.py +++ b/python/grafana_foundation_sdk/models/expr.py @@ -9,7 +9,7 @@ Expr: typing.TypeAlias = typing.Union['TypeMath', 'TypeReduce', 'TypeResample', def variant_config() -> cogruntime.DataqueryConfig: - decoding_map: dict[str, typing.Union[typing.Type[TypeMath], typing.Type[TypeReduce], typing.Type[TypeResample], typing.Type[TypeClassicConditions], typing.Type[TypeThreshold], typing.Type[TypeSql]]] = {"math": TypeMath, "reduce": TypeReduce, "resample": TypeResample, "classic_conditions": TypeClassicConditions, "threshold": TypeThreshold, "sql": TypeSql} + decoding_map: dict[str, typing.Union[typing.Type[TypeThreshold], typing.Type[TypeSql], typing.Type[TypeMath], typing.Type[TypeReduce], typing.Type[TypeResample], typing.Type[TypeClassicConditions]]] = {"threshold": TypeThreshold, "sql": TypeSql, "math": TypeMath, "reduce": TypeReduce, "resample": TypeResample, "classic_conditions": TypeClassicConditions} return cogruntime.DataqueryConfig( identifier="__expr__", from_json_hook=lambda data: decoding_map[data["type"]].from_json(data), diff --git a/python/grafana_foundation_sdk/models/rolebinding.py b/python/grafana_foundation_sdk/models/rolebinding.py index e8f302c..eafa911 100644 --- a/python/grafana_foundation_sdk/models/rolebinding.py +++ b/python/grafana_foundation_sdk/models/rolebinding.py @@ -25,7 +25,7 @@ class RoleBinding: args: dict[str, typing.Any] = {} if "role" in data: - decoding_map: dict[str, typing.Union[typing.Type[BuiltinRoleRef], typing.Type[CustomRoleRef]]] = {"BuiltinRole": BuiltinRoleRef, "Role": CustomRoleRef} + decoding_map: dict[str, typing.Union[typing.Type[CustomRoleRef], typing.Type[BuiltinRoleRef]]] = {"Role": CustomRoleRef, "BuiltinRole": BuiltinRoleRef} args["role"] = decoding_map[data["role"]["kind"]].from_json(data["role"]) if "subject" in data: args["subject"] = RoleBindingSubject.from_json(data["subject"]) diff --git a/python/pyproject.toml b/python/pyproject.toml index f88496f..1605a6c 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -13,7 +13,7 @@ keywords = [ "traces", "metrics" ] -version = "1716465567!next" +version = "1716474174!next" dependencies = [] requires-python = ">=3.11" classifiers = [ diff --git a/typescript/package.json b/typescript/package.json index 5731e12..0477bde 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@grafana/grafana-foundation-sdk", - "version": "next-cogv0.0.x.1716465567", + "version": "next-cogv0.0.x.1716474174", "description": "A set of tools, types and libraries for building and manipulating Grafana objects.", "keywords": [ "observability", diff --git a/typescript/src/annotationslist/panelBuilder.gen.ts b/typescript/src/annotationslist/panelBuilder.gen.ts index 9eb8dca..eeb2578 100644 --- a/typescript/src/annotationslist/panelBuilder.gen.ts +++ b/typescript/src/annotationslist/panelBuilder.gen.ts @@ -64,6 +64,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/barchart/panelBuilder.gen.ts b/typescript/src/barchart/panelBuilder.gen.ts index bb73955..62cae5f 100644 --- a/typescript/src/barchart/panelBuilder.gen.ts +++ b/typescript/src/barchart/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/bargauge/panelBuilder.gen.ts b/typescript/src/bargauge/panelBuilder.gen.ts index 077c85a..594f837 100644 --- a/typescript/src/bargauge/panelBuilder.gen.ts +++ b/typescript/src/bargauge/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/candlestick/panelBuilder.gen.ts b/typescript/src/candlestick/panelBuilder.gen.ts index 6b63f67..d5133fe 100644 --- a/typescript/src/candlestick/panelBuilder.gen.ts +++ b/typescript/src/candlestick/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/canvas/panelBuilder.gen.ts b/typescript/src/canvas/panelBuilder.gen.ts index 4c24f20..fd36c0e 100644 --- a/typescript/src/canvas/panelBuilder.gen.ts +++ b/typescript/src/canvas/panelBuilder.gen.ts @@ -64,6 +64,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/dashboard/dashboardBuilder.gen.ts b/typescript/src/dashboard/dashboardBuilder.gen.ts index 69a2d7d..f28ddf0 100644 --- a/typescript/src/dashboard/dashboardBuilder.gen.ts +++ b/typescript/src/dashboard/dashboardBuilder.gen.ts @@ -149,9 +149,12 @@ export class DashboardBuilder implements cog.Builder { panelResource.gridPos = dashboard.defaultGridPos(); } - // Position the panel on the grid - panelResource.gridPos.x = this.currentX; - panelResource.gridPos.y = this.currentY; + // The panel either has no position set, or it is the first panel of the dashboard. + // In that case, we position it on the grid + if (panelResource.gridPos.x == 0 && panelResource.gridPos.y == 0) { + panelResource.gridPos.x = this.currentX; + panelResource.gridPos.y = this.currentY; + } this.internal.panels.push(panelResource); // Prepare the coordinates for the next panel @@ -194,9 +197,12 @@ export class DashboardBuilder implements cog.Builder { panel.gridPos = dashboard.defaultGridPos(); } - // Position the panel on the grid - panel.gridPos.x = this.currentX; - panel.gridPos.y = this.currentY; + // The panel either has no position set, or it is the first panel of the dashboard. + // In that case, we position it on the grid + if (panel.gridPos.x == 0 && panel.gridPos.y == 0) { + panel.gridPos.x = this.currentX; + panel.gridPos.y = this.currentY; + } // Prepare the coordinates for the next panel this.currentX += panel.gridPos.w; diff --git a/typescript/src/dashboard/panelBuilder.gen.ts b/typescript/src/dashboard/panelBuilder.gen.ts index 8a03246..2bc6464 100644 --- a/typescript/src/dashboard/panelBuilder.gen.ts +++ b/typescript/src/dashboard/panelBuilder.gen.ts @@ -71,6 +71,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/dashboardlist/panelBuilder.gen.ts b/typescript/src/dashboardlist/panelBuilder.gen.ts index 1d6bd99..6c8e16a 100644 --- a/typescript/src/dashboardlist/panelBuilder.gen.ts +++ b/typescript/src/dashboardlist/panelBuilder.gen.ts @@ -64,6 +64,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/datagrid/panelBuilder.gen.ts b/typescript/src/datagrid/panelBuilder.gen.ts index 49039be..a149684 100644 --- a/typescript/src/datagrid/panelBuilder.gen.ts +++ b/typescript/src/datagrid/panelBuilder.gen.ts @@ -64,6 +64,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/debug/panelBuilder.gen.ts b/typescript/src/debug/panelBuilder.gen.ts index 450cabd..9389348 100644 --- a/typescript/src/debug/panelBuilder.gen.ts +++ b/typescript/src/debug/panelBuilder.gen.ts @@ -64,6 +64,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/gauge/panelBuilder.gen.ts b/typescript/src/gauge/panelBuilder.gen.ts index ec1b3f3..e9f9d8e 100644 --- a/typescript/src/gauge/panelBuilder.gen.ts +++ b/typescript/src/gauge/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/geomap/panelBuilder.gen.ts b/typescript/src/geomap/panelBuilder.gen.ts index 0f091d6..17a0e25 100644 --- a/typescript/src/geomap/panelBuilder.gen.ts +++ b/typescript/src/geomap/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/heatmap/panelBuilder.gen.ts b/typescript/src/heatmap/panelBuilder.gen.ts index 631ae1b..b291b75 100644 --- a/typescript/src/heatmap/panelBuilder.gen.ts +++ b/typescript/src/heatmap/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/histogram/panelBuilder.gen.ts b/typescript/src/histogram/panelBuilder.gen.ts index 4b7b70a..2922ffb 100644 --- a/typescript/src/histogram/panelBuilder.gen.ts +++ b/typescript/src/histogram/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/logs/panelBuilder.gen.ts b/typescript/src/logs/panelBuilder.gen.ts index 1ec58fb..3b2c7a8 100644 --- a/typescript/src/logs/panelBuilder.gen.ts +++ b/typescript/src/logs/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/news/panelBuilder.gen.ts b/typescript/src/news/panelBuilder.gen.ts index 8e063b9..fe770ed 100644 --- a/typescript/src/news/panelBuilder.gen.ts +++ b/typescript/src/news/panelBuilder.gen.ts @@ -64,6 +64,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/nodegraph/panelBuilder.gen.ts b/typescript/src/nodegraph/panelBuilder.gen.ts index 414d2ea..9075243 100644 --- a/typescript/src/nodegraph/panelBuilder.gen.ts +++ b/typescript/src/nodegraph/panelBuilder.gen.ts @@ -64,6 +64,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/piechart/panelBuilder.gen.ts b/typescript/src/piechart/panelBuilder.gen.ts index de87363..4c41688 100644 --- a/typescript/src/piechart/panelBuilder.gen.ts +++ b/typescript/src/piechart/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/stat/panelBuilder.gen.ts b/typescript/src/stat/panelBuilder.gen.ts index 8860f2a..9b2cf22 100644 --- a/typescript/src/stat/panelBuilder.gen.ts +++ b/typescript/src/stat/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/statetimeline/panelBuilder.gen.ts b/typescript/src/statetimeline/panelBuilder.gen.ts index d4beb9e..9c4c024 100644 --- a/typescript/src/statetimeline/panelBuilder.gen.ts +++ b/typescript/src/statetimeline/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/statushistory/panelBuilder.gen.ts b/typescript/src/statushistory/panelBuilder.gen.ts index 74a5c0b..87bd6cb 100644 --- a/typescript/src/statushistory/panelBuilder.gen.ts +++ b/typescript/src/statushistory/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/table/panelBuilder.gen.ts b/typescript/src/table/panelBuilder.gen.ts index f849095..9668a7b 100644 --- a/typescript/src/table/panelBuilder.gen.ts +++ b/typescript/src/table/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/text/panelBuilder.gen.ts b/typescript/src/text/panelBuilder.gen.ts index b5d12a1..02936d3 100644 --- a/typescript/src/text/panelBuilder.gen.ts +++ b/typescript/src/text/panelBuilder.gen.ts @@ -64,6 +64,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/timeseries/panelBuilder.gen.ts b/typescript/src/timeseries/panelBuilder.gen.ts index 8012ab4..667c75b 100644 --- a/typescript/src/timeseries/panelBuilder.gen.ts +++ b/typescript/src/timeseries/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/trend/panelBuilder.gen.ts b/typescript/src/trend/panelBuilder.gen.ts index f12b3be..e5d1d04 100644 --- a/typescript/src/trend/panelBuilder.gen.ts +++ b/typescript/src/trend/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { diff --git a/typescript/src/xychart/panelBuilder.gen.ts b/typescript/src/xychart/panelBuilder.gen.ts index 22a1837..f86433c 100644 --- a/typescript/src/xychart/panelBuilder.gen.ts +++ b/typescript/src/xychart/panelBuilder.gen.ts @@ -65,6 +65,12 @@ export class PanelBuilder implements cog.Builder { return this; } + // Grid position. + gridPos(gridPos: dashboard.GridPos): this { + this.internal.gridPos = gridPos; + return this; + } + // Panel height. The height is the number of rows from the top edge of the panel. height(h: number): this { if (!this.internal.gridPos) { ```