Dashboard: Auto grid options (#102374)

* Dashboard: Auto grid options

* Update

* Fix

* update trans

* Update cue

* Fix persisting auto grid options (#102744)

* Fix persisting auto grid options

* Update i18n

* fix serializer test

* update schema

* reset dashboard_object_gen.go files, run update-codegen.sh

* rename in code

* rename height fill in schema

* rename heightFill fillScreen in code

* fix test

---------

Co-authored-by: oscarkilhed <oscar.kilhed@grafana.com>
This commit is contained in:
Torkel Ödegaard
2025-03-25 16:40:28 +01:00
committed by GitHub
co-authored by oscarkilhed
parent ca14ca70de
commit dc922717dc
16 changed files with 532 additions and 131 deletions
@@ -965,14 +965,21 @@ func NewDashboardResponsiveGridLayoutKind() *DashboardResponsiveGridLayoutKind {
// +k8s:openapi-gen=true
type DashboardResponsiveGridLayoutSpec struct {
Row string `json:"row"`
Col string `json:"col"`
Items []DashboardResponsiveGridLayoutItemKind `json:"items"`
MaxColumnCount *float64 `json:"maxColumnCount,omitempty"`
ColumnWidthMode DashboardResponsiveGridLayoutSpecColumnWidthMode `json:"columnWidthMode"`
ColumnWidth *float64 `json:"columnWidth,omitempty"`
RowHeightMode DashboardResponsiveGridLayoutSpecRowHeightMode `json:"rowHeightMode"`
RowHeight *float64 `json:"rowHeight,omitempty"`
FillScreen *bool `json:"fillScreen,omitempty"`
Items []DashboardResponsiveGridLayoutItemKind `json:"items"`
}
// NewDashboardResponsiveGridLayoutSpec creates a new DashboardResponsiveGridLayoutSpec object.
func NewDashboardResponsiveGridLayoutSpec() *DashboardResponsiveGridLayoutSpec {
return &DashboardResponsiveGridLayoutSpec{}
return &DashboardResponsiveGridLayoutSpec{
MaxColumnCount: (func(input float64) *float64 { return &input })(3),
FillScreen: (func(input bool) *bool { return &input })(false),
}
}
// +k8s:openapi-gen=true
@@ -1795,6 +1802,26 @@ const (
DashboardConditionalRenderingVariableSpecOperatorNotEquals DashboardConditionalRenderingVariableSpecOperator = "notEquals"
)
// +k8s:openapi-gen=true
type DashboardResponsiveGridLayoutSpecColumnWidthMode string
const (
DashboardResponsiveGridLayoutSpecColumnWidthModeNarrow DashboardResponsiveGridLayoutSpecColumnWidthMode = "narrow"
DashboardResponsiveGridLayoutSpecColumnWidthModeStandard DashboardResponsiveGridLayoutSpecColumnWidthMode = "standard"
DashboardResponsiveGridLayoutSpecColumnWidthModeWide DashboardResponsiveGridLayoutSpecColumnWidthMode = "wide"
DashboardResponsiveGridLayoutSpecColumnWidthModeCustom DashboardResponsiveGridLayoutSpecColumnWidthMode = "custom"
)
// +k8s:openapi-gen=true
type DashboardResponsiveGridLayoutSpecRowHeightMode string
const (
DashboardResponsiveGridLayoutSpecRowHeightModeShort DashboardResponsiveGridLayoutSpecRowHeightMode = "short"
DashboardResponsiveGridLayoutSpecRowHeightModeStandard DashboardResponsiveGridLayoutSpecRowHeightMode = "standard"
DashboardResponsiveGridLayoutSpecRowHeightModeTall DashboardResponsiveGridLayoutSpecRowHeightMode = "tall"
DashboardResponsiveGridLayoutSpecRowHeightModeCustom DashboardResponsiveGridLayoutSpecRowHeightMode = "custom"
)
// +k8s:openapi-gen=true
type DashboardTimeSettingsSpecWeekStart string
@@ -3395,20 +3395,44 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutSpec(ref co
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"row": {
"maxColumnCount": {
SchemaProps: spec.SchemaProps{
Type: []string{"number"},
Format: "double",
},
},
"columnWidthMode": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"col": {
"columnWidth": {
SchemaProps: spec.SchemaProps{
Type: []string{"number"},
Format: "double",
},
},
"rowHeightMode": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"rowHeight": {
SchemaProps: spec.SchemaProps{
Type: []string{"number"},
Format: "double",
},
},
"fillScreen": {
SchemaProps: spec.SchemaProps{
Type: []string{"boolean"},
Format: "",
},
},
"items": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
@@ -3423,7 +3447,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutSpec(ref co
},
},
},
Required: []string{"row", "col", "items"},
Required: []string{"columnWidthMode", "rowHeightMode", "items"},
},
},
Dependencies: []string{
@@ -11,6 +11,8 @@ import (
"github.com/grafana/grafana-app-sdk/app"
)
var ()
var appManifestData = app.ManifestData{
AppName: "dashboard",
Group: "dashboard.grafana.app",