Chore: Rename responsive grid -> AutoGrid (#102959)
* Rename ResponsiveGrid -> AutoGrid in schema * Rename responsive grid in code * fix accidental removal of generation * fix i18n * fix backend conversion * run ./hack/update-codegen.sh
This commit is contained in:
@@ -18,7 +18,7 @@ DashboardSpec: {
|
||||
|
||||
elements: [ElementReference.name]: Element
|
||||
|
||||
layout: GridLayoutKind | RowsLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind
|
||||
layout: GridLayoutKind | RowsLayoutKind | AutoGridLayoutKind | TabsLayoutKind
|
||||
|
||||
// Links with references to other dashboards or external websites.
|
||||
links: [...DashboardLink]
|
||||
@@ -494,7 +494,7 @@ RowRepeatOptions: {
|
||||
value: string
|
||||
}
|
||||
|
||||
ResponsiveGridRepeatOptions: {
|
||||
AutoGridRepeatOptions: {
|
||||
mode: RepeatMode
|
||||
value: string
|
||||
}
|
||||
@@ -556,32 +556,32 @@ RowsLayoutRowSpec: {
|
||||
fillScreen?: bool
|
||||
conditionalRendering?: ConditionalRenderingGroupKind
|
||||
repeat?: RowRepeatOptions
|
||||
layout: GridLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind | RowsLayoutKind
|
||||
layout: GridLayoutKind | AutoGridLayoutKind | TabsLayoutKind | RowsLayoutKind
|
||||
}
|
||||
|
||||
ResponsiveGridLayoutKind: {
|
||||
kind: "ResponsiveGridLayout"
|
||||
spec: ResponsiveGridLayoutSpec
|
||||
AutoGridLayoutKind: {
|
||||
kind: "AutoGridLayout"
|
||||
spec: AutoGridLayoutSpec
|
||||
}
|
||||
|
||||
ResponsiveGridLayoutSpec: {
|
||||
AutoGridLayoutSpec: {
|
||||
maxColumnCount?: number | *3
|
||||
columnWidthMode: "narrow" | *"standard" | "wide" | "custom"
|
||||
columnWidth?: number
|
||||
rowHeightMode: "short" | *"standard" | "tall" | "custom"
|
||||
rowHeight?: number
|
||||
fillScreen?: bool | *false
|
||||
items: [...ResponsiveGridLayoutItemKind]
|
||||
items: [...AutoGridLayoutItemKind]
|
||||
}
|
||||
|
||||
ResponsiveGridLayoutItemKind: {
|
||||
kind: "ResponsiveGridLayoutItem"
|
||||
spec: ResponsiveGridLayoutItemSpec
|
||||
AutoGridLayoutItemKind: {
|
||||
kind: "AutoGridLayoutItem"
|
||||
spec: AutoGridLayoutItemSpec
|
||||
}
|
||||
|
||||
ResponsiveGridLayoutItemSpec: {
|
||||
AutoGridLayoutItemSpec: {
|
||||
element: ElementReference
|
||||
repeat?: ResponsiveGridRepeatOptions
|
||||
repeat?: AutoGridRepeatOptions
|
||||
conditionalRendering?: ConditionalRenderingGroupKind
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ TabsLayoutTabKind: {
|
||||
|
||||
TabsLayoutTabSpec: {
|
||||
title?: string
|
||||
layout: GridLayoutKind | RowsLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind
|
||||
layout: GridLayoutKind | RowsLayoutKind | AutoGridLayoutKind | TabsLayoutKind
|
||||
}
|
||||
|
||||
PanelSpec: {
|
||||
|
||||
@@ -836,19 +836,19 @@ func NewDashboardRowsLayoutRowKind() *DashboardRowsLayoutRowKind {
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardRowsLayoutRowSpec struct {
|
||||
Title *string `json:"title,omitempty"`
|
||||
Collapse *bool `json:"collapse,omitempty"`
|
||||
HideHeader *bool `json:"hideHeader,omitempty"`
|
||||
FillScreen *bool `json:"fillScreen,omitempty"`
|
||||
ConditionalRendering *DashboardConditionalRenderingGroupKind `json:"conditionalRendering,omitempty"`
|
||||
Repeat *DashboardRowRepeatOptions `json:"repeat,omitempty"`
|
||||
Layout DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind `json:"layout"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
Collapse *bool `json:"collapse,omitempty"`
|
||||
HideHeader *bool `json:"hideHeader,omitempty"`
|
||||
FillScreen *bool `json:"fillScreen,omitempty"`
|
||||
ConditionalRendering *DashboardConditionalRenderingGroupKind `json:"conditionalRendering,omitempty"`
|
||||
Repeat *DashboardRowRepeatOptions `json:"repeat,omitempty"`
|
||||
Layout DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind `json:"layout"`
|
||||
}
|
||||
|
||||
// NewDashboardRowsLayoutRowSpec creates a new DashboardRowsLayoutRowSpec object.
|
||||
func NewDashboardRowsLayoutRowSpec() *DashboardRowsLayoutRowSpec {
|
||||
return &DashboardRowsLayoutRowSpec{
|
||||
Layout: *NewDashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind(),
|
||||
Layout: *NewDashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -952,75 +952,75 @@ func NewDashboardConditionalRenderingTimeIntervalSpec() *DashboardConditionalRen
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardResponsiveGridLayoutKind struct {
|
||||
Kind string `json:"kind"`
|
||||
Spec DashboardResponsiveGridLayoutSpec `json:"spec"`
|
||||
type DashboardAutoGridLayoutKind struct {
|
||||
Kind string `json:"kind"`
|
||||
Spec DashboardAutoGridLayoutSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// NewDashboardResponsiveGridLayoutKind creates a new DashboardResponsiveGridLayoutKind object.
|
||||
func NewDashboardResponsiveGridLayoutKind() *DashboardResponsiveGridLayoutKind {
|
||||
return &DashboardResponsiveGridLayoutKind{
|
||||
Kind: "ResponsiveGridLayout",
|
||||
Spec: *NewDashboardResponsiveGridLayoutSpec(),
|
||||
// NewDashboardAutoGridLayoutKind creates a new DashboardAutoGridLayoutKind object.
|
||||
func NewDashboardAutoGridLayoutKind() *DashboardAutoGridLayoutKind {
|
||||
return &DashboardAutoGridLayoutKind{
|
||||
Kind: "AutoGridLayout",
|
||||
Spec: *NewDashboardAutoGridLayoutSpec(),
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardResponsiveGridLayoutSpec struct {
|
||||
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"`
|
||||
type DashboardAutoGridLayoutSpec struct {
|
||||
MaxColumnCount *float64 `json:"maxColumnCount,omitempty"`
|
||||
ColumnWidthMode DashboardAutoGridLayoutSpecColumnWidthMode `json:"columnWidthMode"`
|
||||
ColumnWidth *float64 `json:"columnWidth,omitempty"`
|
||||
RowHeightMode DashboardAutoGridLayoutSpecRowHeightMode `json:"rowHeightMode"`
|
||||
RowHeight *float64 `json:"rowHeight,omitempty"`
|
||||
FillScreen *bool `json:"fillScreen,omitempty"`
|
||||
Items []DashboardAutoGridLayoutItemKind `json:"items"`
|
||||
}
|
||||
|
||||
// NewDashboardResponsiveGridLayoutSpec creates a new DashboardResponsiveGridLayoutSpec object.
|
||||
func NewDashboardResponsiveGridLayoutSpec() *DashboardResponsiveGridLayoutSpec {
|
||||
return &DashboardResponsiveGridLayoutSpec{
|
||||
// NewDashboardAutoGridLayoutSpec creates a new DashboardAutoGridLayoutSpec object.
|
||||
func NewDashboardAutoGridLayoutSpec() *DashboardAutoGridLayoutSpec {
|
||||
return &DashboardAutoGridLayoutSpec{
|
||||
MaxColumnCount: (func(input float64) *float64 { return &input })(3),
|
||||
FillScreen: (func(input bool) *bool { return &input })(false),
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardResponsiveGridLayoutItemKind struct {
|
||||
Kind string `json:"kind"`
|
||||
Spec DashboardResponsiveGridLayoutItemSpec `json:"spec"`
|
||||
type DashboardAutoGridLayoutItemKind struct {
|
||||
Kind string `json:"kind"`
|
||||
Spec DashboardAutoGridLayoutItemSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// NewDashboardResponsiveGridLayoutItemKind creates a new DashboardResponsiveGridLayoutItemKind object.
|
||||
func NewDashboardResponsiveGridLayoutItemKind() *DashboardResponsiveGridLayoutItemKind {
|
||||
return &DashboardResponsiveGridLayoutItemKind{
|
||||
Kind: "ResponsiveGridLayoutItem",
|
||||
Spec: *NewDashboardResponsiveGridLayoutItemSpec(),
|
||||
// NewDashboardAutoGridLayoutItemKind creates a new DashboardAutoGridLayoutItemKind object.
|
||||
func NewDashboardAutoGridLayoutItemKind() *DashboardAutoGridLayoutItemKind {
|
||||
return &DashboardAutoGridLayoutItemKind{
|
||||
Kind: "AutoGridLayoutItem",
|
||||
Spec: *NewDashboardAutoGridLayoutItemSpec(),
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardResponsiveGridLayoutItemSpec struct {
|
||||
type DashboardAutoGridLayoutItemSpec struct {
|
||||
Element DashboardElementReference `json:"element"`
|
||||
Repeat *DashboardResponsiveGridRepeatOptions `json:"repeat,omitempty"`
|
||||
Repeat *DashboardAutoGridRepeatOptions `json:"repeat,omitempty"`
|
||||
ConditionalRendering *DashboardConditionalRenderingGroupKind `json:"conditionalRendering,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardResponsiveGridLayoutItemSpec creates a new DashboardResponsiveGridLayoutItemSpec object.
|
||||
func NewDashboardResponsiveGridLayoutItemSpec() *DashboardResponsiveGridLayoutItemSpec {
|
||||
return &DashboardResponsiveGridLayoutItemSpec{
|
||||
// NewDashboardAutoGridLayoutItemSpec creates a new DashboardAutoGridLayoutItemSpec object.
|
||||
func NewDashboardAutoGridLayoutItemSpec() *DashboardAutoGridLayoutItemSpec {
|
||||
return &DashboardAutoGridLayoutItemSpec{
|
||||
Element: *NewDashboardElementReference(),
|
||||
}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardResponsiveGridRepeatOptions struct {
|
||||
type DashboardAutoGridRepeatOptions struct {
|
||||
Mode string `json:"mode"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// NewDashboardResponsiveGridRepeatOptions creates a new DashboardResponsiveGridRepeatOptions object.
|
||||
func NewDashboardResponsiveGridRepeatOptions() *DashboardResponsiveGridRepeatOptions {
|
||||
return &DashboardResponsiveGridRepeatOptions{}
|
||||
// NewDashboardAutoGridRepeatOptions creates a new DashboardAutoGridRepeatOptions object.
|
||||
func NewDashboardAutoGridRepeatOptions() *DashboardAutoGridRepeatOptions {
|
||||
return &DashboardAutoGridRepeatOptions{}
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
@@ -1063,14 +1063,14 @@ func NewDashboardTabsLayoutTabKind() *DashboardTabsLayoutTabKind {
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardTabsLayoutTabSpec struct {
|
||||
Title *string `json:"title,omitempty"`
|
||||
Layout DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind `json:"layout"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
Layout DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind `json:"layout"`
|
||||
}
|
||||
|
||||
// NewDashboardTabsLayoutTabSpec creates a new DashboardTabsLayoutTabSpec object.
|
||||
func NewDashboardTabsLayoutTabSpec() *DashboardTabsLayoutTabSpec {
|
||||
return &DashboardTabsLayoutTabSpec{
|
||||
Layout: *NewDashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind(),
|
||||
Layout: *NewDashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1688,9 +1688,9 @@ type DashboardSpec struct {
|
||||
// Description of dashboard.
|
||||
Description *string `json:"description,omitempty"`
|
||||
// Whether a dashboard is editable or not.
|
||||
Editable *bool `json:"editable,omitempty"`
|
||||
Elements map[string]DashboardElement `json:"elements"`
|
||||
Layout DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind `json:"layout"`
|
||||
Editable *bool `json:"editable,omitempty"`
|
||||
Elements map[string]DashboardElement `json:"elements"`
|
||||
Layout DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind `json:"layout"`
|
||||
// Links with references to other dashboards or external websites.
|
||||
Links []DashboardDashboardLink `json:"links"`
|
||||
// When set to true, the dashboard will redraw panels at an interval matching the pixel width.
|
||||
@@ -1715,7 +1715,7 @@ type DashboardSpec struct {
|
||||
func NewDashboardSpec() *DashboardSpec {
|
||||
return &DashboardSpec{
|
||||
Editable: (func(input bool) *bool { return &input })(true),
|
||||
Layout: *NewDashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind(),
|
||||
Layout: *NewDashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind(),
|
||||
TimeSettings: *NewDashboardTimeSettingsSpec(),
|
||||
}
|
||||
}
|
||||
@@ -1805,23 +1805,23 @@ const (
|
||||
)
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardResponsiveGridLayoutSpecColumnWidthMode string
|
||||
type DashboardAutoGridLayoutSpecColumnWidthMode string
|
||||
|
||||
const (
|
||||
DashboardResponsiveGridLayoutSpecColumnWidthModeNarrow DashboardResponsiveGridLayoutSpecColumnWidthMode = "narrow"
|
||||
DashboardResponsiveGridLayoutSpecColumnWidthModeStandard DashboardResponsiveGridLayoutSpecColumnWidthMode = "standard"
|
||||
DashboardResponsiveGridLayoutSpecColumnWidthModeWide DashboardResponsiveGridLayoutSpecColumnWidthMode = "wide"
|
||||
DashboardResponsiveGridLayoutSpecColumnWidthModeCustom DashboardResponsiveGridLayoutSpecColumnWidthMode = "custom"
|
||||
DashboardAutoGridLayoutSpecColumnWidthModeNarrow DashboardAutoGridLayoutSpecColumnWidthMode = "narrow"
|
||||
DashboardAutoGridLayoutSpecColumnWidthModeStandard DashboardAutoGridLayoutSpecColumnWidthMode = "standard"
|
||||
DashboardAutoGridLayoutSpecColumnWidthModeWide DashboardAutoGridLayoutSpecColumnWidthMode = "wide"
|
||||
DashboardAutoGridLayoutSpecColumnWidthModeCustom DashboardAutoGridLayoutSpecColumnWidthMode = "custom"
|
||||
)
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardResponsiveGridLayoutSpecRowHeightMode string
|
||||
type DashboardAutoGridLayoutSpecRowHeightMode string
|
||||
|
||||
const (
|
||||
DashboardResponsiveGridLayoutSpecRowHeightModeShort DashboardResponsiveGridLayoutSpecRowHeightMode = "short"
|
||||
DashboardResponsiveGridLayoutSpecRowHeightModeStandard DashboardResponsiveGridLayoutSpecRowHeightMode = "standard"
|
||||
DashboardResponsiveGridLayoutSpecRowHeightModeTall DashboardResponsiveGridLayoutSpecRowHeightMode = "tall"
|
||||
DashboardResponsiveGridLayoutSpecRowHeightModeCustom DashboardResponsiveGridLayoutSpecRowHeightMode = "custom"
|
||||
DashboardAutoGridLayoutSpecRowHeightModeShort DashboardAutoGridLayoutSpecRowHeightMode = "short"
|
||||
DashboardAutoGridLayoutSpecRowHeightModeStandard DashboardAutoGridLayoutSpecRowHeightMode = "standard"
|
||||
DashboardAutoGridLayoutSpecRowHeightModeTall DashboardAutoGridLayoutSpecRowHeightMode = "tall"
|
||||
DashboardAutoGridLayoutSpecRowHeightModeCustom DashboardAutoGridLayoutSpecRowHeightMode = "custom"
|
||||
)
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
@@ -2041,25 +2041,25 @@ func (resource *DashboardGridLayoutItemKindOrGridLayoutRowKind) UnmarshalJSON(ra
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind struct {
|
||||
GridLayoutKind *DashboardGridLayoutKind `json:"GridLayoutKind,omitempty"`
|
||||
ResponsiveGridLayoutKind *DashboardResponsiveGridLayoutKind `json:"ResponsiveGridLayoutKind,omitempty"`
|
||||
TabsLayoutKind *DashboardTabsLayoutKind `json:"TabsLayoutKind,omitempty"`
|
||||
RowsLayoutKind *DashboardRowsLayoutKind `json:"RowsLayoutKind,omitempty"`
|
||||
type DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind struct {
|
||||
GridLayoutKind *DashboardGridLayoutKind `json:"GridLayoutKind,omitempty"`
|
||||
AutoGridLayoutKind *DashboardAutoGridLayoutKind `json:"AutoGridLayoutKind,omitempty"`
|
||||
TabsLayoutKind *DashboardTabsLayoutKind `json:"TabsLayoutKind,omitempty"`
|
||||
RowsLayoutKind *DashboardRowsLayoutKind `json:"RowsLayoutKind,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind creates a new DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind object.
|
||||
func NewDashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind() *DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind {
|
||||
return &DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind{}
|
||||
// NewDashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind creates a new DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind object.
|
||||
func NewDashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind() *DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind {
|
||||
return &DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind{}
|
||||
}
|
||||
|
||||
// MarshalJSON implements a custom JSON marshalling logic to encode `DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind` as JSON.
|
||||
func (resource DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind) MarshalJSON() ([]byte, error) {
|
||||
// MarshalJSON implements a custom JSON marshalling logic to encode `DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind` as JSON.
|
||||
func (resource DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind) MarshalJSON() ([]byte, error) {
|
||||
if resource.GridLayoutKind != nil {
|
||||
return json.Marshal(resource.GridLayoutKind)
|
||||
}
|
||||
if resource.ResponsiveGridLayoutKind != nil {
|
||||
return json.Marshal(resource.ResponsiveGridLayoutKind)
|
||||
if resource.AutoGridLayoutKind != nil {
|
||||
return json.Marshal(resource.AutoGridLayoutKind)
|
||||
}
|
||||
if resource.TabsLayoutKind != nil {
|
||||
return json.Marshal(resource.TabsLayoutKind)
|
||||
@@ -2070,8 +2070,8 @@ func (resource DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind
|
||||
return []byte("null"), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode `DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind` from JSON.
|
||||
func (resource *DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind) UnmarshalJSON(raw []byte) error {
|
||||
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode `DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind` from JSON.
|
||||
func (resource *DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind) UnmarshalJSON(raw []byte) error {
|
||||
if raw == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -2088,6 +2088,14 @@ func (resource *DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKin
|
||||
}
|
||||
|
||||
switch discriminator {
|
||||
case "AutoGridLayout":
|
||||
var dashboardAutoGridLayoutKind DashboardAutoGridLayoutKind
|
||||
if err := json.Unmarshal(raw, &dashboardAutoGridLayoutKind); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resource.AutoGridLayoutKind = &dashboardAutoGridLayoutKind
|
||||
return nil
|
||||
case "GridLayout":
|
||||
var dashboardGridLayoutKind DashboardGridLayoutKind
|
||||
if err := json.Unmarshal(raw, &dashboardGridLayoutKind); err != nil {
|
||||
@@ -2096,14 +2104,6 @@ func (resource *DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKin
|
||||
|
||||
resource.GridLayoutKind = &dashboardGridLayoutKind
|
||||
return nil
|
||||
case "ResponsiveGridLayout":
|
||||
var dashboardResponsiveGridLayoutKind DashboardResponsiveGridLayoutKind
|
||||
if err := json.Unmarshal(raw, &dashboardResponsiveGridLayoutKind); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resource.ResponsiveGridLayoutKind = &dashboardResponsiveGridLayoutKind
|
||||
return nil
|
||||
case "RowsLayout":
|
||||
var dashboardRowsLayoutKind DashboardRowsLayoutKind
|
||||
if err := json.Unmarshal(raw, &dashboardRowsLayoutKind); err != nil {
|
||||
@@ -2199,28 +2199,28 @@ func (resource *DashboardConditionalRenderingVariableKindOrConditionalRenderingD
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind struct {
|
||||
GridLayoutKind *DashboardGridLayoutKind `json:"GridLayoutKind,omitempty"`
|
||||
RowsLayoutKind *DashboardRowsLayoutKind `json:"RowsLayoutKind,omitempty"`
|
||||
ResponsiveGridLayoutKind *DashboardResponsiveGridLayoutKind `json:"ResponsiveGridLayoutKind,omitempty"`
|
||||
TabsLayoutKind *DashboardTabsLayoutKind `json:"TabsLayoutKind,omitempty"`
|
||||
type DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind struct {
|
||||
GridLayoutKind *DashboardGridLayoutKind `json:"GridLayoutKind,omitempty"`
|
||||
RowsLayoutKind *DashboardRowsLayoutKind `json:"RowsLayoutKind,omitempty"`
|
||||
AutoGridLayoutKind *DashboardAutoGridLayoutKind `json:"AutoGridLayoutKind,omitempty"`
|
||||
TabsLayoutKind *DashboardTabsLayoutKind `json:"TabsLayoutKind,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind creates a new DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind object.
|
||||
func NewDashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind() *DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind {
|
||||
return &DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind{}
|
||||
// NewDashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind creates a new DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind object.
|
||||
func NewDashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind() *DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind {
|
||||
return &DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind{}
|
||||
}
|
||||
|
||||
// MarshalJSON implements a custom JSON marshalling logic to encode `DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind` as JSON.
|
||||
func (resource DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind) MarshalJSON() ([]byte, error) {
|
||||
// MarshalJSON implements a custom JSON marshalling logic to encode `DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind` as JSON.
|
||||
func (resource DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind) MarshalJSON() ([]byte, error) {
|
||||
if resource.GridLayoutKind != nil {
|
||||
return json.Marshal(resource.GridLayoutKind)
|
||||
}
|
||||
if resource.RowsLayoutKind != nil {
|
||||
return json.Marshal(resource.RowsLayoutKind)
|
||||
}
|
||||
if resource.ResponsiveGridLayoutKind != nil {
|
||||
return json.Marshal(resource.ResponsiveGridLayoutKind)
|
||||
if resource.AutoGridLayoutKind != nil {
|
||||
return json.Marshal(resource.AutoGridLayoutKind)
|
||||
}
|
||||
if resource.TabsLayoutKind != nil {
|
||||
return json.Marshal(resource.TabsLayoutKind)
|
||||
@@ -2228,8 +2228,8 @@ func (resource DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKind
|
||||
return []byte("null"), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode `DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind` from JSON.
|
||||
func (resource *DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind) UnmarshalJSON(raw []byte) error {
|
||||
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode `DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind` from JSON.
|
||||
func (resource *DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind) UnmarshalJSON(raw []byte) error {
|
||||
if raw == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -2246,6 +2246,14 @@ func (resource *DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKin
|
||||
}
|
||||
|
||||
switch discriminator {
|
||||
case "AutoGridLayout":
|
||||
var dashboardAutoGridLayoutKind DashboardAutoGridLayoutKind
|
||||
if err := json.Unmarshal(raw, &dashboardAutoGridLayoutKind); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resource.AutoGridLayoutKind = &dashboardAutoGridLayoutKind
|
||||
return nil
|
||||
case "GridLayout":
|
||||
var dashboardGridLayoutKind DashboardGridLayoutKind
|
||||
if err := json.Unmarshal(raw, &dashboardGridLayoutKind); err != nil {
|
||||
@@ -2254,14 +2262,6 @@ func (resource *DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKin
|
||||
|
||||
resource.GridLayoutKind = &dashboardGridLayoutKind
|
||||
return nil
|
||||
case "ResponsiveGridLayout":
|
||||
var dashboardResponsiveGridLayoutKind DashboardResponsiveGridLayoutKind
|
||||
if err := json.Unmarshal(raw, &dashboardResponsiveGridLayoutKind); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resource.ResponsiveGridLayoutKind = &dashboardResponsiveGridLayoutKind
|
||||
return nil
|
||||
case "RowsLayout":
|
||||
var dashboardRowsLayoutKind DashboardRowsLayoutKind
|
||||
if err := json.Unmarshal(raw, &dashboardRowsLayoutKind); err != nil {
|
||||
|
||||
@@ -24,6 +24,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAnnotationPanelFilter": schema_pkg_apis_dashboard_v2alpha1_DashboardAnnotationPanelFilter(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAnnotationQueryKind": schema_pkg_apis_dashboard_v2alpha1_DashboardAnnotationQueryKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAnnotationQuerySpec": schema_pkg_apis_dashboard_v2alpha1_DashboardAnnotationQuerySpec(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutItemKind": schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridLayoutItemKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutItemSpec": schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridLayoutItemSpec(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutKind": schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridLayoutKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutSpec": schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridLayoutSpec(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridRepeatOptions": schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridRepeatOptions(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingDataKind": schema_pkg_apis_dashboard_v2alpha1_DashboardConditionalRenderingDataKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingDataSpec": schema_pkg_apis_dashboard_v2alpha1_DashboardConditionalRenderingDataSpec(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingGroupKind": schema_pkg_apis_dashboard_v2alpha1_DashboardConditionalRenderingGroupKind(ref),
|
||||
@@ -54,8 +59,8 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutItemKindOrGridLayoutRowKind": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutItemKindOrGridLayoutRowKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutItemSpec": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutItemSpec(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKind": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutRowKind": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutRowKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutRowSpec": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutRowSpec(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutSpec": schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutSpec(ref),
|
||||
@@ -85,11 +90,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRangeMap": schema_pkg_apis_dashboard_v2alpha1_DashboardRangeMap(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRegexMap": schema_pkg_apis_dashboard_v2alpha1_DashboardRegexMap(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRepeatOptions": schema_pkg_apis_dashboard_v2alpha1_DashboardRepeatOptions(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutItemKind": schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutItemKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutItemSpec": schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutItemSpec(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutKind": schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutSpec": schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutSpec(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridRepeatOptions": schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridRepeatOptions(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowRepeatOptions": schema_pkg_apis_dashboard_v2alpha1_DashboardRowRepeatOptions(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowsLayoutKind": schema_pkg_apis_dashboard_v2alpha1_DashboardRowsLayoutKind(ref),
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowsLayoutRowKind": schema_pkg_apis_dashboard_v2alpha1_DashboardRowsLayoutRowKind(ref),
|
||||
@@ -642,6 +642,186 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardAnnotationQuerySpec(ref common.
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridLayoutItemKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutItemSpec"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"kind", "spec"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutItemSpec"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridLayoutItemSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"element": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardElementReference"),
|
||||
},
|
||||
},
|
||||
"repeat": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridRepeatOptions"),
|
||||
},
|
||||
},
|
||||
"conditionalRendering": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingGroupKind"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"element"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridRepeatOptions", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingGroupKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardElementReference"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridLayoutKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutSpec"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"kind", "spec"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutSpec"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridLayoutSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"maxColumnCount": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"number"},
|
||||
Format: "double",
|
||||
},
|
||||
},
|
||||
"columnWidthMode": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"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"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutItemKind"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"columnWidthMode", "rowHeightMode", "items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutItemKind"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardAutoGridRepeatOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"mode": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"value": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"mode", "value"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardConditionalRenderingDataKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
@@ -1934,7 +2114,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKind(ref common.Refer
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -1945,9 +2125,9 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrResponsiveGridL
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKind"),
|
||||
},
|
||||
},
|
||||
"ResponsiveGridLayoutKind": {
|
||||
"AutoGridLayoutKind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutKind"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutKind"),
|
||||
},
|
||||
},
|
||||
"TabsLayoutKind": {
|
||||
@@ -1964,11 +2144,11 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrResponsiveGridL
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowsLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardTabsLayoutKind"},
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowsLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardTabsLayoutKind"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -1984,9 +2164,9 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrRowsLayoutKindO
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowsLayoutKind"),
|
||||
},
|
||||
},
|
||||
"ResponsiveGridLayoutKind": {
|
||||
"AutoGridLayoutKind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutKind"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutKind"),
|
||||
},
|
||||
},
|
||||
"TabsLayoutKind": {
|
||||
@@ -1998,7 +2178,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardGridLayoutKindOrRowsLayoutKindO
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowsLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardTabsLayoutKind"},
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAutoGridLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowsLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardTabsLayoutKind"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3302,186 +3482,6 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardRepeatOptions(ref common.Refere
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutItemKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutItemSpec"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"kind", "spec"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutItemSpec"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutItemSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"element": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardElementReference"),
|
||||
},
|
||||
},
|
||||
"repeat": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridRepeatOptions"),
|
||||
},
|
||||
},
|
||||
"conditionalRendering": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingGroupKind"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"element"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingGroupKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardElementReference", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridRepeatOptions"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutKind(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutSpec"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"kind", "spec"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutSpec"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridLayoutSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"maxColumnCount": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"number"},
|
||||
Format: "double",
|
||||
},
|
||||
},
|
||||
"columnWidthMode": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"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"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutItemKind"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"columnWidthMode", "rowHeightMode", "items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardResponsiveGridLayoutItemKind"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardResponsiveGridRepeatOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"mode": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"value": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"mode", "value"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_dashboard_v2alpha1_DashboardRowRepeatOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
@@ -3607,7 +3607,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardRowsLayoutRowSpec(ref common.Re
|
||||
},
|
||||
"layout": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -3615,7 +3615,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardRowsLayoutRowSpec(ref common.Re
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingGroupKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowRepeatOptions"},
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardConditionalRenderingGroupKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardRowRepeatOptions"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3704,7 +3704,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardSpec(ref common.ReferenceCallba
|
||||
},
|
||||
"layout": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind"),
|
||||
},
|
||||
},
|
||||
"links": {
|
||||
@@ -3790,7 +3790,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardSpec(ref common.ReferenceCallba
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAnnotationQueryKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardDashboardLink", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardPanelKindOrLibraryPanelKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardQueryVariableKindOrTextVariableKindOrConstantVariableKindOrDatasourceVariableKindOrIntervalVariableKindOrCustomVariableKindOrGroupByVariableKindOrAdhocVariableKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardTimeSettingsSpec"},
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardAnnotationQueryKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardDashboardLink", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardPanelKindOrLibraryPanelKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardQueryVariableKindOrTextVariableKindOrConstantVariableKindOrDatasourceVariableKindOrIntervalVariableKindOrCustomVariableKindOrGroupByVariableKindOrAdhocVariableKind", "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardTimeSettingsSpec"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3997,7 +3997,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardTabsLayoutTabSpec(ref common.Re
|
||||
},
|
||||
"layout": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -4005,7 +4005,7 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardTabsLayoutTabSpec(ref common.Re
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind"},
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -3,6 +3,7 @@ API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardAdhocVariableSpec,BaseFilters
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardAdhocVariableSpec,DefaultKeys
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardAdhocVariableSpec,Filters
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardAutoGridLayoutSpec,Items
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardConditionalRenderingGroupSpec,Items
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardCustomVariableSpec,Options
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardDashboardLink,Tags
|
||||
@@ -19,7 +20,6 @@ API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardQueryGroupSpec,Queries
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardQueryGroupSpec,Transformations
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardQueryVariableSpec,Options
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardResponsiveGridLayoutSpec,Items
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardRowsLayoutSpec,Rows
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardSpec,Annotations
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardSpec,Links
|
||||
@@ -37,14 +37,14 @@ API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/ap
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardConditionalRenderingVariableKindOrConditionalRenderingDataKindOrConditionalRenderingTimeIntervalKind,ConditionalRenderingVariableKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutItemKindOrGridLayoutRowKind,GridLayoutItemKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutItemKindOrGridLayoutRowKind,GridLayoutRowKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind,GridLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind,ResponsiveGridLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind,RowsLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind,TabsLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind,GridLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind,ResponsiveGridLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind,RowsLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind,TabsLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind,AutoGridLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind,GridLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind,RowsLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind,TabsLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind,AutoGridLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind,GridLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind,RowsLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind,TabsLayoutKind
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardIntervalVariableSpec,AutoCount
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardIntervalVariableSpec,AutoMin
|
||||
API rule violation: names_match,github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1,DashboardPanelKindOrLibraryPanelKind,LibraryPanelKind
|
||||
|
||||
@@ -77,7 +77,7 @@ func Convert_V0_to_V2(in *v0alpha1.Dashboard, out *v2alpha1.Dashboard, scope con
|
||||
}
|
||||
|
||||
// We need to make sure the layout is set to some value, otherwise the JSON marshaling will fail.
|
||||
out.Spec.Layout = v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind{
|
||||
out.Spec.Layout = v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind{
|
||||
GridLayoutKind: &v2alpha1.DashboardGridLayoutKind{
|
||||
Kind: "GridLayout",
|
||||
Spec: v2alpha1.DashboardGridLayoutSpec{},
|
||||
@@ -122,7 +122,7 @@ func Convert_V1_to_V2(in *v1alpha1.Dashboard, out *v2alpha1.Dashboard, scope con
|
||||
}
|
||||
|
||||
// We need to make sure the layout is set to some value, otherwise the JSON marshaling will fail.
|
||||
out.Spec.Layout = v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrResponsiveGridLayoutKindOrTabsLayoutKind{
|
||||
out.Spec.Layout = v2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind{
|
||||
GridLayoutKind: &v2alpha1.DashboardGridLayoutKind{
|
||||
Kind: "GridLayout",
|
||||
Spec: v2alpha1.DashboardGridLayoutSpec{},
|
||||
|
||||
@@ -22,7 +22,7 @@ DashboardV2Spec: {
|
||||
|
||||
elements: [ElementReference.name]: Element
|
||||
|
||||
layout: GridLayoutKind | RowsLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind
|
||||
layout: GridLayoutKind | RowsLayoutKind | AutoGridLayoutKind | TabsLayoutKind
|
||||
|
||||
// Links with references to other dashboards or external websites.
|
||||
links: [...DashboardLink]
|
||||
@@ -494,7 +494,7 @@ RowRepeatOptions: {
|
||||
value: string
|
||||
}
|
||||
|
||||
ResponsiveGridRepeatOptions: {
|
||||
AutoGridRepeatOptions: {
|
||||
mode: RepeatMode
|
||||
value: string
|
||||
}
|
||||
@@ -556,32 +556,32 @@ RowsLayoutRowSpec: {
|
||||
fillScreen?: bool
|
||||
repeat?: RowRepeatOptions
|
||||
conditionalRendering?: ConditionalRenderingGroupKind
|
||||
layout: GridLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind | RowsLayoutKind
|
||||
layout: GridLayoutKind | AutoGridLayoutKind | TabsLayoutKind | RowsLayoutKind
|
||||
}
|
||||
|
||||
ResponsiveGridLayoutKind: {
|
||||
kind: "ResponsiveGridLayout"
|
||||
spec: ResponsiveGridLayoutSpec
|
||||
AutoGridLayoutKind: {
|
||||
kind: "AutoGridLayout"
|
||||
spec: AutoGridLayoutSpec
|
||||
}
|
||||
|
||||
ResponsiveGridLayoutSpec: {
|
||||
AutoGridLayoutSpec: {
|
||||
maxColumnCount?: number | *3
|
||||
columnWidthMode: "narrow" | *"standard" | "wide" | "custom"
|
||||
columnWidth?: number
|
||||
rowHeightMode: "short" | *"standard" | "tall" | "custom"
|
||||
rowHeight?: number
|
||||
fillScreen?: bool | *false
|
||||
items: [...ResponsiveGridLayoutItemKind]
|
||||
items: [...AutoGridLayoutItemKind]
|
||||
}
|
||||
|
||||
ResponsiveGridLayoutItemKind: {
|
||||
kind: "ResponsiveGridLayoutItem"
|
||||
spec: ResponsiveGridLayoutItemSpec
|
||||
AutoGridLayoutItemKind: {
|
||||
kind: "AutoGridLayoutItem"
|
||||
spec: AutoGridLayoutItemSpec
|
||||
}
|
||||
|
||||
ResponsiveGridLayoutItemSpec: {
|
||||
AutoGridLayoutItemSpec: {
|
||||
element: ElementReference
|
||||
repeat?: ResponsiveGridRepeatOptions
|
||||
repeat?: AutoGridRepeatOptions
|
||||
conditionalRendering?: ConditionalRenderingGroupKind
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ TabsLayoutTabKind: {
|
||||
|
||||
TabsLayoutTabSpec: {
|
||||
title?: string
|
||||
layout: GridLayoutKind | RowsLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind
|
||||
layout: GridLayoutKind | RowsLayoutKind | AutoGridLayoutKind | TabsLayoutKind
|
||||
}
|
||||
|
||||
PanelSpec: {
|
||||
|
||||
@@ -16,7 +16,7 @@ export interface DashboardV2Spec {
|
||||
// Whether a dashboard is editable or not.
|
||||
editable?: boolean;
|
||||
elements: Record<string, Element>;
|
||||
layout: GridLayoutKind | RowsLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind;
|
||||
layout: GridLayoutKind | RowsLayoutKind | AutoGridLayoutKind | TabsLayoutKind;
|
||||
// Links with references to other dashboards or external websites.
|
||||
links: DashboardLink[];
|
||||
// When set to true, the dashboard will redraw panels at an interval matching the pixel width.
|
||||
@@ -738,7 +738,7 @@ export interface RowsLayoutRowSpec {
|
||||
fillScreen?: boolean;
|
||||
repeat?: RowRepeatOptions;
|
||||
conditionalRendering?: ConditionalRenderingGroupKind;
|
||||
layout: GridLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind | RowsLayoutKind;
|
||||
layout: GridLayoutKind | AutoGridLayoutKind | TabsLayoutKind | RowsLayoutKind;
|
||||
}
|
||||
|
||||
export const defaultRowsLayoutRowSpec = (): RowsLayoutRowSpec => ({
|
||||
@@ -823,27 +823,27 @@ export const defaultConditionalRenderingTimeIntervalSpec = (): ConditionalRender
|
||||
value: "",
|
||||
});
|
||||
|
||||
export interface ResponsiveGridLayoutKind {
|
||||
kind: "ResponsiveGridLayout";
|
||||
spec: ResponsiveGridLayoutSpec;
|
||||
export interface AutoGridLayoutKind {
|
||||
kind: "AutoGridLayout";
|
||||
spec: AutoGridLayoutSpec;
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridLayoutKind = (): ResponsiveGridLayoutKind => ({
|
||||
kind: "ResponsiveGridLayout",
|
||||
spec: defaultResponsiveGridLayoutSpec(),
|
||||
export const defaultAutoGridLayoutKind = (): AutoGridLayoutKind => ({
|
||||
kind: "AutoGridLayout",
|
||||
spec: defaultAutoGridLayoutSpec(),
|
||||
});
|
||||
|
||||
export interface ResponsiveGridLayoutSpec {
|
||||
export interface AutoGridLayoutSpec {
|
||||
maxColumnCount?: number;
|
||||
columnWidthMode: "narrow" | "standard" | "wide" | "custom";
|
||||
columnWidth?: number;
|
||||
rowHeightMode: "short" | "standard" | "tall" | "custom";
|
||||
rowHeight?: number;
|
||||
fillScreen?: boolean;
|
||||
items: ResponsiveGridLayoutItemKind[];
|
||||
items: AutoGridLayoutItemKind[];
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridLayoutSpec = (): ResponsiveGridLayoutSpec => ({
|
||||
export const defaultAutoGridLayoutSpec = (): AutoGridLayoutSpec => ({
|
||||
maxColumnCount: 3,
|
||||
columnWidthMode: "standard",
|
||||
rowHeightMode: "standard",
|
||||
@@ -851,32 +851,32 @@ export const defaultResponsiveGridLayoutSpec = (): ResponsiveGridLayoutSpec => (
|
||||
items: [],
|
||||
});
|
||||
|
||||
export interface ResponsiveGridLayoutItemKind {
|
||||
kind: "ResponsiveGridLayoutItem";
|
||||
spec: ResponsiveGridLayoutItemSpec;
|
||||
export interface AutoGridLayoutItemKind {
|
||||
kind: "AutoGridLayoutItem";
|
||||
spec: AutoGridLayoutItemSpec;
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridLayoutItemKind = (): ResponsiveGridLayoutItemKind => ({
|
||||
kind: "ResponsiveGridLayoutItem",
|
||||
spec: defaultResponsiveGridLayoutItemSpec(),
|
||||
export const defaultAutoGridLayoutItemKind = (): AutoGridLayoutItemKind => ({
|
||||
kind: "AutoGridLayoutItem",
|
||||
spec: defaultAutoGridLayoutItemSpec(),
|
||||
});
|
||||
|
||||
export interface ResponsiveGridLayoutItemSpec {
|
||||
export interface AutoGridLayoutItemSpec {
|
||||
element: ElementReference;
|
||||
repeat?: ResponsiveGridRepeatOptions;
|
||||
repeat?: AutoGridRepeatOptions;
|
||||
conditionalRendering?: ConditionalRenderingGroupKind;
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridLayoutItemSpec = (): ResponsiveGridLayoutItemSpec => ({
|
||||
export const defaultAutoGridLayoutItemSpec = (): AutoGridLayoutItemSpec => ({
|
||||
element: defaultElementReference(),
|
||||
});
|
||||
|
||||
export interface ResponsiveGridRepeatOptions {
|
||||
export interface AutoGridRepeatOptions {
|
||||
mode: "variable";
|
||||
value: string;
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridRepeatOptions = (): ResponsiveGridRepeatOptions => ({
|
||||
export const defaultAutoGridRepeatOptions = (): AutoGridRepeatOptions => ({
|
||||
mode: RepeatMode,
|
||||
value: "",
|
||||
});
|
||||
@@ -911,7 +911,7 @@ export const defaultTabsLayoutTabKind = (): TabsLayoutTabKind => ({
|
||||
|
||||
export interface TabsLayoutTabSpec {
|
||||
title?: string;
|
||||
layout: GridLayoutKind | RowsLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind;
|
||||
layout: GridLayoutKind | RowsLayoutKind | AutoGridLayoutKind | TabsLayoutKind;
|
||||
}
|
||||
|
||||
export const defaultTabsLayoutTabSpec = (): TabsLayoutTabSpec => ({
|
||||
|
||||
@@ -693,7 +693,7 @@ export interface RowsLayoutRowSpec {
|
||||
fillScreen?: boolean;
|
||||
conditionalRendering?: ConditionalRenderingGroupKind;
|
||||
repeat?: RowRepeatOptions;
|
||||
layout: GridLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind | RowsLayoutKind;
|
||||
layout: GridLayoutKind | AutoGridLayoutKind | TabsLayoutKind | RowsLayoutKind;
|
||||
}
|
||||
|
||||
export const defaultRowsLayoutRowSpec = (): RowsLayoutRowSpec => ({
|
||||
@@ -778,27 +778,27 @@ export const defaultConditionalRenderingTimeIntervalSpec = (): ConditionalRender
|
||||
value: "",
|
||||
});
|
||||
|
||||
export interface ResponsiveGridLayoutKind {
|
||||
kind: "ResponsiveGridLayout";
|
||||
spec: ResponsiveGridLayoutSpec;
|
||||
export interface AutoGridLayoutKind {
|
||||
kind: "AutoGridLayout";
|
||||
spec: AutoGridLayoutSpec;
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridLayoutKind = (): ResponsiveGridLayoutKind => ({
|
||||
kind: "ResponsiveGridLayout",
|
||||
spec: defaultResponsiveGridLayoutSpec(),
|
||||
export const defaultAutoGridLayoutKind = (): AutoGridLayoutKind => ({
|
||||
kind: "AutoGridLayout",
|
||||
spec: defaultAutoGridLayoutSpec(),
|
||||
});
|
||||
|
||||
export interface ResponsiveGridLayoutSpec {
|
||||
export interface AutoGridLayoutSpec {
|
||||
maxColumnCount?: number;
|
||||
columnWidthMode: "narrow" | "standard" | "wide" | "custom";
|
||||
columnWidth?: number;
|
||||
rowHeightMode: "short" | "standard" | "tall" | "custom";
|
||||
rowHeight?: number;
|
||||
fillScreen?: boolean;
|
||||
items: ResponsiveGridLayoutItemKind[];
|
||||
items: AutoGridLayoutItemKind[];
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridLayoutSpec = (): ResponsiveGridLayoutSpec => ({
|
||||
export const defaultAutoGridLayoutSpec = (): AutoGridLayoutSpec => ({
|
||||
maxColumnCount: 3,
|
||||
columnWidthMode: "standard",
|
||||
rowHeightMode: "standard",
|
||||
@@ -806,32 +806,32 @@ export const defaultResponsiveGridLayoutSpec = (): ResponsiveGridLayoutSpec => (
|
||||
items: [],
|
||||
});
|
||||
|
||||
export interface ResponsiveGridLayoutItemKind {
|
||||
kind: "ResponsiveGridLayoutItem";
|
||||
spec: ResponsiveGridLayoutItemSpec;
|
||||
export interface AutoGridLayoutItemKind {
|
||||
kind: "AutoGridLayoutItem";
|
||||
spec: AutoGridLayoutItemSpec;
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridLayoutItemKind = (): ResponsiveGridLayoutItemKind => ({
|
||||
kind: "ResponsiveGridLayoutItem",
|
||||
spec: defaultResponsiveGridLayoutItemSpec(),
|
||||
export const defaultAutoGridLayoutItemKind = (): AutoGridLayoutItemKind => ({
|
||||
kind: "AutoGridLayoutItem",
|
||||
spec: defaultAutoGridLayoutItemSpec(),
|
||||
});
|
||||
|
||||
export interface ResponsiveGridLayoutItemSpec {
|
||||
export interface AutoGridLayoutItemSpec {
|
||||
element: ElementReference;
|
||||
repeat?: ResponsiveGridRepeatOptions;
|
||||
repeat?: AutoGridRepeatOptions;
|
||||
conditionalRendering?: ConditionalRenderingGroupKind;
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridLayoutItemSpec = (): ResponsiveGridLayoutItemSpec => ({
|
||||
export const defaultAutoGridLayoutItemSpec = (): AutoGridLayoutItemSpec => ({
|
||||
element: defaultElementReference(),
|
||||
});
|
||||
|
||||
export interface ResponsiveGridRepeatOptions {
|
||||
export interface AutoGridRepeatOptions {
|
||||
mode: "variable";
|
||||
value: string;
|
||||
}
|
||||
|
||||
export const defaultResponsiveGridRepeatOptions = (): ResponsiveGridRepeatOptions => ({
|
||||
export const defaultAutoGridRepeatOptions = (): AutoGridRepeatOptions => ({
|
||||
mode: RepeatMode,
|
||||
value: "",
|
||||
});
|
||||
@@ -866,7 +866,7 @@ export const defaultTabsLayoutTabKind = (): TabsLayoutTabKind => ({
|
||||
|
||||
export interface TabsLayoutTabSpec {
|
||||
title?: string;
|
||||
layout: GridLayoutKind | RowsLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind;
|
||||
layout: GridLayoutKind | RowsLayoutKind | AutoGridLayoutKind | TabsLayoutKind;
|
||||
}
|
||||
|
||||
export const defaultTabsLayoutTabSpec = (): TabsLayoutTabSpec => ({
|
||||
@@ -1363,7 +1363,7 @@ export interface Spec {
|
||||
// Whether a dashboard is editable or not.
|
||||
editable?: boolean;
|
||||
elements: Record<string, Element>;
|
||||
layout: GridLayoutKind | RowsLayoutKind | ResponsiveGridLayoutKind | TabsLayoutKind;
|
||||
layout: GridLayoutKind | RowsLayoutKind | AutoGridLayoutKind | TabsLayoutKind;
|
||||
// Links with references to other dashboards or external websites.
|
||||
links: DashboardLink[];
|
||||
// When set to true, the dashboard will redraw panels at an interval matching the pixel width.
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ import { ConditionalRenderingDataKind } from '@grafana/schema/dist/esm/schema/da
|
||||
import { RadioButtonGroup, Stack } from '@grafana/ui';
|
||||
import { t } from 'app/core/internationalization';
|
||||
|
||||
import { ResponsiveGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { AutoGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { RowItem } from '../scene/layout-rows/RowItem';
|
||||
|
||||
import { ConditionHeader } from './ConditionHeader';
|
||||
@@ -31,7 +31,7 @@ export class ConditionalRenderingData extends ConditionalRenderingBase<Condition
|
||||
private _activationHandler() {
|
||||
let panelDataProviders: SceneDataProvider[] = [];
|
||||
const item = this.getConditionalLogicRoot().parent;
|
||||
if (item instanceof ResponsiveGridItem) {
|
||||
if (item instanceof AutoGridItem) {
|
||||
const panelData = sceneGraph.getData(item.state.body);
|
||||
if (panelData) {
|
||||
panelDataProviders.push(panelData);
|
||||
@@ -71,7 +71,7 @@ export class ConditionalRenderingData extends ConditionalRenderingBase<Condition
|
||||
const item = this.getConditionalLogicRoot().parent;
|
||||
|
||||
// extract single panel data from ResponsiveGridItem
|
||||
if (item instanceof ResponsiveGridItem) {
|
||||
if (item instanceof AutoGridItem) {
|
||||
const panelData = sceneGraph.getData(item.state.body).state.data;
|
||||
if (panelData) {
|
||||
data.push(panelData);
|
||||
|
||||
+6
-6
@@ -24,9 +24,9 @@ import { DashboardLayoutItem, IntermediateLayoutItem } from '../types/DashboardL
|
||||
import { DashboardRepeatsProcessedEvent } from '../types/DashboardRepeatsProcessedEvent';
|
||||
|
||||
import { getOptions } from './ResponsiveGridItemEditor';
|
||||
import { ResponsiveGridItemRenderer } from './ResponsiveGridItemRenderer';
|
||||
import { AutoGridItemRenderer } from './ResponsiveGridItemRenderer';
|
||||
|
||||
export interface ResponsiveGridItemState extends SceneObjectState {
|
||||
export interface AutoGridItemState extends SceneObjectState {
|
||||
body: VizPanel;
|
||||
hideWhenNoData?: boolean;
|
||||
repeatedPanels?: VizPanel[];
|
||||
@@ -35,8 +35,8 @@ export interface ResponsiveGridItemState extends SceneObjectState {
|
||||
conditionalRendering?: ConditionalRendering;
|
||||
}
|
||||
|
||||
export class ResponsiveGridItem extends SceneObjectBase<ResponsiveGridItemState> implements DashboardLayoutItem {
|
||||
public static Component = ResponsiveGridItemRenderer;
|
||||
export class AutoGridItem extends SceneObjectBase<AutoGridItemState> implements DashboardLayoutItem {
|
||||
public static Component = AutoGridItemRenderer;
|
||||
private _prevRepeatValues?: VariableValueSingle[];
|
||||
protected _variableDependency = new VariableDependencyConfig(this, {
|
||||
variableNames: this.state.variableName ? [this.state.variableName] : [],
|
||||
@@ -46,7 +46,7 @@ export class ResponsiveGridItem extends SceneObjectBase<ResponsiveGridItemState>
|
||||
public containerRef = createRef<HTMLDivElement>();
|
||||
public cachedBoundingBox: Rect | undefined;
|
||||
|
||||
public constructor(state: ResponsiveGridItemState) {
|
||||
public constructor(state: AutoGridItemState) {
|
||||
super({ ...state, conditionalRendering: state?.conditionalRendering ?? ConditionalRendering.createEmpty() });
|
||||
this.addActivationHandler(() => this._activationHandler());
|
||||
}
|
||||
@@ -131,7 +131,7 @@ export class ResponsiveGridItem extends SceneObjectBase<ResponsiveGridItemState>
|
||||
}
|
||||
|
||||
public setRepeatByVariable(variableName: string | undefined) {
|
||||
const stateUpdate: Partial<ResponsiveGridItemState> = { variableName };
|
||||
const stateUpdate: Partial<AutoGridItemState> = { variableName };
|
||||
|
||||
if (this.state.body.state.$variables) {
|
||||
this.state.body.setState({ $variables: undefined });
|
||||
|
||||
+6
-6
@@ -5,18 +5,18 @@ import { RepeatRowSelect2 } from 'app/features/dashboard/components/RepeatRowSel
|
||||
|
||||
import { useConditionalRenderingEditor } from '../../conditional-rendering/ConditionalRenderingEditor';
|
||||
|
||||
import { ResponsiveGridItem } from './ResponsiveGridItem';
|
||||
import { AutoGridItem } from './ResponsiveGridItem';
|
||||
|
||||
export function getOptions(model: ResponsiveGridItem): OptionsPaneCategoryDescriptor[] {
|
||||
export function getOptions(model: AutoGridItem): OptionsPaneCategoryDescriptor[] {
|
||||
const repeatCategory = new OptionsPaneCategoryDescriptor({
|
||||
title: t('dashboard.responsive-layout.item-options.repeat.title', 'Repeat options'),
|
||||
title: t('dashboard.auto-grid.item-options.repeat.title', 'Repeat options'),
|
||||
id: 'repeat-options',
|
||||
isOpenDefault: false,
|
||||
}).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: t('dashboard.responsive-layout.item-options.repeat.variable.title', 'Repeat by variable'),
|
||||
title: t('dashboard.auto-grid.item-options.repeat.variable.title', 'Repeat by variable'),
|
||||
description: t(
|
||||
'dashboard.responsive-layout.item-options.repeat.variable.description',
|
||||
'dashboard.auto-grid.item-options.repeat.variable.description',
|
||||
'Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard.'
|
||||
),
|
||||
render: () => <RepeatByOption item={model} />,
|
||||
@@ -28,7 +28,7 @@ export function getOptions(model: ResponsiveGridItem): OptionsPaneCategoryDescri
|
||||
return [repeatCategory, conditionalRenderingCategory];
|
||||
}
|
||||
|
||||
function RepeatByOption({ item }: { item: ResponsiveGridItem }) {
|
||||
function RepeatByOption({ item }: { item: AutoGridItem }) {
|
||||
const { variableName } = item.useState();
|
||||
|
||||
return (
|
||||
|
||||
+3
-3
@@ -4,11 +4,11 @@ import { SceneComponentProps } from '@grafana/scenes';
|
||||
|
||||
import { useDashboardState, useIsConditionallyHidden } from '../../utils/utils';
|
||||
|
||||
import { ResponsiveGridItem } from './ResponsiveGridItem';
|
||||
import { AutoGridItem } from './ResponsiveGridItem';
|
||||
|
||||
export interface ResponsiveGridItemProps extends SceneComponentProps<ResponsiveGridItem> {}
|
||||
export interface AutoGridItemProps extends SceneComponentProps<AutoGridItem> {}
|
||||
|
||||
export function ResponsiveGridItemRenderer({ model }: ResponsiveGridItemProps) {
|
||||
export function AutoGridItemRenderer({ model }: AutoGridItemProps) {
|
||||
const { body } = model.useState();
|
||||
const { isEditing } = useDashboardState(model);
|
||||
const isConditionallyHidden = useIsConditionallyHidden(model);
|
||||
|
||||
+11
-14
@@ -7,11 +7,11 @@ import { LayoutOrchestrator } from '../layout-manager/LayoutOrchestrator';
|
||||
import { DropZone, Point, Rect, SceneLayoutWithDragAndDrop } from '../layout-manager/utils';
|
||||
import { DashboardLayoutItem } from '../types/DashboardLayoutItem';
|
||||
|
||||
import { ResponsiveGridItem } from './ResponsiveGridItem';
|
||||
import { ResponsiveGridLayoutRenderer } from './ResponsiveGridLayoutRenderer';
|
||||
import { AutoGridItem } from './ResponsiveGridItem';
|
||||
import { AutoGridLayoutRenderer } from './ResponsiveGridLayoutRenderer';
|
||||
|
||||
export interface ResponsiveGridLayoutState extends SceneObjectState, ResponsiveGridLayoutOptions {
|
||||
children: ResponsiveGridItem[];
|
||||
export interface AutoGridLayoutState extends SceneObjectState, AutoGridLayoutOptions {
|
||||
children: AutoGridItem[];
|
||||
|
||||
/**
|
||||
* True when the item should be rendered but not visible.
|
||||
@@ -22,7 +22,7 @@ export interface ResponsiveGridLayoutState extends SceneObjectState, ResponsiveG
|
||||
/**
|
||||
* For media query for screens smaller than md breakpoint
|
||||
*/
|
||||
md?: ResponsiveGridLayoutOptions;
|
||||
md?: AutoGridLayoutOptions;
|
||||
|
||||
/** True when the items should be lazy loaded */
|
||||
isLazy?: boolean;
|
||||
@@ -31,7 +31,7 @@ export interface ResponsiveGridLayoutState extends SceneObjectState, ResponsiveG
|
||||
isDraggable?: boolean;
|
||||
}
|
||||
|
||||
export interface ResponsiveGridLayoutOptions {
|
||||
export interface AutoGridLayoutOptions {
|
||||
/**
|
||||
* Useful for setting a height on items without specifying how many rows there will be.
|
||||
* Defaults to 320px
|
||||
@@ -55,13 +55,10 @@ export interface ResponsiveGridLayoutOptions {
|
||||
justifyContent?: CSSProperties['justifyContent'];
|
||||
}
|
||||
|
||||
export class ResponsiveGridLayout
|
||||
extends SceneObjectBase<ResponsiveGridLayoutState>
|
||||
implements SceneLayoutWithDragAndDrop
|
||||
{
|
||||
export class AutoGridLayout extends SceneObjectBase<AutoGridLayoutState> implements SceneLayoutWithDragAndDrop {
|
||||
public layoutOrchestrator: LayoutOrchestrator | undefined;
|
||||
|
||||
public static Component = ResponsiveGridLayoutRenderer;
|
||||
public static Component = AutoGridLayoutRenderer;
|
||||
|
||||
public containerRef = createRef<HTMLDivElement>();
|
||||
|
||||
@@ -72,7 +69,7 @@ export class ResponsiveGridLayout
|
||||
public rowCount = 1;
|
||||
public scrollPos: ReturnType<typeof closestScroll> | undefined;
|
||||
|
||||
public constructor(state: Partial<ResponsiveGridLayoutState>) {
|
||||
public constructor(state: Partial<AutoGridLayoutState>) {
|
||||
super({
|
||||
rowGap: 1,
|
||||
columnGap: 1,
|
||||
@@ -114,7 +111,7 @@ export class ResponsiveGridLayout
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Refresh bounding boxes for all responsive grid items
|
||||
// Refresh bounding boxes for all auto grid items
|
||||
for (const child of this.state.children) {
|
||||
child.computeBoundingBox();
|
||||
}
|
||||
@@ -169,7 +166,7 @@ export class ResponsiveGridLayout
|
||||
|
||||
layoutItemIR.body.clearParent();
|
||||
|
||||
const newLayoutItem = new ResponsiveGridItem({ body: layoutItemIR.body });
|
||||
const newLayoutItem = new AutoGridItem({ body: layoutItemIR.body });
|
||||
layoutChildren.splice(this.activeIndex ?? 0, 0, newLayoutItem);
|
||||
|
||||
this.setState({
|
||||
|
||||
+8
-8
@@ -3,14 +3,14 @@ import { SceneQueryRunner, VizPanel } from '@grafana/scenes';
|
||||
import { findVizPanelByKey } from '../../utils/utils';
|
||||
import { DashboardScene } from '../DashboardScene';
|
||||
|
||||
import { ResponsiveGridItem } from './ResponsiveGridItem';
|
||||
import { ResponsiveGridLayout } from './ResponsiveGridLayout';
|
||||
import { ResponsiveGridLayoutManager } from './ResponsiveGridLayoutManager';
|
||||
import { AutoGridItem } from './ResponsiveGridItem';
|
||||
import { AutoGridLayout } from './ResponsiveGridLayout';
|
||||
import { AutoGridLayoutManager } from './ResponsiveGridLayoutManager';
|
||||
|
||||
describe('ResponsiveGridLayoutManager', () => {
|
||||
describe('AutoGridLayoutManager', () => {
|
||||
it('Should clone the layout', () => {
|
||||
const { manager } = setup();
|
||||
const clone = manager.cloneLayout('foo', true) as ResponsiveGridLayoutManager;
|
||||
const clone = manager.cloneLayout('foo', true) as AutoGridLayoutManager;
|
||||
|
||||
expect(clone).not.toBe(manager);
|
||||
expect(clone.state.layout).not.toBe(manager.state.layout);
|
||||
@@ -27,7 +27,7 @@ describe('ResponsiveGridLayoutManager', () => {
|
||||
|
||||
function setup() {
|
||||
const gridItems = [
|
||||
new ResponsiveGridItem({
|
||||
new AutoGridItem({
|
||||
key: 'grid-item-1',
|
||||
body: new VizPanel({
|
||||
title: 'Panel A',
|
||||
@@ -36,7 +36,7 @@ function setup() {
|
||||
$data: new SceneQueryRunner({ key: 'data-query-runner', queries: [{ refId: 'A' }] }),
|
||||
}),
|
||||
}),
|
||||
new ResponsiveGridItem({
|
||||
new AutoGridItem({
|
||||
key: 'grid-item-2',
|
||||
body: new VizPanel({
|
||||
title: 'Panel B',
|
||||
@@ -46,7 +46,7 @@ function setup() {
|
||||
}),
|
||||
];
|
||||
|
||||
const manager = new ResponsiveGridLayoutManager({ layout: new ResponsiveGridLayout({ children: gridItems }) });
|
||||
const manager = new AutoGridLayoutManager({ layout: new AutoGridLayout({ children: gridItems }) });
|
||||
|
||||
new DashboardScene({ body: manager });
|
||||
|
||||
|
||||
+26
-26
@@ -15,12 +15,12 @@ import {
|
||||
import { DashboardLayoutManager } from '../types/DashboardLayoutManager';
|
||||
import { LayoutRegistryItem } from '../types/LayoutRegistryItem';
|
||||
|
||||
import { ResponsiveGridItem } from './ResponsiveGridItem';
|
||||
import { ResponsiveGridLayout } from './ResponsiveGridLayout';
|
||||
import { AutoGridItem } from './ResponsiveGridItem';
|
||||
import { AutoGridLayout } from './ResponsiveGridLayout';
|
||||
import { getEditOptions } from './ResponsiveGridLayoutManagerEditor';
|
||||
|
||||
interface ResponsiveGridLayoutManagerState extends SceneObjectState {
|
||||
layout: ResponsiveGridLayout;
|
||||
interface AutoGridLayoutManagerState extends SceneObjectState {
|
||||
layout: AutoGridLayout;
|
||||
maxColumnCount: number;
|
||||
rowHeight: AutoGridRowHeight;
|
||||
columnWidth: AutoGridColumnWidth;
|
||||
@@ -34,30 +34,30 @@ export const AUTO_GRID_DEFAULT_MAX_COLUMN_COUNT = 3;
|
||||
export const AUTO_GRID_DEFAULT_COLUMN_WIDTH = 'standard';
|
||||
export const AUTO_GRID_DEFAULT_ROW_HEIGHT = 'standard';
|
||||
|
||||
export class ResponsiveGridLayoutManager
|
||||
extends SceneObjectBase<ResponsiveGridLayoutManagerState>
|
||||
export class AutoGridLayoutManager
|
||||
extends SceneObjectBase<AutoGridLayoutManagerState>
|
||||
implements DashboardLayoutManager
|
||||
{
|
||||
public static Component = ResponsiveGridLayoutManagerRenderer;
|
||||
public static Component = AutoGridLayoutManagerRenderer;
|
||||
|
||||
public readonly isDashboardLayoutManager = true;
|
||||
|
||||
public static readonly descriptor: LayoutRegistryItem = {
|
||||
get name() {
|
||||
return t('dashboard.responsive-layout.name', 'Auto grid');
|
||||
return t('dashboard.auto-grid.name', 'Auto grid');
|
||||
},
|
||||
get description() {
|
||||
return t('dashboard.responsive-layout.description', 'Panels resize to fit and form uniform grids');
|
||||
return t('dashboard.auto-grid.description', 'Panels resize to fit and form uniform grids');
|
||||
},
|
||||
id: 'responsive-grid',
|
||||
createFromLayout: ResponsiveGridLayoutManager.createFromLayout,
|
||||
kind: 'ResponsiveGridLayout',
|
||||
id: 'auto-grid',
|
||||
createFromLayout: AutoGridLayoutManager.createFromLayout,
|
||||
kind: 'AutoGridLayout',
|
||||
isGridLayout: true,
|
||||
};
|
||||
|
||||
public readonly descriptor = ResponsiveGridLayoutManager.descriptor;
|
||||
public readonly descriptor = AutoGridLayoutManager.descriptor;
|
||||
|
||||
public constructor(state: Partial<ResponsiveGridLayoutManagerState>) {
|
||||
public constructor(state: Partial<AutoGridLayoutManagerState>) {
|
||||
const maxColumnCount = state.maxColumnCount ?? AUTO_GRID_DEFAULT_MAX_COLUMN_COUNT;
|
||||
const columnWidth = state.columnWidth ?? AUTO_GRID_DEFAULT_COLUMN_WIDTH;
|
||||
const rowHeight = state.rowHeight ?? AUTO_GRID_DEFAULT_ROW_HEIGHT;
|
||||
@@ -71,7 +71,7 @@ export class ResponsiveGridLayoutManager
|
||||
fillScreen,
|
||||
layout:
|
||||
state.layout ??
|
||||
new ResponsiveGridLayout({
|
||||
new AutoGridLayout({
|
||||
templateColumns: getTemplateColumnsTemplate(maxColumnCount, columnWidth),
|
||||
autoRows: getAutoRowsTemplate(rowHeight, fillScreen),
|
||||
}),
|
||||
@@ -89,7 +89,7 @@ export class ResponsiveGridLayoutManager
|
||||
vizPanel.clearParent();
|
||||
|
||||
this.state.layout.setState({
|
||||
children: [new ResponsiveGridItem({ body: vizPanel }), ...this.state.layout.state.children],
|
||||
children: [new AutoGridItem({ body: vizPanel }), ...this.state.layout.state.children],
|
||||
});
|
||||
|
||||
this.publishEvent(new NewObjectAddedToCanvasEvent(vizPanel), true);
|
||||
@@ -120,7 +120,7 @@ export class ResponsiveGridLayoutManager
|
||||
|
||||
public duplicatePanel(panel: VizPanel) {
|
||||
const gridItem = panel.parent;
|
||||
if (!(gridItem instanceof ResponsiveGridItem)) {
|
||||
if (!(gridItem instanceof AutoGridItem)) {
|
||||
console.error('Trying to duplicate a panel that is not inside a DashboardGridItem');
|
||||
return;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ export class ResponsiveGridLayoutManager
|
||||
const panels: VizPanel[] = [];
|
||||
|
||||
for (const child of this.state.layout.state.children) {
|
||||
if (child instanceof ResponsiveGridItem) {
|
||||
if (child instanceof AutoGridItem) {
|
||||
panels.push(child.state.body);
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ export class ResponsiveGridLayoutManager
|
||||
return this.clone({
|
||||
layout: this.state.layout.clone({
|
||||
children: this.state.layout.state.children.map((gridItem) => {
|
||||
if (gridItem instanceof ResponsiveGridItem) {
|
||||
if (gridItem instanceof AutoGridItem) {
|
||||
// Get the original panel ID from the gridItem's key
|
||||
const panelId = getPanelIdForVizPanel(gridItem.state.body);
|
||||
const gridItemKey = joinCloneKeys(ancestorKey, getGridItemKeyForPanelId(panelId));
|
||||
@@ -227,26 +227,26 @@ export class ResponsiveGridLayoutManager
|
||||
});
|
||||
}
|
||||
|
||||
public static createEmpty(): ResponsiveGridLayoutManager {
|
||||
return new ResponsiveGridLayoutManager({});
|
||||
public static createEmpty(): AutoGridLayoutManager {
|
||||
return new AutoGridLayoutManager({});
|
||||
}
|
||||
|
||||
public static createFromLayout(layout: DashboardLayoutManager): ResponsiveGridLayoutManager {
|
||||
public static createFromLayout(layout: DashboardLayoutManager): AutoGridLayoutManager {
|
||||
const panels = layout.getVizPanels();
|
||||
const children: ResponsiveGridItem[] = [];
|
||||
const children: AutoGridItem[] = [];
|
||||
|
||||
for (let panel of panels) {
|
||||
children.push(new ResponsiveGridItem({ body: panel.clone() }));
|
||||
children.push(new AutoGridItem({ body: panel.clone() }));
|
||||
}
|
||||
|
||||
const layoutManager = ResponsiveGridLayoutManager.createEmpty();
|
||||
const layoutManager = AutoGridLayoutManager.createEmpty();
|
||||
layoutManager.state.layout.setState({ children });
|
||||
|
||||
return layoutManager;
|
||||
}
|
||||
}
|
||||
|
||||
function ResponsiveGridLayoutManagerRenderer({ model }: SceneComponentProps<ResponsiveGridLayoutManager>) {
|
||||
function AutoGridLayoutManagerRenderer({ model }: SceneComponentProps<AutoGridLayoutManager>) {
|
||||
return <model.state.layout.Component model={model.state.layout} />;
|
||||
}
|
||||
|
||||
|
||||
+16
-22
@@ -5,9 +5,9 @@ import { Button, Combobox, ComboboxOption, Field, InlineSwitch, Input, Stack } f
|
||||
import { t } from 'app/core/internationalization';
|
||||
import { OptionsPaneItemDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor';
|
||||
|
||||
import { AutoGridColumnWidth, AutoGridRowHeight, ResponsiveGridLayoutManager } from './ResponsiveGridLayoutManager';
|
||||
import { AutoGridColumnWidth, AutoGridRowHeight, AutoGridLayoutManager } from './ResponsiveGridLayoutManager';
|
||||
|
||||
export function getEditOptions(layoutManager: ResponsiveGridLayoutManager): OptionsPaneItemDescriptor[] {
|
||||
export function getEditOptions(layoutManager: AutoGridLayoutManager): OptionsPaneItemDescriptor[] {
|
||||
const options: OptionsPaneItemDescriptor[] = [];
|
||||
|
||||
options.push(
|
||||
@@ -29,7 +29,7 @@ export function getEditOptions(layoutManager: ResponsiveGridLayoutManager): Opti
|
||||
return options;
|
||||
}
|
||||
|
||||
function GridLayoutColumns({ layoutManager }: { layoutManager: ResponsiveGridLayoutManager }) {
|
||||
function GridLayoutColumns({ layoutManager }: { layoutManager: AutoGridLayoutManager }) {
|
||||
const { maxColumnCount, columnWidth } = layoutManager.useState();
|
||||
const [inputRef, setInputRef] = React.useState<HTMLInputElement | null>(null);
|
||||
const [focusInput, setFocusInput] = React.useState(false);
|
||||
@@ -55,8 +55,8 @@ function GridLayoutColumns({ layoutManager }: { layoutManager: ResponsiveGridLay
|
||||
const isStandardMinWidth = typeof columnWidth === 'string';
|
||||
|
||||
const minWidthLabel = isStandardMinWidth
|
||||
? t('dashboard.responsive-layout.options.min-width', 'Min column width')
|
||||
: t('dashboard.responsive-layout.options.min-width-custom', 'Custom min width');
|
||||
? t('dashboard.auto-grid.options.min-width', 'Min column width')
|
||||
: t('dashboard.auto-grid.options.min-width-custom', 'Custom min width');
|
||||
const colOptions = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'].map((value) => ({ label: value, value }));
|
||||
|
||||
const onCustomMinWidthChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
@@ -93,7 +93,7 @@ function GridLayoutColumns({ layoutManager }: { layoutManager: ResponsiveGridLay
|
||||
invalid={customMinWidthError}
|
||||
error={
|
||||
customMinWidthError
|
||||
? t('dashboard.responsive-layout.options.min-width-error', 'A number between 50 and 2000 is required')
|
||||
? t('dashboard.auto-grid.options.min-width-error', 'A number between 50 and 2000 is required')
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
@@ -113,19 +113,16 @@ function GridLayoutColumns({ layoutManager }: { layoutManager: ResponsiveGridLay
|
||||
size="sm"
|
||||
fill="text"
|
||||
icon="times"
|
||||
tooltip={t(
|
||||
'dashboard.responsive-layout.options.min-width-custom-clear',
|
||||
'Back to standard min column width'
|
||||
)}
|
||||
tooltip={t('dashboard.auto-grid.options.min-width-custom-clear', 'Back to standard min column width')}
|
||||
onClick={onClearCustomMinWidth}
|
||||
>
|
||||
{t('dashboard.responsive-layout.options.custom-min-width.clear', 'Clear')}
|
||||
{t('dashboard.auto-grid.options.custom-min-width.clear', 'Clear')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
<Field label={t('dashboard.responsive-layout.options.max-columns', 'Max columns')}>
|
||||
<Field label={t('dashboard.auto-grid.options.max-columns', 'Max columns')}>
|
||||
<Combobox
|
||||
options={colOptions}
|
||||
value={String(maxColumnCount)}
|
||||
@@ -136,7 +133,7 @@ function GridLayoutColumns({ layoutManager }: { layoutManager: ResponsiveGridLay
|
||||
);
|
||||
}
|
||||
|
||||
function GridLayoutRows({ layoutManager }: { layoutManager: ResponsiveGridLayoutManager }) {
|
||||
function GridLayoutRows({ layoutManager }: { layoutManager: AutoGridLayoutManager }) {
|
||||
const { rowHeight, fillScreen } = layoutManager.useState();
|
||||
const [inputRef, setInputRef] = React.useState<HTMLInputElement | null>(null);
|
||||
const [focusInput, setFocusInput] = React.useState(false);
|
||||
@@ -161,8 +158,8 @@ function GridLayoutRows({ layoutManager }: { layoutManager: ResponsiveGridLayout
|
||||
|
||||
const isStandardHeight = typeof rowHeight === 'string';
|
||||
const rowHeightLabel = rowHeight
|
||||
? t('dashboard.responsive-layout.options.min-height', 'Row height')
|
||||
: t('dashboard.responsive-layout.options.min-height-custom', 'Custom row height');
|
||||
? t('dashboard.auto-grid.options.min-height', 'Row height')
|
||||
: t('dashboard.auto-grid.options.min-height-custom', 'Custom row height');
|
||||
|
||||
const onCustomHeightChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const pixels = parseInt(e.target.value, 10);
|
||||
@@ -198,7 +195,7 @@ function GridLayoutRows({ layoutManager }: { layoutManager: ResponsiveGridLayout
|
||||
invalid={customMinWidthError}
|
||||
error={
|
||||
customMinWidthError
|
||||
? t('dashboard.responsive-layout.options.min-height-error', 'A number between 50 and 2000 is required')
|
||||
? t('dashboard.auto-grid.options.min-height-error', 'A number between 50 and 2000 is required')
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
@@ -219,19 +216,16 @@ function GridLayoutRows({ layoutManager }: { layoutManager: ResponsiveGridLayout
|
||||
size="sm"
|
||||
fill="text"
|
||||
icon="times"
|
||||
tooltip={t(
|
||||
'dashboard.responsive-layout.options.min-width-custom-clear',
|
||||
'Back to standard min column width'
|
||||
)}
|
||||
tooltip={t('dashboard.auto-grid.options.min-width-custom-clear', 'Back to standard min column width')}
|
||||
onClick={onClearCustomRowHeight}
|
||||
>
|
||||
{t('dashboard.responsive-layout.options.custom-min-height.clear', 'Clear')}
|
||||
{t('dashboard.auto-grid.options.custom-min-height.clear', 'Clear')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
<Field label={t('dashboard.responsive-layout.options.height-fill', 'Fill screen')}>
|
||||
<Field label={t('dashboard.auto-grid.options.height-fill', 'Fill screen')}>
|
||||
<InlineSwitch value={fillScreen} onChange={() => layoutManager.onFillScreenChanged(!fillScreen)} />
|
||||
</Field>
|
||||
</Stack>
|
||||
|
||||
+3
-3
@@ -7,9 +7,9 @@ import { useStyles2 } from '@grafana/ui';
|
||||
|
||||
import { getDashboardSceneFor } from '../../utils/utils';
|
||||
|
||||
import { ResponsiveGridLayout, ResponsiveGridLayoutState } from './ResponsiveGridLayout';
|
||||
import { AutoGridLayout, AutoGridLayoutState } from './ResponsiveGridLayout';
|
||||
|
||||
export function ResponsiveGridLayoutRenderer({ model }: SceneComponentProps<ResponsiveGridLayout>) {
|
||||
export function AutoGridLayoutRenderer({ model }: SceneComponentProps<AutoGridLayout>) {
|
||||
const { children, isHidden, isLazy } = model.useState();
|
||||
const styles = useStyles2(getStyles, model.state);
|
||||
const { layoutOrchestrator } = getDashboardSceneFor(model).state;
|
||||
@@ -76,7 +76,7 @@ export function ResponsiveGridLayoutRenderer({ model }: SceneComponentProps<Resp
|
||||
);
|
||||
}
|
||||
|
||||
const getStyles = (theme: GrafanaTheme2, state: ResponsiveGridLayoutState) => ({
|
||||
const getStyles = (theme: GrafanaTheme2, state: AutoGridLayoutState) => ({
|
||||
container: css({
|
||||
display: 'grid',
|
||||
position: 'relative',
|
||||
|
||||
@@ -5,7 +5,7 @@ import { OptionsPaneCategoryDescriptor } from 'app/features/dashboard/components
|
||||
|
||||
import { ConditionalRendering } from '../../conditional-rendering/ConditionalRendering';
|
||||
import { getDefaultVizPanel } from '../../utils/utils';
|
||||
import { ResponsiveGridLayoutManager } from '../layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { AutoGridLayoutManager } from '../layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { LayoutRestorer } from '../layouts-shared/LayoutRestorer';
|
||||
import { BulkActionElement } from '../types/BulkActionElement';
|
||||
import { DashboardLayoutManager } from '../types/DashboardLayoutManager';
|
||||
@@ -44,7 +44,7 @@ export class RowItem
|
||||
super({
|
||||
...state,
|
||||
title: state?.title ?? t('dashboard.rows-layout.row.new', 'New row'),
|
||||
layout: state?.layout ?? ResponsiveGridLayoutManager.createEmpty(),
|
||||
layout: state?.layout ?? AutoGridLayoutManager.createEmpty(),
|
||||
conditionalRendering: state?.conditionalRendering ?? ConditionalRendering.createEmpty(),
|
||||
});
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import kbn from 'app/core/utils/kbn';
|
||||
import { OptionsPaneCategoryDescriptor } from 'app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor';
|
||||
|
||||
import { getDefaultVizPanel } from '../../utils/utils';
|
||||
import { ResponsiveGridLayoutManager } from '../layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { AutoGridLayoutManager } from '../layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { LayoutRestorer } from '../layouts-shared/LayoutRestorer';
|
||||
import { BulkActionElement } from '../types/BulkActionElement';
|
||||
import { DashboardLayoutManager } from '../types/DashboardLayoutManager';
|
||||
@@ -38,7 +38,7 @@ export class TabItem
|
||||
super({
|
||||
...state,
|
||||
title: state?.title ?? t('dashboard.tabs-layout.tab.new', 'New tab'),
|
||||
layout: state?.layout ?? ResponsiveGridLayoutManager.createEmpty(),
|
||||
layout: state?.layout ?? AutoGridLayoutManager.createEmpty(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Registry } from '@grafana/data';
|
||||
|
||||
import { DefaultGridLayoutManager } from '../layout-default/DefaultGridLayoutManager';
|
||||
import { ResponsiveGridLayoutManager } from '../layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { AutoGridLayoutManager } from '../layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { RowsLayoutManager } from '../layout-rows/RowsLayoutManager';
|
||||
import { TabsLayoutManager } from '../layout-tabs/TabsLayoutManager';
|
||||
import { LayoutRegistryItem } from '../types/LayoutRegistryItem';
|
||||
@@ -9,7 +9,7 @@ import { LayoutRegistryItem } from '../types/LayoutRegistryItem';
|
||||
export const layoutRegistry: Registry<LayoutRegistryItem> = new Registry<LayoutRegistryItem>(() => {
|
||||
return [
|
||||
DefaultGridLayoutManager.descriptor,
|
||||
ResponsiveGridLayoutManager.descriptor,
|
||||
AutoGridLayoutManager.descriptor,
|
||||
RowsLayoutManager.descriptor,
|
||||
TabsLayoutManager.descriptor,
|
||||
];
|
||||
|
||||
+18
-18
@@ -1,11 +1,11 @@
|
||||
import {
|
||||
DashboardV2Spec,
|
||||
defaultResponsiveGridLayoutSpec,
|
||||
ResponsiveGridLayoutItemKind,
|
||||
defaultAutoGridLayoutSpec,
|
||||
AutoGridLayoutItemKind,
|
||||
} from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0';
|
||||
|
||||
import { ResponsiveGridItem } from '../../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { ResponsiveGridLayout } from '../../scene/layout-responsive-grid/ResponsiveGridLayout';
|
||||
import { AutoGridItem } from '../../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { AutoGridLayout } from '../../scene/layout-responsive-grid/ResponsiveGridLayout';
|
||||
import {
|
||||
AUTO_GRID_DEFAULT_COLUMN_WIDTH,
|
||||
AUTO_GRID_DEFAULT_ROW_HEIGHT,
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
AutoGridRowHeight,
|
||||
getAutoRowsTemplate,
|
||||
getTemplateColumnsTemplate,
|
||||
ResponsiveGridLayoutManager,
|
||||
AutoGridLayoutManager,
|
||||
} from '../../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { DashboardLayoutManager, LayoutManagerSerializer } from '../../scene/types/DashboardLayoutManager';
|
||||
import { dashboardSceneGraph } from '../../utils/dashboardSceneGraph';
|
||||
@@ -21,27 +21,27 @@ import { getGridItemKeyForPanelId } from '../../utils/utils';
|
||||
|
||||
import { buildLibraryPanel, buildVizPanel, getConditionalRendering } from './utils';
|
||||
|
||||
export class ResponsiveGridLayoutSerializer implements LayoutManagerSerializer {
|
||||
serialize(layoutManager: ResponsiveGridLayoutManager): DashboardV2Spec['layout'] {
|
||||
export class AutoGridLayoutSerializer implements LayoutManagerSerializer {
|
||||
serialize(layoutManager: AutoGridLayoutManager): DashboardV2Spec['layout'] {
|
||||
const { maxColumnCount, fillScreen, columnWidth, rowHeight, layout } = layoutManager.state;
|
||||
const defaults = defaultResponsiveGridLayoutSpec();
|
||||
const defaults = defaultAutoGridLayoutSpec();
|
||||
|
||||
return {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: {
|
||||
maxColumnCount,
|
||||
fillScreen: fillScreen === defaults.fillScreen ? undefined : fillScreen,
|
||||
...serializeAutoGridColumnWidth(columnWidth),
|
||||
...serializeAutoGridRowHeight(rowHeight),
|
||||
items: layout.state.children.map((child) => {
|
||||
if (!(child instanceof ResponsiveGridItem)) {
|
||||
throw new Error('Expected ResponsiveGridItem');
|
||||
if (!(child instanceof AutoGridItem)) {
|
||||
throw new Error('Expected AutoGridItem');
|
||||
}
|
||||
// For serialization we should retrieve the original element key
|
||||
const elementKey = dashboardSceneGraph.getElementIdentifierForVizPanel(child.state?.body);
|
||||
|
||||
const layoutItem: ResponsiveGridLayoutItemKind = {
|
||||
kind: 'ResponsiveGridLayoutItem',
|
||||
const layoutItem: AutoGridLayoutItemKind = {
|
||||
kind: 'AutoGridLayoutItem',
|
||||
spec: {
|
||||
element: {
|
||||
kind: 'ElementReference',
|
||||
@@ -70,11 +70,11 @@ export class ResponsiveGridLayoutSerializer implements LayoutManagerSerializer {
|
||||
}
|
||||
|
||||
deserialize(layout: DashboardV2Spec['layout'], elements: DashboardV2Spec['elements']): DashboardLayoutManager {
|
||||
if (layout.kind !== 'ResponsiveGridLayout') {
|
||||
if (layout.kind !== 'AutoGridLayout') {
|
||||
throw new Error('Invalid layout kind');
|
||||
}
|
||||
|
||||
const defaults = defaultResponsiveGridLayoutSpec();
|
||||
const defaults = defaultAutoGridLayoutSpec();
|
||||
const { maxColumnCount, columnWidthMode, columnWidth, rowHeightMode, rowHeight, fillScreen } = layout.spec;
|
||||
|
||||
const children = layout.spec.items.map((item) => {
|
||||
@@ -82,7 +82,7 @@ export class ResponsiveGridLayoutSerializer implements LayoutManagerSerializer {
|
||||
if (!panel) {
|
||||
throw new Error(`Panel with uid ${item.spec.element.name} not found in the dashboard elements`);
|
||||
}
|
||||
return new ResponsiveGridItem({
|
||||
return new AutoGridItem({
|
||||
key: getGridItemKeyForPanelId(panel.spec.id),
|
||||
body: panel.kind === 'LibraryPanel' ? buildLibraryPanel(panel) : buildVizPanel(panel),
|
||||
variableName: item.spec.repeat?.value,
|
||||
@@ -93,12 +93,12 @@ export class ResponsiveGridLayoutSerializer implements LayoutManagerSerializer {
|
||||
const columnWidthCombined = columnWidthMode === 'custom' ? columnWidth : columnWidthMode;
|
||||
const rowHeightCombined = rowHeightMode === 'custom' ? rowHeight : rowHeightMode;
|
||||
|
||||
return new ResponsiveGridLayoutManager({
|
||||
return new AutoGridLayoutManager({
|
||||
maxColumnCount,
|
||||
columnWidth: columnWidthCombined,
|
||||
rowHeight: rowHeightCombined,
|
||||
fillScreen: fillScreen ?? defaults.fillScreen,
|
||||
layout: new ResponsiveGridLayout({
|
||||
layout: new AutoGridLayout({
|
||||
templateColumns: getTemplateColumnsTemplate(
|
||||
maxColumnCount ?? defaults.maxColumnCount!,
|
||||
columnWidthCombined ?? AUTO_GRID_DEFAULT_COLUMN_WIDTH
|
||||
|
||||
+9
-9
@@ -2,8 +2,8 @@ import { SceneGridLayout } from '@grafana/scenes';
|
||||
import { DashboardV2Spec } from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0';
|
||||
|
||||
import { DefaultGridLayoutManager } from '../../scene/layout-default/DefaultGridLayoutManager';
|
||||
import { ResponsiveGridLayout } from '../../scene/layout-responsive-grid/ResponsiveGridLayout';
|
||||
import { ResponsiveGridLayoutManager } from '../../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { AutoGridLayout } from '../../scene/layout-responsive-grid/ResponsiveGridLayout';
|
||||
import { AutoGridLayoutManager } from '../../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { RowItem } from '../../scene/layout-rows/RowItem';
|
||||
import { RowItemRepeaterBehavior } from '../../scene/layout-rows/RowItemRepeaterBehavior';
|
||||
import { RowsLayoutManager } from '../../scene/layout-rows/RowsLayoutManager';
|
||||
@@ -71,7 +71,7 @@ describe('deserialization', () => {
|
||||
title: 'Row 1',
|
||||
collapse: false,
|
||||
layout: {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: {
|
||||
columnWidthMode: 'standard',
|
||||
rowHeightMode: 'standard',
|
||||
@@ -87,7 +87,7 @@ describe('deserialization', () => {
|
||||
const serializer = new RowsLayoutSerializer();
|
||||
const deserialized = serializer.deserialize(layout, {}, false);
|
||||
expect(deserialized).toBeInstanceOf(RowsLayoutManager);
|
||||
expect(deserialized.state.rows[0].state.layout).toBeInstanceOf(ResponsiveGridLayoutManager);
|
||||
expect(deserialized.state.rows[0].state.layout).toBeInstanceOf(AutoGridLayoutManager);
|
||||
});
|
||||
|
||||
it('should handle multiple rows with different layouts', () => {
|
||||
@@ -103,7 +103,7 @@ describe('deserialization', () => {
|
||||
hideHeader: undefined,
|
||||
fillScreen: undefined,
|
||||
layout: {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: {
|
||||
columnWidthMode: 'standard',
|
||||
rowHeightMode: 'standard',
|
||||
@@ -130,7 +130,7 @@ describe('deserialization', () => {
|
||||
const deserialized = serializer.deserialize(layout, {}, false);
|
||||
expect(deserialized).toBeInstanceOf(RowsLayoutManager);
|
||||
expect(deserialized.state.rows).toHaveLength(2);
|
||||
expect(deserialized.state.rows[0].state.layout).toBeInstanceOf(ResponsiveGridLayoutManager);
|
||||
expect(deserialized.state.rows[0].state.layout).toBeInstanceOf(AutoGridLayoutManager);
|
||||
expect(deserialized.state.rows[1].state.layout).toBeInstanceOf(DefaultGridLayoutManager);
|
||||
expect(deserialized.state.rows[0].state.collapse).toBe(false);
|
||||
expect(deserialized.state.rows[1].state.collapse).toBe(true);
|
||||
@@ -314,11 +314,11 @@ describe('serialization', () => {
|
||||
collapse: false,
|
||||
hideHeader: undefined,
|
||||
fillScreen: undefined,
|
||||
layout: new ResponsiveGridLayoutManager({
|
||||
layout: new AutoGridLayoutManager({
|
||||
columnWidth: 'standard',
|
||||
rowHeight: 'standard',
|
||||
maxColumnCount: 4,
|
||||
layout: new ResponsiveGridLayout({}),
|
||||
layout: new AutoGridLayout({}),
|
||||
}),
|
||||
}),
|
||||
new RowItem({
|
||||
@@ -350,7 +350,7 @@ describe('serialization', () => {
|
||||
hideHeader: undefined,
|
||||
fillScreen: undefined,
|
||||
layout: {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: {
|
||||
columnWidth: undefined,
|
||||
rowHeight: undefined,
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { DashboardV2Spec } from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0';
|
||||
|
||||
import { DefaultGridLayoutManager } from '../../scene/layout-default/DefaultGridLayoutManager';
|
||||
import { ResponsiveGridLayoutManager } from '../../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { AutoGridLayoutManager } from '../../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { RowsLayoutManager } from '../../scene/layout-rows/RowsLayoutManager';
|
||||
import { TabsLayoutManager } from '../../scene/layout-tabs/TabsLayoutManager';
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('deserialization', () => {
|
||||
spec: {
|
||||
title: 'Tab 1',
|
||||
layout: {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: { columnWidthMode: 'standard', rowHeightMode: 'standard', maxColumnCount: 4, items: [] },
|
||||
},
|
||||
},
|
||||
@@ -42,7 +42,7 @@ describe('deserialization', () => {
|
||||
const serializer = new TabsLayoutSerializer();
|
||||
const deserialized = serializer.deserialize(layout, {}, false);
|
||||
expect(deserialized).toBeInstanceOf(TabsLayoutManager);
|
||||
expect(deserialized.state.tabs[0].state.layout).toBeInstanceOf(ResponsiveGridLayoutManager);
|
||||
expect(deserialized.state.tabs[0].state.layout).toBeInstanceOf(AutoGridLayoutManager);
|
||||
});
|
||||
|
||||
it('should deserialize tabs layout with default grid child', () => {
|
||||
@@ -73,7 +73,7 @@ describe('deserialization', () => {
|
||||
spec: {
|
||||
title: 'Tab 1',
|
||||
layout: {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: { columnWidthMode: 'standard', rowHeightMode: 'standard', maxColumnCount: 4, items: [] },
|
||||
},
|
||||
},
|
||||
@@ -85,7 +85,7 @@ describe('deserialization', () => {
|
||||
const serializer = new TabsLayoutSerializer();
|
||||
const deserialized = serializer.deserialize(layout, {}, false);
|
||||
expect(deserialized).toBeInstanceOf(TabsLayoutManager);
|
||||
expect(deserialized.state.tabs[0].state.layout).toBeInstanceOf(ResponsiveGridLayoutManager);
|
||||
expect(deserialized.state.tabs[0].state.layout).toBeInstanceOf(AutoGridLayoutManager);
|
||||
expect(deserialized.state.tabs[1].state.layout).toBeInstanceOf(DefaultGridLayoutManager);
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import { Registry, RegistryItem } from '@grafana/data';
|
||||
import { LayoutManagerSerializer } from '../../scene/types/DashboardLayoutManager';
|
||||
|
||||
import { DefaultGridLayoutManagerSerializer } from './DefaultGridLayoutSerializer';
|
||||
import { ResponsiveGridLayoutSerializer } from './ResponsiveGridLayoutSerializer';
|
||||
import { AutoGridLayoutSerializer } from './ResponsiveGridLayoutSerializer';
|
||||
import { RowsLayoutSerializer } from './RowsLayoutSerializer';
|
||||
import { TabsLayoutSerializer } from './TabsLayoutSerializer';
|
||||
|
||||
@@ -15,7 +15,7 @@ export const layoutSerializerRegistry: Registry<LayoutSerializerRegistryItem> =
|
||||
new Registry<LayoutSerializerRegistryItem>(() => {
|
||||
return [
|
||||
{ id: 'GridLayout', name: 'Grid Layout', serializer: new DefaultGridLayoutManagerSerializer() },
|
||||
{ id: 'ResponsiveGridLayout', name: 'Responsive Grid Layout', serializer: new ResponsiveGridLayoutSerializer() },
|
||||
{ id: 'AutoGridLayout', name: 'Auto Grid Layout', serializer: new AutoGridLayoutSerializer() },
|
||||
{ id: 'RowsLayout', name: 'Rows Layout', serializer: new RowsLayoutSerializer() },
|
||||
{ id: 'TabsLayout', name: 'Tabs Layout', serializer: new TabsLayoutSerializer() },
|
||||
];
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
import { DataSourceRef } from '@grafana/schema/dist/esm/index.gen';
|
||||
import {
|
||||
DashboardV2Spec,
|
||||
ResponsiveGridLayoutItemKind,
|
||||
AutoGridLayoutItemKind,
|
||||
RowsLayoutRowKind,
|
||||
LibraryPanelKind,
|
||||
PanelKind,
|
||||
@@ -231,10 +231,11 @@ export function getLayout(sceneState: DashboardLayoutManager): DashboardV2Spec['
|
||||
if (!registryItem) {
|
||||
throw new Error(`Layout serializer not found for kind: ${sceneState.descriptor.kind}`);
|
||||
}
|
||||
|
||||
return registryItem.serializer.serialize(sceneState);
|
||||
}
|
||||
|
||||
export function getConditionalRendering(item: RowsLayoutRowKind | ResponsiveGridLayoutItemKind): ConditionalRendering {
|
||||
export function getConditionalRendering(item: RowsLayoutRowKind | AutoGridLayoutItemKind): ConditionalRendering {
|
||||
if (!item.spec.conditionalRendering) {
|
||||
return ConditionalRendering.createEmpty();
|
||||
}
|
||||
|
||||
+17
-17
@@ -35,8 +35,8 @@ import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSou
|
||||
|
||||
import { DashboardDataLayerSet } from '../scene/DashboardDataLayerSet';
|
||||
import { DefaultGridLayoutManager } from '../scene/layout-default/DefaultGridLayoutManager';
|
||||
import { ResponsiveGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { ResponsiveGridLayoutManager } from '../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { AutoGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { AutoGridLayoutManager } from '../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { RowsLayoutManager } from '../scene/layout-rows/RowsLayoutManager';
|
||||
import { TabsLayoutManager } from '../scene/layout-tabs/TabsLayoutManager';
|
||||
import { DashboardLayoutManager } from '../scene/types/DashboardLayoutManager';
|
||||
@@ -503,10 +503,10 @@ describe('transformSaveModelSchemaV2ToScene', () => {
|
||||
});
|
||||
});
|
||||
describe('dynamic dashboard layouts', () => {
|
||||
it('should build a dashboard scene with a responsive grid layout', () => {
|
||||
it('should build a dashboard scene with a auto grid layout', () => {
|
||||
const dashboard = cloneDeep(defaultDashboard);
|
||||
dashboard.spec.layout = {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: {
|
||||
maxColumnCount: 4,
|
||||
columnWidthMode: 'custom',
|
||||
@@ -514,7 +514,7 @@ describe('transformSaveModelSchemaV2ToScene', () => {
|
||||
rowHeightMode: 'standard',
|
||||
items: [
|
||||
{
|
||||
kind: 'ResponsiveGridLayoutItem',
|
||||
kind: 'AutoGridLayoutItem',
|
||||
spec: {
|
||||
element: {
|
||||
kind: 'ElementReference',
|
||||
@@ -526,13 +526,13 @@ describe('transformSaveModelSchemaV2ToScene', () => {
|
||||
},
|
||||
};
|
||||
const scene = transformSaveModelSchemaV2ToScene(dashboard);
|
||||
const layoutManager = scene.state.body as ResponsiveGridLayoutManager;
|
||||
expect(layoutManager.descriptor.kind).toBe('ResponsiveGridLayout');
|
||||
const layoutManager = scene.state.body as AutoGridLayoutManager;
|
||||
expect(layoutManager.descriptor.kind).toBe('AutoGridLayout');
|
||||
expect(layoutManager.state.maxColumnCount).toBe(4);
|
||||
expect(layoutManager.state.columnWidth).toBe(100);
|
||||
expect(layoutManager.state.rowHeight).toBe('standard');
|
||||
expect(layoutManager.state.layout.state.children.length).toBe(1);
|
||||
const gridItem = layoutManager.state.layout.state.children[0] as ResponsiveGridItem;
|
||||
const gridItem = layoutManager.state.layout.state.children[0] as AutoGridItem;
|
||||
expect(gridItem.state.body.state.key).toBe('panel-1');
|
||||
});
|
||||
|
||||
@@ -547,14 +547,14 @@ describe('transformSaveModelSchemaV2ToScene', () => {
|
||||
spec: {
|
||||
title: 'tab1',
|
||||
layout: {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: {
|
||||
maxColumnCount: 4,
|
||||
columnWidthMode: 'standard',
|
||||
rowHeightMode: 'standard',
|
||||
items: [
|
||||
{
|
||||
kind: 'ResponsiveGridLayoutItem',
|
||||
kind: 'AutoGridLayoutItem',
|
||||
spec: {
|
||||
element: {
|
||||
kind: 'ElementReference',
|
||||
@@ -575,12 +575,12 @@ describe('transformSaveModelSchemaV2ToScene', () => {
|
||||
expect(layoutManager.descriptor.kind).toBe('TabsLayout');
|
||||
expect(layoutManager.state.tabs.length).toBe(1);
|
||||
expect(layoutManager.state.tabs[0].state.title).toBe('tab1');
|
||||
const gridLayoutManager = layoutManager.state.tabs[0].state.layout as ResponsiveGridLayoutManager;
|
||||
const gridLayoutManager = layoutManager.state.tabs[0].state.layout as AutoGridLayoutManager;
|
||||
expect(gridLayoutManager.state.maxColumnCount).toBe(4);
|
||||
expect(gridLayoutManager.state.columnWidth).toBe('standard');
|
||||
expect(gridLayoutManager.state.rowHeight).toBe('standard');
|
||||
expect(gridLayoutManager.state.layout.state.children.length).toBe(1);
|
||||
const gridItem = gridLayoutManager.state.layout.state.children[0] as ResponsiveGridItem;
|
||||
const gridItem = gridLayoutManager.state.layout.state.children[0] as AutoGridItem;
|
||||
expect(gridItem.state.body.state.key).toBe('panel-1');
|
||||
});
|
||||
|
||||
@@ -596,14 +596,14 @@ describe('transformSaveModelSchemaV2ToScene', () => {
|
||||
title: 'row1',
|
||||
collapse: false,
|
||||
layout: {
|
||||
kind: 'ResponsiveGridLayout',
|
||||
kind: 'AutoGridLayout',
|
||||
spec: {
|
||||
maxColumnCount: 4,
|
||||
columnWidthMode: 'standard',
|
||||
rowHeightMode: 'standard',
|
||||
items: [
|
||||
{
|
||||
kind: 'ResponsiveGridLayoutItem',
|
||||
kind: 'AutoGridLayoutItem',
|
||||
spec: {
|
||||
element: {
|
||||
kind: 'ElementReference',
|
||||
@@ -650,12 +650,12 @@ describe('transformSaveModelSchemaV2ToScene', () => {
|
||||
const layoutManager = scene.state.body as RowsLayoutManager;
|
||||
expect(layoutManager.descriptor.kind).toBe('RowsLayout');
|
||||
expect(layoutManager.state.rows.length).toBe(2);
|
||||
const row1Manager = layoutManager.state.rows[0].state.layout as ResponsiveGridLayoutManager;
|
||||
expect(row1Manager.descriptor.kind).toBe('ResponsiveGridLayout');
|
||||
const row1Manager = layoutManager.state.rows[0].state.layout as AutoGridLayoutManager;
|
||||
expect(row1Manager.descriptor.kind).toBe('AutoGridLayout');
|
||||
expect(row1Manager.state.maxColumnCount).toBe(4);
|
||||
expect(row1Manager.state.columnWidth).toBe('standard');
|
||||
expect(row1Manager.state.rowHeight).toBe('standard');
|
||||
const row1GridItem = row1Manager.state.layout.state.children[0] as ResponsiveGridItem;
|
||||
const row1GridItem = row1Manager.state.layout.state.children[0] as AutoGridItem;
|
||||
expect(row1GridItem.state.body.state.key).toBe('panel-1');
|
||||
|
||||
const row2Manager = layoutManager.state.rows[1].state.layout as DefaultGridLayoutManager;
|
||||
|
||||
+18
-18
@@ -29,7 +29,7 @@ import {
|
||||
|
||||
import {
|
||||
GridLayoutSpec,
|
||||
ResponsiveGridLayoutSpec,
|
||||
AutoGridLayoutSpec,
|
||||
RowsLayoutSpec,
|
||||
TabsLayoutSpec,
|
||||
} from '../../../../../packages/grafana-schema/src/schema/dashboard/v2alpha0';
|
||||
@@ -42,9 +42,9 @@ import { VizPanelLinks, VizPanelLinksMenu } from '../scene/PanelLinks';
|
||||
import { DashboardGridItem } from '../scene/layout-default/DashboardGridItem';
|
||||
import { DefaultGridLayoutManager } from '../scene/layout-default/DefaultGridLayoutManager';
|
||||
import { RowRepeaterBehavior } from '../scene/layout-default/RowRepeaterBehavior';
|
||||
import { ResponsiveGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { ResponsiveGridLayout } from '../scene/layout-responsive-grid/ResponsiveGridLayout';
|
||||
import { ResponsiveGridLayoutManager } from '../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { AutoGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { AutoGridLayout } from '../scene/layout-responsive-grid/ResponsiveGridLayout';
|
||||
import { AutoGridLayoutManager } from '../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
|
||||
import { RowItem } from '../scene/layout-rows/RowItem';
|
||||
import { RowsLayoutManager } from '../scene/layout-rows/RowsLayoutManager';
|
||||
import { TabItem } from '../scene/layout-tabs/TabItem';
|
||||
@@ -739,10 +739,10 @@ describe('dynamic layouts', () => {
|
||||
new RowsLayoutManager({
|
||||
rows: [
|
||||
new RowItem({
|
||||
layout: new ResponsiveGridLayoutManager({
|
||||
layout: new ResponsiveGridLayout({
|
||||
layout: new AutoGridLayoutManager({
|
||||
layout: new AutoGridLayout({
|
||||
children: [
|
||||
new ResponsiveGridItem({
|
||||
new AutoGridItem({
|
||||
body: new VizPanel({}),
|
||||
}),
|
||||
],
|
||||
@@ -772,29 +772,29 @@ describe('dynamic layouts', () => {
|
||||
const rowsLayout = result.layout.spec as RowsLayoutSpec;
|
||||
expect(rowsLayout.rows.length).toBe(2);
|
||||
expect(rowsLayout.rows[0].kind).toBe('RowsLayoutRow');
|
||||
expect(rowsLayout.rows[0].spec.layout.kind).toBe('ResponsiveGridLayout');
|
||||
const layout1 = rowsLayout.rows[0].spec.layout.spec as ResponsiveGridLayoutSpec;
|
||||
expect(layout1.items[0].kind).toBe('ResponsiveGridLayoutItem');
|
||||
expect(rowsLayout.rows[0].spec.layout.kind).toBe('AutoGridLayout');
|
||||
const layout1 = rowsLayout.rows[0].spec.layout.spec as AutoGridLayoutSpec;
|
||||
expect(layout1.items[0].kind).toBe('AutoGridLayoutItem');
|
||||
|
||||
expect(rowsLayout.rows[1].spec.layout.kind).toBe('GridLayout');
|
||||
const layout2 = rowsLayout.rows[1].spec.layout.spec as GridLayoutSpec;
|
||||
expect(layout2.items[0].kind).toBe('GridLayoutItem');
|
||||
});
|
||||
|
||||
it('should transform scene with responsive grid layout to schema v2', () => {
|
||||
it('should transform scene with auto grid layout to schema v2', () => {
|
||||
const scene = setupDashboardScene(
|
||||
getMinimalSceneState(
|
||||
new ResponsiveGridLayoutManager({
|
||||
new AutoGridLayoutManager({
|
||||
columnWidth: 100,
|
||||
rowHeight: 'standard',
|
||||
maxColumnCount: 4,
|
||||
fillScreen: true,
|
||||
layout: new ResponsiveGridLayout({
|
||||
layout: new AutoGridLayout({
|
||||
children: [
|
||||
new ResponsiveGridItem({
|
||||
new AutoGridItem({
|
||||
body: new VizPanel({}),
|
||||
}),
|
||||
new ResponsiveGridItem({
|
||||
new AutoGridItem({
|
||||
body: new VizPanel({}),
|
||||
}),
|
||||
],
|
||||
@@ -803,8 +803,8 @@ describe('dynamic layouts', () => {
|
||||
)
|
||||
);
|
||||
const result = transformSceneToSaveModelSchemaV2(scene);
|
||||
expect(result.layout.kind).toBe('ResponsiveGridLayout');
|
||||
const respGridLayout = result.layout.spec as ResponsiveGridLayoutSpec;
|
||||
expect(result.layout.kind).toBe('AutoGridLayout');
|
||||
const respGridLayout = result.layout.spec as AutoGridLayoutSpec;
|
||||
expect(respGridLayout.columnWidthMode).toBe('custom');
|
||||
expect(respGridLayout.columnWidth).toBe(100);
|
||||
expect(respGridLayout.rowHeightMode).toBe('standard');
|
||||
@@ -812,7 +812,7 @@ describe('dynamic layouts', () => {
|
||||
expect(respGridLayout.maxColumnCount).toBe(4);
|
||||
expect(respGridLayout.fillScreen).toBe(true);
|
||||
expect(respGridLayout.items.length).toBe(2);
|
||||
expect(respGridLayout.items[0].kind).toBe('ResponsiveGridLayoutItem');
|
||||
expect(respGridLayout.items[0].kind).toBe('AutoGridLayoutItem');
|
||||
});
|
||||
|
||||
it('should transform scene with tabs layout to schema v2', () => {
|
||||
|
||||
@@ -23,7 +23,7 @@ import { VizPanelLinks, VizPanelLinksMenu } from '../scene/PanelLinks';
|
||||
import { panelMenuBehavior } from '../scene/PanelMenuBehavior';
|
||||
import { UNCONFIGURED_PANEL_PLUGIN_ID } from '../scene/UnconfiguredPanel';
|
||||
import { DashboardGridItem } from '../scene/layout-default/DashboardGridItem';
|
||||
import { ResponsiveGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { AutoGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
|
||||
import { RowItem } from '../scene/layout-rows/RowItem';
|
||||
import { setDashboardPanelContext } from '../scene/setDashboardPanelContext';
|
||||
import { DashboardLayoutManager, isDashboardLayoutManager } from '../scene/types/DashboardLayoutManager';
|
||||
@@ -456,7 +456,7 @@ export function useDashboardState(scene: SceneObject): DashboardSceneState {
|
||||
return dashboard.useState();
|
||||
}
|
||||
|
||||
export function useIsConditionallyHidden(scene: RowItem | ResponsiveGridItem): boolean {
|
||||
export function useIsConditionallyHidden(scene: RowItem | AutoGridItem): boolean {
|
||||
const { conditionalRendering } = scene.useState();
|
||||
|
||||
return !(conditionalRendering?.evaluate() ?? true);
|
||||
|
||||
@@ -1310,6 +1310,36 @@
|
||||
"redirect-link": "List in Grafana Alerting",
|
||||
"subtitle": "Alert rules related to this dashboard"
|
||||
},
|
||||
"auto-grid": {
|
||||
"description": "Panels resize to fit and form uniform grids",
|
||||
"item-options": {
|
||||
"repeat": {
|
||||
"title": "Repeat options",
|
||||
"variable": {
|
||||
"description": "Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard.",
|
||||
"title": "Repeat by variable"
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": "Auto grid",
|
||||
"options": {
|
||||
"custom-min-height": {
|
||||
"clear": "Clear"
|
||||
},
|
||||
"custom-min-width": {
|
||||
"clear": "Clear"
|
||||
},
|
||||
"height-fill": "Fill screen",
|
||||
"max-columns": "Max columns",
|
||||
"min-height": "Row height",
|
||||
"min-height-custom": "Custom row height",
|
||||
"min-height-error": "A number between 50 and 2000 is required",
|
||||
"min-width": "Min column width",
|
||||
"min-width-custom": "Custom min width",
|
||||
"min-width-custom-clear": "Back to standard min column width",
|
||||
"min-width-error": "A number between 50 and 2000 is required"
|
||||
}
|
||||
},
|
||||
"conditional-rendering": {
|
||||
"data": {
|
||||
"disable": "Disable",
|
||||
@@ -1543,36 +1573,6 @@
|
||||
"no-rules": "There are no alert rules linked to this panel."
|
||||
}
|
||||
},
|
||||
"responsive-layout": {
|
||||
"description": "Panels resize to fit and form uniform grids",
|
||||
"item-options": {
|
||||
"repeat": {
|
||||
"title": "Repeat options",
|
||||
"variable": {
|
||||
"description": "Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard.",
|
||||
"title": "Repeat by variable"
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": "Auto grid",
|
||||
"options": {
|
||||
"custom-min-height": {
|
||||
"clear": "Clear"
|
||||
},
|
||||
"custom-min-width": {
|
||||
"clear": "Clear"
|
||||
},
|
||||
"height-fill": "Fill screen",
|
||||
"max-columns": "Max columns",
|
||||
"min-height": "Row height",
|
||||
"min-height-custom": "Custom row height",
|
||||
"min-height-error": "A number between 50 and 2000 is required",
|
||||
"min-width": "Min column width",
|
||||
"min-width-custom": "Custom min width",
|
||||
"min-width-custom-clear": "Back to standard min column width",
|
||||
"min-width-error": "A number between 50 and 2000 is required"
|
||||
}
|
||||
},
|
||||
"rows-layout": {
|
||||
"description": "Collapsable panel groups with headings",
|
||||
"header-hidden-tooltip": "Row header only visible in edit mode",
|
||||
|
||||
Reference in New Issue
Block a user