grafana / cog

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

Java: Fix multiple constructors names #457

Closed spinillos closed 5 months ago

spinillos commented 5 months ago

Constructor name and function returns should use the class name.

github-actions[bot] commented 5 months ago

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

### 🔎 Changes to `grafana-foundation-sdk@next+cog-v0.0.x` ```patch diff --git a/go/azuremonitor/azurelogsquery_builder_gen.go b/go/azuremonitor/azurelogsquery_builder_gen.go index 076f120..48a2d9a 100644 --- a/go/azuremonitor/azurelogsquery_builder_gen.go +++ b/go/azuremonitor/azurelogsquery_builder_gen.go @@ -75,6 +75,13 @@ func (builder *AzureLogsQueryBuilder) TimeColumn(timeColumn string) *AzureLogsQu return builder } +// If set to true the query will be run as a basic logs query +func (builder *AzureLogsQueryBuilder) BasicLogsQuery(basicLogsQuery bool) *AzureLogsQueryBuilder { + builder.internal.BasicLogsQuery = &basicLogsQuery + + return builder +} + // Workspace ID. This was removed in Grafana 8, but remains for backwards compat. func (builder *AzureLogsQueryBuilder) Workspace(workspace string) *AzureLogsQueryBuilder { builder.internal.Workspace = &workspace diff --git a/go/azuremonitor/azuremonitorquery_builder_gen.go b/go/azuremonitor/azuremonitorquery_builder_gen.go index 6affba5..5a912ac 100644 --- a/go/azuremonitor/azuremonitorquery_builder_gen.go +++ b/go/azuremonitor/azuremonitorquery_builder_gen.go @@ -152,6 +152,12 @@ func (builder *AzureMonitorQueryBuilder) Resource(resource string) *AzureMonitor return builder } +func (builder *AzureMonitorQueryBuilder) Region(region string) *AzureMonitorQueryBuilder { + builder.internal.Region = ®ion + + return builder +} + // For mixed data sources the selected datasource is on the query level. // For non mixed scenarios this is undefined. // TODO find a better way to do this ^ that's friendly to schema @@ -162,10 +168,9 @@ func (builder *AzureMonitorQueryBuilder) Datasource(datasource any) *AzureMonito return builder } -// Azure Monitor query type. -// queryType: #AzureQueryType -func (builder *AzureMonitorQueryBuilder) Region(region string) *AzureMonitorQueryBuilder { - builder.internal.Region = ®ion +// Used only for exemplar queries from Prometheus +func (builder *AzureMonitorQueryBuilder) Query(query string) *AzureMonitorQueryBuilder { + builder.internal.Query = &query return builder } diff --git a/go/azuremonitor/types_gen.go b/go/azuremonitor/types_gen.go index 0e98f37..d795d9b 100644 --- a/go/azuremonitor/types_gen.go +++ b/go/azuremonitor/types_gen.go @@ -38,14 +38,14 @@ type AzureMonitorQuery struct { ResourceGroup *string `json:"resourceGroup,omitempty"` Namespace *string `json:"namespace,omitempty"` Resource *string `json:"resource,omitempty"` + Region *string `json:"region,omitempty"` // For mixed data sources the selected datasource is on the query level. // For non mixed scenarios this is undefined. // TODO find a better way to do this ^ that's friendly to schema // TODO this shouldn't be unknown but DataSourceRef | null Datasource any `json:"datasource,omitempty"` - // Azure Monitor query type. - // queryType: #AzureQueryType - Region *string `json:"region,omitempty"` + // Used only for exemplar queries from Prometheus + Query *string `json:"query,omitempty"` } func (resource AzureMonitorQuery) ImplementsDataqueryVariant() {} @@ -81,6 +81,7 @@ const ( AzureQueryTypeWorkspacesQuery AzureQueryType = "Azure Workspaces" AzureQueryTypeLocationsQuery AzureQueryType = "Azure Regions" AzureQueryTypeGrafanaTemplateVariableFn AzureQueryType = "Grafana Template Variable Function" + AzureQueryTypeTraceExemplar AzureQueryType = "traceql" ) type AzureMetricQuery struct { @@ -136,6 +137,8 @@ type AzureLogsQuery struct { DashboardTime *bool `json:"dashboardTime,omitempty"` // If dashboardTime is set to true this value dictates which column the time filter will be applied to. Defaults to the first tables timeSpan column, the first datetime column found, or TimeGenerated TimeColumn *string `json:"timeColumn,omitempty"` + // If set to true the query will be run as a basic logs query + BasicLogsQuery *bool `json:"basicLogsQuery,omitempty"` // Workspace ID. This was removed in Grafana 8, but remains for backwards compat. Workspace *string `json:"workspace,omitempty"` // @deprecated Use resources instead diff --git a/go/common/tableautocelloptions_builder_gen.go b/go/common/tableautocelloptions_builder_gen.go new file mode 100644 index 0000000..4177c9f --- /dev/null +++ b/go/common/tableautocelloptions_builder_gen.go @@ -0,0 +1,51 @@ +// Code generated - EDITING IS FUTILE. DO NOT EDIT. + +package common + +import ( + cog "github.com/grafana/grafana-foundation-sdk/go/cog" +) + +var _ cog.Builder[TableAutoCellOptions] = (*TableAutoCellOptionsBuilder)(nil) + +// Auto mode table cell options +type TableAutoCellOptionsBuilder struct { + internal *TableAutoCellOptions + errors map[string]cog.BuildErrors +} + +func NewTableAutoCellOptionsBuilder() *TableAutoCellOptionsBuilder { + resource := &TableAutoCellOptions{} + builder := &TableAutoCellOptionsBuilder{ + internal: resource, + errors: make(map[string]cog.BuildErrors), + } + + builder.applyDefaults() + builder.internal.Type = "auto" + + return builder +} + +func (builder *TableAutoCellOptionsBuilder) Build() (TableAutoCellOptions, error) { + var errs cog.BuildErrors + + for _, err := range builder.errors { + errs = append(errs, cog.MakeBuildErrors("TableAutoCellOptions", err)...) + } + + if len(errs) != 0 { + return TableAutoCellOptions{}, errs + } + + return *builder.internal, nil +} + +func (builder *TableAutoCellOptionsBuilder) WrapText(wrapText bool) *TableAutoCellOptionsBuilder { + builder.internal.WrapText = &wrapText + + return builder +} + +func (builder *TableAutoCellOptionsBuilder) applyDefaults() { +} diff --git a/go/common/tablecoloredbackgroundcelloptions_builder_gen.go b/go/common/tablecoloredbackgroundcelloptions_builder_gen.go index fd519e9..57fe80b 100644 --- a/go/common/tablecoloredbackgroundcelloptions_builder_gen.go +++ b/go/common/tablecoloredbackgroundcelloptions_builder_gen.go @@ -53,5 +53,11 @@ func (builder *TableColoredBackgroundCellOptionsBuilder) ApplyToRow(applyToRow b return builder } +func (builder *TableColoredBackgroundCellOptionsBuilder) WrapText(wrapText bool) *TableColoredBackgroundCellOptionsBuilder { + builder.internal.WrapText = &wrapText + + return builder +} + func (builder *TableColoredBackgroundCellOptionsBuilder) applyDefaults() { } diff --git a/go/common/tablecolortextcelloptions_builder_gen.go b/go/common/tablecolortextcelloptions_builder_gen.go new file mode 100644 index 0000000..22edbc8 --- /dev/null +++ b/go/common/tablecolortextcelloptions_builder_gen.go @@ -0,0 +1,51 @@ +// Code generated - EDITING IS FUTILE. DO NOT EDIT. + +package common + +import ( + cog "github.com/grafana/grafana-foundation-sdk/go/cog" +) + +var _ cog.Builder[TableColorTextCellOptions] = (*TableColorTextCellOptionsBuilder)(nil) + +// Colored text cell options +type TableColorTextCellOptionsBuilder struct { + internal *TableColorTextCellOptions + errors map[string]cog.BuildErrors +} + +func NewTableColorTextCellOptionsBuilder() *TableColorTextCellOptionsBuilder { + resource := &TableColorTextCellOptions{} + builder := &TableColorTextCellOptionsBuilder{ + internal: resource, + errors: make(map[string]cog.BuildErrors), + } + + builder.applyDefaults() + builder.internal.Type = "color-text" + + return builder +} + +func (builder *TableColorTextCellOptionsBuilder) Build() (TableColorTextCellOptions, error) { + var errs cog.BuildErrors + + for _, err := range builder.errors { + errs = append(errs, cog.MakeBuildErrors("TableColorTextCellOptions", err)...) + } + + if len(errs) != 0 { + return TableColorTextCellOptions{}, errs + } + + return *builder.internal, nil +} + +func (builder *TableColorTextCellOptionsBuilder) WrapText(wrapText bool) *TableColorTextCellOptionsBuilder { + builder.internal.WrapText = &wrapText + + return builder +} + +func (builder *TableColorTextCellOptionsBuilder) applyDefaults() { +} diff --git a/go/common/types_gen.go b/go/common/types_gen.go index 6389be0..2a884e4 100644 --- a/go/common/types_gen.go +++ b/go/common/types_gen.go @@ -492,6 +492,15 @@ const ( BigValueTextModeNone BigValueTextMode = "none" ) +// TODO docs +type PercentChangeColorMode string + +const ( + PercentChangeColorModeStandard PercentChangeColorMode = "standard" + PercentChangeColorModeInverted PercentChangeColorMode = "inverted" + PercentChangeColorModeSameAsValue PercentChangeColorMode = "same_as_value" +) + // TODO -- should not be table specific! // TODO docs type FieldTextAlignment string @@ -688,12 +697,14 @@ type TableFooterOptions struct { // Auto mode table cell options type TableAutoCellOptions struct { - Type string `json:"type"` + Type string `json:"type"` + WrapText *bool `json:"wrapText,omitempty"` } // Colored text cell options type TableColorTextCellOptions struct { - Type string `json:"type"` + Type string `json:"type"` + WrapText *bool `json:"wrapText,omitempty"` } // Json view cell options @@ -764,15 +775,17 @@ type TableColoredBackgroundCellOptions struct { Type string `json:"type"` Mode *TableCellBackgroundDisplayMode `json:"mode,omitempty"` ApplyToRow *bool `json:"applyToRow,omitempty"` + WrapText *bool `json:"wrapText,omitempty"` } // Height of a table cell type TableCellHeight string const ( - TableCellHeightSm TableCellHeight = "sm" - TableCellHeightMd TableCellHeight = "md" - TableCellHeightLg TableCellHeight = "lg" + TableCellHeightSm TableCellHeight = "sm" + TableCellHeightMd TableCellHeight = "md" + TableCellHeightLg TableCellHeight = "lg" + TableCellHeightAuto TableCellHeight = "auto" ) // Table cell options. Each cell has a display mode diff --git a/go/heatmap/panel_builder_gen.go b/go/heatmap/panel_builder_gen.go index 9c62343..045788c 100644 --- a/go/heatmap/panel_builder_gen.go +++ b/go/heatmap/panel_builder_gen.go @@ -626,6 +626,16 @@ func (builder *PanelBuilder) ExemplarsColor(color string) *PanelBuilder { return builder } +// Controls which axis to allow selection on +func (builder *PanelBuilder) SelectionMode(selectionMode HeatmapSelectionMode) *PanelBuilder { + if builder.internal.Options == nil { + builder.internal.Options = &Options{} + } + builder.internal.Options.(*Options).SelectionMode = &selectionMode + + return builder +} + func (builder *PanelBuilder) ScaleDistribution(scaleDistribution cog.Builder[common.ScaleDistributionConfig]) *PanelBuilder { if builder.internal.FieldConfig == nil { builder.internal.FieldConfig = &dashboard.FieldConfigSource{} @@ -678,4 +688,5 @@ func (builder *PanelBuilder) applyDefaults() { builder.ShowValue("auto") builder.CellGap(1) builder.ExemplarsColor("rgba(255,0,255,0.7)") + builder.SelectionMode("x") } diff --git a/go/heatmap/types_gen.go b/go/heatmap/types_gen.go index 7938615..583f986 100644 --- a/go/heatmap/types_gen.go +++ b/go/heatmap/types_gen.go @@ -25,6 +25,15 @@ const ( HeatmapColorScaleExponential HeatmapColorScale = "exponential" ) +// Controls which axis to allow selection on +type HeatmapSelectionMode string + +const ( + HeatmapSelectionModeX HeatmapSelectionMode = "x" + HeatmapSelectionModeY HeatmapSelectionMode = "y" + HeatmapSelectionModeXy HeatmapSelectionMode = "xy" +) + // Controls various color options type HeatmapColorOptions struct { // Sets the color mode @@ -152,6 +161,8 @@ type Options struct { Tooltip HeatmapTooltip `json:"tooltip"` // Controls exemplar options Exemplars ExemplarConfig `json:"exemplars"` + // Controls which axis to allow selection on + SelectionMode *HeatmapSelectionMode `json:"selectionMode,omitempty"` } type FieldConfig struct { diff --git a/go/logs/panel_builder_gen.go b/go/logs/panel_builder_gen.go index 0992db9..996aea5 100644 --- a/go/logs/panel_builder_gen.go +++ b/go/logs/panel_builder_gen.go @@ -496,6 +496,52 @@ func (builder *PanelBuilder) DedupStrategy(dedupStrategy common.LogsDedupStrateg return builder } +// TODO: figure out how to define callbacks +func (builder *PanelBuilder) OnClickFilterLabel(onClickFilterLabel any) *PanelBuilder { + if builder.internal.Options == nil { + builder.internal.Options = &Options{} + } + builder.internal.Options.(*Options).OnClickFilterLabel = &onClickFilterLabel + + return builder +} + +func (builder *PanelBuilder) OnClickFilterOutLabel(onClickFilterOutLabel any) *PanelBuilder { + if builder.internal.Options == nil { + builder.internal.Options = &Options{} + } + builder.internal.Options.(*Options).OnClickFilterOutLabel = &onClickFilterOutLabel + + return builder +} + +func (builder *PanelBuilder) IsFilterLabelActive(isFilterLabelActive any) *PanelBuilder { + if builder.internal.Options == nil { + builder.internal.Options = &Options{} + } + builder.internal.Options.(*Options).IsFilterLabelActive = &isFilterLabelActive + + return builder +} + +func (builder *PanelBuilder) OnClickFilterString(onClickFilterString any) *PanelBuilder { + if builder.internal.Options == nil { + builder.internal.Options = &Options{} + } + builder.internal.Options.(*Options).OnClickFilterString = &onClickFilterString + + return builder +} + +func (builder *PanelBuilder) OnClickFilterOutString(onClickFilterOutString any) *PanelBuilder { + if builder.internal.Options == nil { + builder.internal.Options = &Options{} + } + builder.internal.Options.(*Options).OnClickFilterOutString = &onClickFilterOutString + + return builder +} + func (builder *PanelBuilder) applyDefaults() { builder.Transparent(false) builder.Height(9) diff --git a/go/logs/types_gen.go b/go/logs/types_gen.go index ff9d3d3..d56ac58 100644 --- a/go/logs/types_gen.go +++ b/go/logs/types_gen.go @@ -19,6 +19,12 @@ type Options struct { EnableLogDetails bool `json:"enableLogDetails"` SortOrder common.LogsSortOrder `json:"sortOrder"` DedupStrategy common.LogsDedupStrategy `json:"dedupStrategy"` + // TODO: figure out how to define callbacks + OnClickFilterLabel any `json:"onClickFilterLabel,omitempty"` + OnClickFilterOutLabel any `json:"onClickFilterOutLabel,omitempty"` + IsFilterLabelActive any `json:"isFilterLabelActive,omitempty"` + OnClickFilterString any `json:"onClickFilterString,omitempty"` + OnClickFilterOutString any `json:"onClickFilterOutString,omitempty"` } func VariantConfig() cogvariants.PanelcfgConfig { diff --git a/go/stat/panel_builder_gen.go b/go/stat/panel_builder_gen.go index f3223dd..eaf3847 100644 --- a/go/stat/panel_builder_gen.go +++ b/go/stat/panel_builder_gen.go @@ -460,6 +460,15 @@ func (builder *PanelBuilder) WideLayout(wideLayout bool) *PanelBuilder { return builder } +func (builder *PanelBuilder) ShowPercentChange(showPercentChange bool) *PanelBuilder { + if builder.internal.Options == nil { + builder.internal.Options = &Options{} + } + builder.internal.Options.(*Options).ShowPercentChange = showPercentChange + + return builder +} + func (builder *PanelBuilder) ReduceOptions(reduceOptions cog.Builder[common.ReduceDataOptions]) *PanelBuilder { if builder.internal.Options == nil { builder.internal.Options = &Options{} @@ -488,11 +497,11 @@ func (builder *PanelBuilder) Text(text cog.Builder[common.VizTextDisplayOptions] return builder } -func (builder *PanelBuilder) ShowPercentChange(showPercentChange bool) *PanelBuilder { +func (builder *PanelBuilder) PercentChangeColorMode(percentChangeColorMode common.PercentChangeColorMode) *PanelBuilder { if builder.internal.Options == nil { builder.internal.Options = &Options{} } - builder.internal.Options.(*Options).ShowPercentChange = showPercentChange + builder.internal.Options.(*Options).PercentChangeColorMode = percentChangeColorMode return builder } @@ -516,4 +525,5 @@ func (builder *PanelBuilder) applyDefaults() { builder.TextMode("auto") builder.WideLayout(true) builder.ShowPercentChange(false) + builder.PercentChangeColorMode("standard") } diff --git a/go/stat/types_gen.go b/go/stat/types_gen.go index dacf902..5f75c28 100644 --- a/go/stat/types_gen.go +++ b/go/stat/types_gen.go @@ -10,15 +10,16 @@ import ( ) type Options struct { - GraphMode common.BigValueGraphMode `json:"graphMode"` - ColorMode common.BigValueColorMode `json:"colorMode"` - JustifyMode common.BigValueJustifyMode `json:"justifyMode"` - TextMode common.BigValueTextMode `json:"textMode"` - WideLayout bool `json:"wideLayout"` - ReduceOptions common.ReduceDataOptions `json:"reduceOptions"` - Text *common.VizTextDisplayOptions `json:"text,omitempty"` - ShowPercentChange bool `json:"showPercentChange"` - Orientation common.VizOrientation `json:"orientation"` + GraphMode common.BigValueGraphMode `json:"graphMode"` + ColorMode common.BigValueColorMode `json:"colorMode"` + JustifyMode common.BigValueJustifyMode `json:"justifyMode"` + TextMode common.BigValueTextMode `json:"textMode"` + WideLayout bool `json:"wideLayout"` + ShowPercentChange bool `json:"showPercentChange"` + ReduceOptions common.ReduceDataOptions `json:"reduceOptions"` + Text *common.VizTextDisplayOptions `json:"text,omitempty"` + PercentChangeColorMode common.PercentChangeColorMode `json:"percentChangeColorMode"` + Orientation common.VizOrientation `json:"orientation"` } func VariantConfig() cogvariants.PanelcfgConfig { diff --git a/jsonschema/azuremonitor.jsonschema.json b/jsonschema/azuremonitor.jsonschema.json index d2d343e..983c6d1 100644 --- a/jsonschema/azuremonitor.jsonschema.json +++ b/jsonschema/azuremonitor.jsonschema.json @@ -61,14 +61,17 @@ "resource": { "type": "string" }, + "region": { + "type": "string" + }, "datasource": { "type": "object", "additionalProperties": {}, "description": "For mixed data sources the selected datasource is on the query level.\nFor non mixed scenarios this is undefined.\nTODO find a better way to do this ^ that's friendly to schema\nTODO this shouldn't be unknown but DataSourceRef | null" }, - "region": { + "query": { "type": "string", - "description": "Azure Monitor query type.\nqueryType: #AzureQueryType" + "description": "Used only for exemplar queries from Prometheus" } } }, @@ -85,7 +88,8 @@ "Azure Metric Names", "Azure Workspaces", "Azure Regions", - "Grafana Template Variable Function" + "Grafana Template Variable Function", + "traceql" ], "description": "Defines the supported queryTypes. GrafanaTemplateVariableFn is deprecated" }, @@ -203,6 +207,10 @@ "type": "string", "description": "If dashboardTime is set to true this value dictates which column the time filter will be applied to. Defaults to the first tables timeSpan column, the first datetime column found, or TimeGenerated" }, + "basicLogsQuery": { + "type": "boolean", + "description": "If set to true the query will be run as a basic logs query" + }, "workspace": { "type": "string", "description": "Workspace ID. This was removed in Grafana 8, but remains for backwards compat." diff --git a/jsonschema/common.jsonschema.json b/jsonschema/common.jsonschema.json index bd71a75..ec9b99e 100644 --- a/jsonschema/common.jsonschema.json +++ b/jsonschema/common.jsonschema.json @@ -757,6 +757,14 @@ ], "description": "TODO docs" }, + "PercentChangeColorMode": { + "enum": [ + "standard", + "inverted", + "same_as_value" + ], + "description": "TODO docs" + }, "FieldTextAlignment": { "enum": [ "auto", @@ -1115,6 +1123,9 @@ "type": { "type": "string", "const": "auto" + }, + "wrapText": { + "type": "boolean" } }, "description": "Auto mode table cell options" @@ -1129,6 +1140,9 @@ "type": { "type": "string", "const": "color-text" + }, + "wrapText": { + "type": "boolean" } }, "description": "Colored text cell options" @@ -1339,6 +1353,9 @@ }, "applyToRow": { "type": "boolean" + }, + "wrapText": { + "type": "boolean" } }, "description": "Colored background cell options" @@ -1347,7 +1364,8 @@ "enum": [ "sm", "md", - "lg" + "lg", + "auto" ], "description": "Height of a table cell" }, diff --git a/jsonschema/dashboard.jsonschema.json b/jsonschema/dashboard.jsonschema.json index 35d128c..e220ac1 100644 --- a/jsonschema/dashboard.jsonschema.json +++ b/jsonschema/dashboard.jsonschema.json @@ -101,7 +101,7 @@ "schemaVersion": { "type": "integer", "description": "Version of the JSON schema, incremented each time a Grafana update brings\nchanges to said schema.", - "default": 36 + "default": 39 }, "version": { "type": "integer", diff --git a/jsonschema/heatmap.jsonschema.json b/jsonschema/heatmap.jsonschema.json index a0e8d5e..ee7a168 100644 --- a/jsonschema/heatmap.jsonschema.json +++ b/jsonschema/heatmap.jsonschema.json @@ -15,6 +15,14 @@ ], "description": "Controls the color scale of the heatmap" }, + "HeatmapSelectionMode": { + "enum": [ + "x", + "y", + "xy" + ], + "description": "Controls which axis to allow selection on" + }, "HeatmapColorOptions": { "type": "object", "additionalProperties": false, @@ -308,6 +316,11 @@ "default": { "color": "rgba(255,0,255,0.7)" } + }, + "selectionMode": { + "$ref": "#/definitions/HeatmapSelectionMode", + "description": "Controls which axis to allow selection on", + "default": "x" } } }, diff --git a/jsonschema/logs.jsonschema.json b/jsonschema/logs.jsonschema.json index b711c79..bcf9764 100644 --- a/jsonschema/logs.jsonschema.json +++ b/jsonschema/logs.jsonschema.json @@ -42,6 +42,27 @@ }, "dedupStrategy": { "$ref": "#/definitions/LogsDedupStrategy" + }, + "onClickFilterLabel": { + "type": "object", + "additionalProperties": {}, + "description": "TODO: figure out how to define callbacks" + }, + "onClickFilterOutLabel": { + "type": "object", + "additionalProperties": {} + }, + "isFilterLabelActive": { + "type": "object", + "additionalProperties": {} + }, + "onClickFilterString": { + "type": "object", + "additionalProperties": {} + }, + "onClickFilterOutString": { + "type": "object", + "additionalProperties": {} } } }, diff --git a/jsonschema/stat.jsonschema.json b/jsonschema/stat.jsonschema.json index 0fa8b86..eca0e1c 100644 --- a/jsonschema/stat.jsonschema.json +++ b/jsonschema/stat.jsonschema.json @@ -10,8 +10,9 @@ "justifyMode", "textMode", "wideLayout", - "reduceOptions", "showPercentChange", + "reduceOptions", + "percentChangeColorMode", "orientation" ], "properties": { @@ -35,15 +36,19 @@ "type": "boolean", "default": true }, + "showPercentChange": { + "type": "boolean", + "default": false + }, "reduceOptions": { "$ref": "#/definitions/ReduceDataOptions" }, "text": { "$ref": "#/definitions/VizTextDisplayOptions" }, - "showPercentChange": { - "type": "boolean", - "default": false + "percentChangeColorMode": { + "$ref": "#/definitions/PercentChangeColorMode", + "default": "standard" }, "orientation": { "$ref": "#/definitions/VizOrientation" @@ -128,6 +133,14 @@ }, "description": "TODO docs" }, + "PercentChangeColorMode": { + "enum": [ + "standard", + "inverted", + "same_as_value" + ], + "description": "TODO docs" + }, "VizOrientation": { "enum": [ "auto", diff --git a/jsonschema/table.jsonschema.json b/jsonschema/table.jsonschema.json index 09387da..4ac0b57 100644 --- a/jsonschema/table.jsonschema.json +++ b/jsonschema/table.jsonschema.json @@ -105,7 +105,8 @@ "enum": [ "sm", "md", - "lg" + "lg", + "auto" ], "description": "Height of a table cell" }, @@ -218,6 +219,9 @@ "type": { "type": "string", "const": "auto" + }, + "wrapText": { + "type": "boolean" } }, "description": "Auto mode table cell options" @@ -386,6 +390,9 @@ }, "applyToRow": { "type": "boolean" + }, + "wrapText": { + "type": "boolean" } }, "description": "Colored background cell options" @@ -400,6 +407,9 @@ "type": { "type": "string", "const": "color-text" + }, + "wrapText": { + "type": "boolean" } }, "description": "Colored text cell options" diff --git a/openapi/azuremonitor.openapi.json b/openapi/azuremonitor.openapi.json index 89bfca5..571ef1a 100644 --- a/openapi/azuremonitor.openapi.json +++ b/openapi/azuremonitor.openapi.json @@ -70,14 +70,17 @@ "resource": { "type": "string" }, + "region": { + "type": "string" + }, "datasource": { "type": "object", "additionalProperties": {}, "description": "For mixed data sources the selected datasource is on the query level.\nFor non mixed scenarios this is undefined.\nTODO find a better way to do this ^ that's friendly to schema\nTODO this shouldn't be unknown but DataSourceRef | null" }, - "region": { + "query": { "type": "string", - "description": "Azure Monitor query type.\nqueryType: #AzureQueryType" + "description": "Used only for exemplar queries from Prometheus" } } }, @@ -94,7 +97,8 @@ "Azure Metric Names", "Azure Workspaces", "Azure Regions", - "Grafana Template Variable Function" + "Grafana Template Variable Function", + "traceql" ], "description": "Defines the supported queryTypes. GrafanaTemplateVariableFn is deprecated" }, @@ -212,6 +216,10 @@ "type": "string", "description": "If dashboardTime is set to true this value dictates which column the time filter will be applied to. Defaults to the first tables timeSpan column, the first datetime column found, or TimeGenerated" }, + "basicLogsQuery": { + "type": "boolean", + "description": "If set to true the query will be run as a basic logs query" + }, "workspace": { "type": "string", "description": "Workspace ID. This was removed in Grafana 8, but remains for backwards compat." diff --git a/openapi/common.openapi.json b/openapi/common.openapi.json index e8bea4a..914e6b8 100644 --- a/openapi/common.openapi.json +++ b/openapi/common.openapi.json @@ -765,6 +765,14 @@ ], "description": "TODO docs" }, + "PercentChangeColorMode": { + "enum": [ + "standard", + "inverted", + "same_as_value" + ], + "description": "TODO docs" + }, "FieldTextAlignment": { "enum": [ "auto", @@ -1123,6 +1131,9 @@ "type": { "type": "string", "const": "auto" + }, + "wrapText": { + "type": "boolean" } }, "description": "Auto mode table cell options" @@ -1137,6 +1148,9 @@ "type": { "type": "string", "const": "color-text" + }, + "wrapText": { + "type": "boolean" } }, "description": "Colored text cell options" @@ -1347,6 +1361,9 @@ }, "applyToRow": { "type": "boolean" + }, + "wrapText": { + "type": "boolean" } }, "description": "Colored background cell options" @@ -1355,7 +1372,8 @@ "enum": [ "sm", "md", - "lg" + "lg", + "auto" ], "description": "Height of a table cell" }, diff --git a/openapi/dashboard.openapi.json b/openapi/dashboard.openapi.json index bcc296c..3a9a83f 100644 --- a/openapi/dashboard.openapi.json +++ b/openapi/dashboard.openapi.json @@ -108,7 +108,7 @@ "schemaVersion": { "type": "integer", "description": "Version of the JSON schema, incremented each time a Grafana update brings\nchanges to said schema.", - "default": 36 + "default": 39 }, "version": { "type": "integer", diff --git a/openapi/heatmap.openapi.json b/openapi/heatmap.openapi.json index 80cb0b9..b6d4cb4 100644 --- a/openapi/heatmap.openapi.json +++ b/openapi/heatmap.openapi.json @@ -24,6 +24,14 @@ ], "description": "Controls the color scale of the heatmap" }, + "HeatmapSelectionMode": { + "enum": [ + "x", + "y", + "xy" + ], + "description": "Controls which axis to allow selection on" + }, "HeatmapColorOptions": { "type": "object", "additionalProperties": false, @@ -317,6 +325,11 @@ "default": { "color": "rgba(255,0,255,0.7)" } + }, + "selectionMode": { + "$ref": "#/components/schemas/HeatmapSelectionMode", + "description": "Controls which axis to allow selection on", + "default": "x" } } }, diff --git a/openapi/logs.openapi.json b/openapi/logs.openapi.json index b729f0d..bc26d8e 100644 --- a/openapi/logs.openapi.json +++ b/openapi/logs.openapi.json @@ -51,6 +51,27 @@ }, "dedupStrategy": { "$ref": "#/components/schemas/LogsDedupStrategy" + }, + "onClickFilterLabel": { + "type": "object", + "additionalProperties": {}, + "description": "TODO: figure out how to define callbacks" + }, + "onClickFilterOutLabel": { + "type": "object", + "additionalProperties": {} + }, + "isFilterLabelActive": { + "type": "object", + "additionalProperties": {} + }, + "onClickFilterString": { + "type": "object", + "additionalProperties": {} + }, + "onClickFilterOutString": { + "type": "object", + "additionalProperties": {} } } }, diff --git a/openapi/stat.openapi.json b/openapi/stat.openapi.json index 46ade6a..11291c3 100644 --- a/openapi/stat.openapi.json +++ b/openapi/stat.openapi.json @@ -19,8 +19,9 @@ "justifyMode", "textMode", "wideLayout", - "reduceOptions", "showPercentChange", + "reduceOptions", + "percentChangeColorMode", "orientation" ], "properties": { @@ -44,15 +45,19 @@ "type": "boolean", "default": true }, + "showPercentChange": { + "type": "boolean", + "default": false + }, "reduceOptions": { "$ref": "#/components/schemas/ReduceDataOptions" }, "text": { "$ref": "#/components/schemas/VizTextDisplayOptions" }, - "showPercentChange": { - "type": "boolean", - "default": false + "percentChangeColorMode": { + "$ref": "#/components/schemas/PercentChangeColorMode", + "default": "standard" }, "orientation": { "$ref": "#/components/schemas/VizOrientation" @@ -137,6 +142,14 @@ }, "description": "TODO docs" }, + "PercentChangeColorMode": { + "enum": [ + "standard", + "inverted", + "same_as_value" + ], + "description": "TODO docs" + }, "VizOrientation": { "enum": [ "auto", diff --git a/openapi/table.openapi.json b/openapi/table.openapi.json index 930cc90..d42ed0e 100644 --- a/openapi/table.openapi.json +++ b/openapi/table.openapi.json @@ -114,7 +114,8 @@ "enum": [ "sm", "md", - "lg" + "lg", + "auto" ], "description": "Height of a table cell" }, @@ -227,6 +228,9 @@ "type": { "type": "string", "const": "auto" + }, + "wrapText": { + "type": "boolean" } }, "description": "Auto mode table cell options" @@ -395,6 +399,9 @@ }, "applyToRow": { "type": "boolean" + }, + "wrapText": { + "type": "boolean" } }, "description": "Colored background cell options" @@ -409,6 +416,9 @@ "type": { "type": "string", "const": "color-text" + }, + "wrapText": { + "type": "boolean" } }, "description": "Colored text cell options" diff --git a/python/grafana_foundation_sdk/builders/azuremonitor.py b/python/grafana_foundation_sdk/builders/azuremonitor.py index ba68ef2..a9e2529 100644 --- a/python/grafana_foundation_sdk/builders/azuremonitor.py +++ b/python/grafana_foundation_sdk/builders/azuremonitor.py @@ -130,6 +130,11 @@ class AzureMonitorQuery(cogbuilder.Builder[azuremonitor.AzureMonitorQuery]): return self + def region(self, region: str) -> typing.Self: + self._internal.region = region + + return self + def datasource(self, datasource: object) -> typing.Self: """ For mixed data sources the selected datasource is on the query level. @@ -142,13 +147,12 @@ class AzureMonitorQuery(cogbuilder.Builder[azuremonitor.AzureMonitorQuery]): return self - def region(self, region: str) -> typing.Self: + def query(self, query: str) -> typing.Self: """ - Azure Monitor query type. - queryType: #AzureQueryType + Used only for exemplar queries from Prometheus """ - self._internal.region = region + self._internal.query = query return self @@ -387,6 +391,15 @@ class AzureLogsQuery(cogbuilder.Builder[azuremonitor.AzureLogsQuery]): return self + def basic_logs_query(self, basic_logs_query: bool) -> typing.Self: + """ + If set to true the query will be run as a basic logs query + """ + + self._internal.basic_logs_query = basic_logs_query + + return self + def workspace(self, workspace: str) -> typing.Self: """ Workspace ID. This was removed in Grafana 8, but remains for backwards compat. diff --git a/python/grafana_foundation_sdk/builders/common.py b/python/grafana_foundation_sdk/builders/common.py index 2c145b1..ad060e0 100644 --- a/python/grafana_foundation_sdk/builders/common.py +++ b/python/grafana_foundation_sdk/builders/common.py @@ -1283,6 +1283,46 @@ class TableFooterOptions(cogbuilder.Builder[common.TableFooterOptions]): return self +class TableAutoCellOptions(cogbuilder.Builder[common.TableAutoCellOptions]): + """ + Auto mode table cell options + """ + + _internal: common.TableAutoCellOptions + + def __init__(self): + self._internal = common.TableAutoCellOptions() + self._internal.type_val = "auto" + + def build(self) -> common.TableAutoCellOptions: + return self._internal + + def wrap_text(self, wrap_text: bool) -> typing.Self: + self._internal.wrap_text = wrap_text + + return self + + +class TableColorTextCellOptions(cogbuilder.Builder[common.TableColorTextCellOptions]): + """ + Colored text cell options + """ + + _internal: common.TableColorTextCellOptions + + def __init__(self): + self._internal = common.TableColorTextCellOptions() + self._internal.type_val = "color-text" + + def build(self) -> common.TableColorTextCellOptions: + return self._internal + + def wrap_text(self, wrap_text: bool) -> typing.Self: + self._internal.wrap_text = wrap_text + + return self + + class TableBarGaugeCellOptions(cogbuilder.Builder[common.TableBarGaugeCellOptions]): """ Gauge cell options @@ -1523,6 +1563,11 @@ class TableColoredBackgroundCellOptions(cogbuilder.Builder[common.TableColoredBa return self + def wrap_text(self, wrap_text: bool) -> typing.Self: + self._internal.wrap_text = wrap_text + + return self + class DataSourceRef(cogbuilder.Builder[common.DataSourceRef]): _internal: common.DataSourceRef diff --git a/python/grafana_foundation_sdk/builders/heatmap.py b/python/grafana_foundation_sdk/builders/heatmap.py index fc6d8af..9546e30 100644 --- a/python/grafana_foundation_sdk/builders/heatmap.py +++ b/python/grafana_foundation_sdk/builders/heatmap.py @@ -717,6 +717,18 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def selection_mode(self, selection_mode: heatmap.HeatmapSelectionMode) -> typing.Self: + """ + Controls which axis to allow selection on + """ + + if self._internal.options is None: + self._internal.options = heatmap.Options() + assert isinstance(self._internal.options, heatmap.Options) + self._internal.options.selection_mode = selection_mode + + return self + def scale_distribution(self, scale_distribution: cogbuilder.Builder[common.ScaleDistributionConfig]) -> typing.Self: if self._internal.field_config is None: self._internal.field_config = dashboard.FieldConfigSource() diff --git a/python/grafana_foundation_sdk/builders/logs.py b/python/grafana_foundation_sdk/builders/logs.py index 5bed101..6192da7 100644 --- a/python/grafana_foundation_sdk/builders/logs.py +++ b/python/grafana_foundation_sdk/builders/logs.py @@ -529,4 +529,48 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): self._internal.options.dedup_strategy = dedup_strategy return self + + def on_click_filter_label(self, on_click_filter_label: object) -> typing.Self: + """ + TODO: figure out how to define callbacks + """ + + if self._internal.options is None: + self._internal.options = logs.Options() + assert isinstance(self._internal.options, logs.Options) + self._internal.options.on_click_filter_label = on_click_filter_label + + return self + + def on_click_filter_out_label(self, on_click_filter_out_label: object) -> typing.Self: + if self._internal.options is None: + self._internal.options = logs.Options() + assert isinstance(self._internal.options, logs.Options) + self._internal.options.on_click_filter_out_label = on_click_filter_out_label + + return self + + def is_filter_label_active(self, is_filter_label_active: object) -> typing.Self: + if self._internal.options is None: + self._internal.options = logs.Options() + assert isinstance(self._internal.options, logs.Options) + self._internal.options.is_filter_label_active = is_filter_label_active + + return self + + def on_click_filter_string(self, on_click_filter_string: object) -> typing.Self: + if self._internal.options is None: + self._internal.options = logs.Options() + assert isinstance(self._internal.options, logs.Options) + self._internal.options.on_click_filter_string = on_click_filter_string + + return self + + def on_click_filter_out_string(self, on_click_filter_out_string: object) -> typing.Self: + if self._internal.options is None: + self._internal.options = logs.Options() + assert isinstance(self._internal.options, logs.Options) + self._internal.options.on_click_filter_out_string = on_click_filter_out_string + + return self \ No newline at end of file diff --git a/python/grafana_foundation_sdk/builders/stat.py b/python/grafana_foundation_sdk/builders/stat.py index cf3b22b..cfac2fb 100644 --- a/python/grafana_foundation_sdk/builders/stat.py +++ b/python/grafana_foundation_sdk/builders/stat.py @@ -498,6 +498,14 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self + def show_percent_change(self, show_percent_change: bool) -> typing.Self: + if self._internal.options is None: + self._internal.options = stat.Options() + assert isinstance(self._internal.options, stat.Options) + self._internal.options.show_percent_change = show_percent_change + + return self + def reduce_options(self, reduce_options: cogbuilder.Builder[common.ReduceDataOptions]) -> typing.Self: if self._internal.options is None: self._internal.options = stat.Options() @@ -516,11 +524,11 @@ class Panel(cogbuilder.Builder[dashboard.Panel]): return self - def show_percent_change(self, show_percent_change: bool) -> typing.Self: + def percent_change_color_mode(self, percent_change_color_mode: common.PercentChangeColorMode) -> typing.Self: if self._internal.options is None: self._internal.options = stat.Options() assert isinstance(self._internal.options, stat.Options) - self._internal.options.show_percent_change = show_percent_change + self._internal.options.percent_change_color_mode = percent_change_color_mode return self diff --git a/python/grafana_foundation_sdk/cog/plugins.py b/python/grafana_foundation_sdk/cog/plugins.py index 09e1e42..657d42d 100644 --- a/python/grafana_foundation_sdk/cog/plugins.py +++ b/python/grafana_foundation_sdk/cog/plugins.py @@ -1,39 +1,39 @@ # Code generated - EDITING IS FUTILE. DO NOT EDIT. -from ..models import parca -from ..models import expr -from ..models import azuremonitor -from ..models import canvas -from ..models import debug -from ..models import grafanapyroscope from ..models import nodegraph -from ..models import barchart -from ..models import googlecloudmonitoring -from ..models import news from ..models import piechart -from ..models import datagrid +from ..models import table +from ..models import canvas +from ..models import azuremonitor +from ..models import bargauge from ..models import elasticsearch -from ..models import statushistory -from ..models import text from ..models import annotationslist +from ..models import logs +from ..models import loki +from ..models import candlestick +from ..models import datagrid +from ..models import googlecloudmonitoring +from ..models import news from ..models import stat -from ..models import statetimeline from ..models import trend -from ..models import bargauge -from ..models import candlestick -from ..models import gauge -from ..models import geomap -from ..models import timeseries from ..models import xychart -from ..models import cloudwatch +from ..models import debug +from ..models import statushistory +from ..models import timeseries +from ..models import gauge +from ..models import grafanapyroscope from ..models import heatmap from ..models import histogram -from ..models import prometheus -from ..models import table +from ..models import parca +from ..models import statetimeline from ..models import tempo -from ..models import loki from ..models import dashboardlist -from ..models import logs +from ..models import prometheus +from ..models import expr +from ..models import barchart +from ..models import cloudwatch +from ..models import geomap +from ..models import text from . import runtime as cogruntime diff --git a/python/grafana_foundation_sdk/models/azuremonitor.py b/python/grafana_foundation_sdk/models/azuremonitor.py index 0769860..caec76d 100644 --- a/python/grafana_foundation_sdk/models/azuremonitor.py +++ b/python/grafana_foundation_sdk/models/azuremonitor.py @@ -34,16 +34,16 @@ class AzureMonitorQuery(cogvariants.Dataquery): resource_group: typing.Optional[str] namespace: typing.Optional[str] resource: typing.Optional[str] + region: typing.Optional[str] # For mixed data sources the selected datasource is on the query level. # For non mixed scenarios this is undefined. # TODO find a better way to do this ^ that's friendly to schema # TODO this shouldn't be unknown but DataSourceRef | null datasource: typing.Optional[object] - # Azure Monitor query type. - # queryType: #AzureQueryType - region: typing.Optional[str] + # Used only for exemplar queries from Prometheus + query: typing.Optional[str] - def __init__(self, ref_id: str = "", hide: typing.Optional[bool] = None, query_type: typing.Optional[str] = None, subscription: typing.Optional[str] = None, subscriptions: typing.Optional[list[str]] = None, azure_monitor: typing.Optional['AzureMetricQuery'] = None, azure_log_analytics: typing.Optional['AzureLogsQuery'] = None, azure_resource_graph: typing.Optional['AzureResourceGraphQuery'] = None, azure_traces: typing.Optional['AzureTracesQuery'] = None, grafana_template_variable_fn: typing.Optional['GrafanaTemplateVariableQuery'] = None, resource_group: typing.Optional[str] = None, namespace: typing.Optional[str] = None, resource: typing.Optional[str] = None, datasource: typing.Optional[object] = None, region: typing.Optional[str] = None): + def __init__(self, ref_id: str = "", hide: typing.Optional[bool] = None, query_type: typing.Optional[str] = None, subscription: typing.Optional[str] = None, subscriptions: typing.Optional[list[str]] = None, azure_monitor: typing.Optional['AzureMetricQuery'] = None, azure_log_analytics: typing.Optional['AzureLogsQuery'] = None, azure_resource_graph: typing.Optional['AzureResourceGraphQuery'] = None, azure_traces: typing.Optional['AzureTracesQuery'] = None, grafana_template_variable_fn: typing.Optional['GrafanaTemplateVariableQuery'] = None, resource_group: typing.Optional[str] = None, namespace: typing.Optional[str] = None, resource: typing.Optional[str] = None, region: typing.Optional[str] = None, datasource: typing.Optional[object] = None, query: typing.Optional[str] = None): self.ref_id = ref_id self.hide = hide self.query_type = query_type @@ -57,8 +57,9 @@ class AzureMonitorQuery(cogvariants.Dataquery): self.resource_group = resource_group self.namespace = namespace self.resource = resource - self.datasource = datasource self.region = region + self.datasource = datasource + self.query = query def to_json(self) -> dict[str, object]: payload: dict[str, object] = { @@ -88,10 +89,12 @@ class AzureMonitorQuery(cogvariants.Dataquery): payload["namespace"] = self.namespace if self.resource is not None: payload["resource"] = self.resource - if self.datasource is not None: - payload["datasource"] = self.datasource if self.region is not None: payload["region"] = self.region + if self.datasource is not None: + payload["datasource"] = self.datasource + if self.query is not None: + payload["query"] = self.query return payload @classmethod @@ -124,10 +127,12 @@ class AzureMonitorQuery(cogvariants.Dataquery): args["namespace"] = data["namespace"] if "resource" in data: args["resource"] = data["resource"] + if "region" in data: + args["region"] = data["region"] if "datasource" in data: args["datasource"] = data["datasource"] - if "region" in data: - args["region"] = data["region"] + if "query" in data: + args["query"] = data["query"] return cls(**args) @@ -156,6 +161,7 @@ class AzureQueryType(enum.StrEnum): WORKSPACES_QUERY = "Azure Workspaces" LOCATIONS_QUERY = "Azure Regions" GRAFANA_TEMPLATE_VARIABLE_FN = "Grafana Template Variable Function" + TRACE_EXEMPLAR = "traceql" class AzureMetricQuery: @@ -318,6 +324,8 @@ class AzureLogsQuery: dashboard_time: typing.Optional[bool] # If dashboardTime is set to true this value dictates which column the time filter will be applied to. Defaults to the first tables timeSpan column, the first datetime column found, or TimeGenerated time_column: typing.Optional[str] + # If set to true the query will be run as a basic logs query + basic_logs_query: typing.Optional[bool] # Workspace ID. This was removed in Grafana 8, but remains for backwards compat. workspace: typing.Optional[str] # @deprecated Use resources instead @@ -325,12 +333,13 @@ class AzureLogsQuery: # @deprecated Use dashboardTime instead intersect_time: typing.Optional[bool] - def __init__(self, query: typing.Optional[str] = None, result_format: typing.Optional['ResultFormat'] = None, resources: typing.Optional[list[str]] = None, dashboard_time: typing.Optional[bool] = None, time_column: typing.Optional[str] = None, workspace: typing.Optional[str] = None, resource: typing.Optional[str] = None, intersect_time: typing.Optional[bool] = None): + def __init__(self, query: typing.Optional[str] = None, result_format: typing.Optional['ResultFormat'] = None, resources: typing.Optional[list[str]] = None, dashboard_time: typing.Optional[bool] = None, time_column: typing.Optional[str] = None, basic_logs_query: typing.Optional[bool] = None, workspace: typing.Optional[str] = None, resource: typing.Optional[str] = None, intersect_time: typing.Optional[bool] = None): self.query = query self.result_format = result_format self.resources = resources self.dashboard_time = dashboard_time self.time_column = time_column + self.basic_logs_query = basic_logs_query self.workspace = workspace self.resource = resource self.intersect_time = intersect_time @@ -348,6 +357,8 @@ class AzureLogsQuery: payload["dashboardTime"] = self.dashboard_time if self.time_column is not None: payload["timeColumn"] = self.time_column + if self.basic_logs_query is not None: + payload["basicLogsQuery"] = self.basic_logs_query if self.workspace is not None: payload["workspace"] = self.workspace if self.resource is not None: @@ -370,6 +381,8 @@ class AzureLogsQuery: args["dashboard_time"] = data["dashboardTime"] if "timeColumn" in data: args["time_column"] = data["timeColumn"] + if "basicLogsQuery" in data: + args["basic_logs_query"] = data["basicLogsQuery"] if "workspace" in data: args["workspace"] = data["workspace"] if "resource" in data: diff --git a/python/grafana_foundation_sdk/models/common.py b/python/grafana_foundation_sdk/models/common.py index 56a8688..94e6f37 100644 --- a/python/grafana_foundation_sdk/models/common.py +++ b/python/grafana_foundation_sdk/models/common.py @@ -1333,6 +1333,16 @@ class BigValueTextMode(enum.StrEnum): NONE = "none" +class PercentChangeColorMode(enum.StrEnum): + """ + TODO docs + """ + + STANDARD = "standard" + INVERTED = "inverted" + SAME_AS_VALUE = "same_as_value" + + class FieldTextAlignment(enum.StrEnum): """ TODO -- should not be table specific! @@ -1907,19 +1917,27 @@ class TableAutoCellOptions: """ type_val: typing.Literal["auto"] + wrap_text: typing.Optional[bool] - def __init__(self, ): + def __init__(self, wrap_text: typing.Optional[bool] = None): self.type_val = "auto" + self.wrap_text = wrap_text def to_json(self) -> dict[str, object]: payload: dict[str, object] = { "type": self.type_val, } + if self.wrap_text is not None: + payload["wrapText"] = self.wrap_text return payload @classmethod def from_json(cls, data: dict[str, typing.Any]) -> typing.Self: args: dict[str, typing.Any] = {} + + if "wrapText" in data: + args["wrap_text"] = data["wrapText"] + return cls(**args) @@ -1929,19 +1947,27 @@ class TableColorTextCellOptions: """ type_val: typing.Literal["color-text"] + wrap_text: typing.Optional[bool] - def __init__(self, ): + def __init__(self, wrap_text: typing.Optional[bool] = None): self.type_val = "color-text" + self.wrap_text = wrap_text def to_json(self) -> dict[str, object]: payload: dict[str, object] = { "type": self.type_val, } + if self.wrap_text is not None: + payload["wrapText"] = self.wrap_text return payload @classmethod def from_json(cls, data: dict[str, typing.Any]) -> typing.Self: args: dict[str, typing.Any] = {} + + if "wrapText" in data: + args["wrap_text"] = data["wrapText"] + return cls(**args) @@ -2280,11 +2306,13 @@ class TableColoredBackgroundCellOptions: type_val: typing.Literal["color-background"] mode: typing.Optional['TableCellBackgroundDisplayMode'] apply_to_row: typing.Optional[bool] + wrap_text: typing.Optional[bool] - def __init__(self, mode: typing.Optional['TableCellBackgroundDisplayMode'] = None, apply_to_row: typing.Optional[bool] = None): + def __init__(self, mode: typing.Optional['TableCellBackgroundDisplayMode'] = None, apply_to_row: typing.Optional[bool] = None, wrap_text: typing.Optional[bool] = None): self.type_val = "color-background" self.mode = mode self.apply_to_row = apply_to_row + self.wrap_text = wrap_text def to_json(self) -> dict[str, object]: payload: dict[str, object] = { @@ -2294,6 +2322,8 @@ class TableColoredBackgroundCellOptions: payload["mode"] = self.mode if self.apply_to_row is not None: payload["applyToRow"] = self.apply_to_row + if self.wrap_text is not None: + payload["wrapText"] = self.wrap_text return payload @classmethod @@ -2303,7 +2333,9 @@ class TableColoredBackgroundCellOptions: if "mode" in data: args["mode"] = data["mode"] if "applyToRow" in data: - args["apply_to_row"] = data["applyToRow"] + args["apply_to_row"] = data["applyToRow"] + if "wrapText" in data: + args["wrap_text"] = data["wrapText"] return cls(**args) @@ -2316,6 +2348,7 @@ class TableCellHeight(enum.StrEnum): SM = "sm" MD = "md" LG = "lg" + AUTO = "auto" # Table cell options. Each cell has a display mode diff --git a/python/grafana_foundation_sdk/models/dashboard.py b/python/grafana_foundation_sdk/models/dashboard.py index 0b85a03..946016b 100644 --- a/python/grafana_foundation_sdk/models/dashboard.py +++ b/python/grafana_foundation_sdk/models/dashboard.py @@ -64,7 +64,7 @@ class Dashboard: # Snapshot options. They are present only if the dashboard is a snapshot. snapshot: typing.Optional['Snapshot'] - def __init__(self, id_val: typing.Optional[int] = None, uid: typing.Optional[str] = None, title: typing.Optional[str] = None, description: typing.Optional[str] = None, revision: typing.Optional[int] = None, gnet_id: typing.Optional[str] = None, tags: typing.Optional[list[str]] = None, timezone: typing.Optional[str] = "browser", editable: typing.Optional[bool] = True, graph_tooltip: typing.Optional['DashboardCursorSync'] = None, time: typing.Optional['DashboardDashboardTime'] = None, timepicker: typing.Optional['TimePickerConfig'] = None, fiscal_year_start_month: typing.Optional[int] = 0, live_now: typing.Optional[bool] = None, week_start: typing.Optional[str] = None, refresh: typing.Optional[str] = None, schema_version: int = 36, version: typing.Optional[int] = None, panels: typing.Optional[list[typing.Union['Panel', 'RowPanel']]] = None, templating: typing.Optional['DashboardDashboardTemplating'] = None, annotations: typing.Optional['AnnotationContainer'] = None, links: typing.Optional[list['DashboardLink']] = None, snapshot: typing.Optional['Snapshot'] = None): + def __init__(self, id_val: typing.Optional[int] = None, uid: typing.Optional[str] = None, title: typing.Optional[str] = None, description: typing.Optional[str] = None, revision: typing.Optional[int] = None, gnet_id: typing.Optional[str] = None, tags: typing.Optional[list[str]] = None, timezone: typing.Optional[str] = "browser", editable: typing.Optional[bool] = True, graph_tooltip: typing.Optional['DashboardCursorSync'] = None, time: typing.Optional['DashboardDashboardTime'] = None, timepicker: typing.Optional['TimePickerConfig'] = None, fiscal_year_start_month: typing.Optional[int] = 0, live_now: typing.Optional[bool] = None, week_start: typing.Optional[str] = None, refresh: typing.Optional[str] = None, schema_version: int = 39, version: typing.Optional[int] = None, panels: typing.Optional[list[typing.Union['Panel', 'RowPanel']]] = None, templating: typing.Optional['DashboardDashboardTemplating'] = None, annotations: typing.Optional['AnnotationContainer'] = None, links: typing.Optional[list['DashboardLink']] = None, snapshot: typing.Optional['Snapshot'] = None): self.id_val = id_val self.uid = uid self.title = title diff --git a/python/grafana_foundation_sdk/models/heatmap.py b/python/grafana_foundation_sdk/models/heatmap.py index 1a9a40b..c20a649 100644 --- a/python/grafana_foundation_sdk/models/heatmap.py +++ b/python/grafana_foundation_sdk/models/heatmap.py @@ -24,6 +24,16 @@ class HeatmapColorScale(enum.StrEnum): EXPONENTIAL = "exponential" +class HeatmapSelectionMode(enum.StrEnum): + """ + Controls which axis to allow selection on + """ + + X = "x" + Y = "y" + XY = "xy" + + class HeatmapColorOptions: """ Controls various color options @@ -464,8 +474,10 @@ class Options: tooltip: 'HeatmapTooltip' # Controls exemplar options exemplars: 'ExemplarConfig' + # Controls which axis to allow selection on + selection_mode: typing.Optional['HeatmapSelectionMode'] - def __init__(self, calculate: typing.Optional[bool] = False, calculation: typing.Optional[common.HeatmapCalculationOptions] = None, color: typing.Optional['HeatmapColorOptions'] = None, filter_values: typing.Optional['FilterValueRange'] = None, rows_frame: typing.Optional['RowsHeatmapOptions'] = None, show_value: typing.Optional[common.VisibilityMode] = None, cell_gap: typing.Optional[int] = 1, cell_radius: typing.Optional[float] = None, cell_values: typing.Optional['CellValues'] = None, y_axis: typing.Optional['YAxisConfig'] = None, legend: typing.Optional['HeatmapLegend'] = None, tooltip: typing.Optional['HeatmapTooltip'] = None, exemplars: typing.Optional['ExemplarConfig'] = None): + def __init__(self, calculate: typing.Optional[bool] = False, calculation: typing.Optional[common.HeatmapCalculationOptions] = None, color: typing.Optional['HeatmapColorOptions'] = None, filter_values: typing.Optional['FilterValueRange'] = None, rows_frame: typing.Optional['RowsHeatmapOptions'] = None, show_value: typing.Optional[common.VisibilityMode] = None, cell_gap: typing.Optional[int] = 1, cell_radius: typing.Optional[float] = None, cell_values: typing.Optional['CellValues'] = None, y_axis: typing.Optional['YAxisConfig'] = None, legend: typing.Optional['HeatmapLegend'] = None, tooltip: typing.Optional['HeatmapTooltip'] = None, exemplars: typing.Optional['ExemplarConfig'] = None, selection_mode: typing.Optional['HeatmapSelectionMode'] = None): self.calculate = calculate self.calculation = calculation self.color = color if color is not None else HeatmapColorOptions(exponent=0.5, fill="dark-orange", reverse=False, scheme="Oranges", steps=64) @@ -479,6 +491,7 @@ class Options: self.legend = legend if legend is not None else HeatmapLegend(show=True) self.tooltip = tooltip if tooltip is not None else HeatmapTooltip() self.exemplars = exemplars if exemplars is not None else ExemplarConfig(color="rgba(255,0,255,0.7)") + self.selection_mode = selection_mode if selection_mode is not None else HeatmapSelectionMode.X def to_json(self) -> dict[str, object]: payload: dict[str, object] = { @@ -503,6 +516,8 @@ class Options: payload["cellRadius"] = self.cell_radius if self.cell_values is not None: payload["cellValues"] = self.cell_values + if self.selection_mode is not None: + payload["selectionMode"] = self.selection_mode return payload @classmethod @@ -534,7 +549,9 @@ class Options: if "tooltip" in data: args["tooltip"] = HeatmapTooltip.from_json(data["tooltip"]) if "exemplars" in data: - args["exemplars"] = ExemplarConfig.from_json(data["exemplars"]) + args["exemplars"] = ExemplarConfig.from_json(data["exemplars"]) + if "selectionMode" in data: + args["selection_mode"] = data["selectionMode"] return cls(**args) diff --git a/python/grafana_foundation_sdk/models/logs.py b/python/grafana_foundation_sdk/models/logs.py index 43031ff..8f8d68f 100644 --- a/python/grafana_foundation_sdk/models/logs.py +++ b/python/grafana_foundation_sdk/models/logs.py @@ -15,8 +15,14 @@ class Options: enable_log_details: bool sort_order: common.LogsSortOrder dedup_strategy: common.LogsDedupStrategy + # TODO: figure out how to define callbacks + on_click_filter_label: typing.Optional[object] + on_click_filter_out_label: typing.Optional[object] + is_filter_label_active: typing.Optional[object] + on_click_filter_string: typing.Optional[object] + on_click_filter_out_string: typing.Optional[object] - def __init__(self, show_labels: bool = False, show_common_labels: bool = False, show_time: bool = False, show_log_context_toggle: bool = False, wrap_log_message: bool = False, prettify_log_message: bool = False, enable_log_details: bool = False, sort_order: typing.Optional[common.LogsSortOrder] = None, dedup_strategy: typing.Optional[common.LogsDedupStrategy] = None): + def __init__(self, show_labels: bool = False, show_common_labels: bool = False, show_time: bool = False, show_log_context_toggle: bool = False, wrap_log_message: bool = False, prettify_log_message: bool = False, enable_log_details: bool = False, sort_order: typing.Optional[common.LogsSortOrder] = None, dedup_strategy: typing.Optional[common.LogsDedupStrategy] = None, on_click_filter_label: typing.Optional[object] = None, on_click_filter_out_label: typing.Optional[object] = None, is_filter_label_active: typing.Optional[object] = None, on_click_filter_string: typing.Optional[object] = None, on_click_filter_out_string: typing.Optional[object] = None): self.show_labels = show_labels self.show_common_labels = show_common_labels self.show_time = show_time @@ -26,6 +32,11 @@ class Options: self.enable_log_details = enable_log_details self.sort_order = sort_order if sort_order is not None else common.LogsSortOrder.DESCENDING self.dedup_strategy = dedup_strategy if dedup_strategy is not None else common.LogsDedupStrategy.NONE + self.on_click_filter_label = on_click_filter_label + self.on_click_filter_out_label = on_click_filter_out_label + self.is_filter_label_active = is_filter_label_a...*[Comment body truncated]*