Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-20 18:33:33.220649",
"spec_repo_commit": "d3fcdb89"
"regenerated": "2025-02-21 08:00:33.138734",
"spec_repo_commit": "8f2d39c3"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-20 18:33:33.236028",
"spec_repo_commit": "d3fcdb89"
"regenerated": "2025-02-21 08:00:33.154333",
"spec_repo_commit": "8f2d39c3"
}
}
}
35 changes: 35 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17396,11 +17396,13 @@ components:
enum:
- number
- bar
- trend
example: number
type: string
x-enum-varnames:
- NUMBER
- BAR
- TREND
TableWidgetDefinition:
description: The table visualization is available on timeboards and screenboards.
It displays columns of metrics grouped by tag key.
Expand Down Expand Up @@ -23089,6 +23091,8 @@ components:
type: string
cell_display_mode:
$ref: '#/components/schemas/TableWidgetCellDisplayMode'
cell_display_mode_options:
$ref: '#/components/schemas/WidgetFormulaCellDisplayModeOptions'
conditional_formats:
description: List of conditional formats.
items:
Expand All @@ -23107,6 +23111,37 @@ components:
required:
- formula
type: object
WidgetFormulaCellDisplayModeOptions:
description: Cell display mode options for the widget formula. (only if `cell_display_mode`
is set to `trend`).
properties:
trend_type:
$ref: '#/components/schemas/WidgetFormulaCellDisplayModeOptionsTrendType'
y_scale:
$ref: '#/components/schemas/WidgetFormulaCellDisplayModeOptionsYScale'
type: object
WidgetFormulaCellDisplayModeOptionsTrendType:
description: Trend type for the cell display mode options.
enum:
- area
- line
- bars
example: area
type: string
x-enum-varnames:
- AREA
- LINE
- BARS
WidgetFormulaCellDisplayModeOptionsYScale:
description: Y scale for the cell display mode options.
enum:
- shared
- independent
example: shared
type: string
x-enum-varnames:
- SHARED
- INDEPENDENT
WidgetFormulaLimit:
description: Options for limiting results returned.
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-02-14T13:36:57.006Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions examples/v1/dashboards/CreateDashboard_1490099434.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Create a new dashboard with query_table widget and cell_display_mode is trend

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

body = DatadogAPIClient::V1::Dashboard.new({
title: "Example-Dashboard",
description: "",
widgets: [
DatadogAPIClient::V1::Widget.new({
layout: DatadogAPIClient::V1::WidgetLayout.new({
x: 0,
y: 0,
width: 54,
height: 32,
}),
definition: DatadogAPIClient::V1::TableWidgetDefinition.new({
title: "",
title_size: "16",
title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}),
type: DatadogAPIClient::V1::TableWidgetDefinitionType::QUERY_TABLE,
requests: [
DatadogAPIClient::V1::TableWidgetRequest.new({
queries: [
DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({
data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS,
name: "query1",
query: "avg:system.cpu.user{*} by {host}",
aggregator: DatadogAPIClient::V1::FormulaAndFunctionMetricAggregation::AVG,
}),
],
formulas: [
DatadogAPIClient::V1::WidgetFormula.new({
formula: "query1",
conditional_formats: [],
cell_display_mode: DatadogAPIClient::V1::TableWidgetCellDisplayMode::TREND,
cell_display_mode_options: DatadogAPIClient::V1::WidgetFormulaCellDisplayModeOptions.new({
trend_type: DatadogAPIClient::V1::WidgetFormulaCellDisplayModeOptionsTrendType::LINE,
y_scale: DatadogAPIClient::V1::WidgetFormulaCellDisplayModeOptionsYScale::SHARED,
}),
}),
],
sort: DatadogAPIClient::V1::WidgetSortBy.new({
count: 500,
order_by: [
DatadogAPIClient::V1::WidgetFormulaSort.new({
type: DatadogAPIClient::V1::FormulaType::FORMULA,
index: 0,
order: DatadogAPIClient::V1::WidgetSort::DESCENDING,
}),
],
}),
response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR,
}),
],
has_search_bar: DatadogAPIClient::V1::TableWidgetHasSearchBar::AUTO,
}),
}),
],
template_variables: [],
layout_type: DatadogAPIClient::V1::DashboardLayoutType::FREE,
notify_list: [],
})
p api_instance.create_dashboard(body)
11 changes: 11 additions & 0 deletions features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,17 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula"
And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with query_table widget and cell_display_mode is trend
Given new "CreateDashboard" request
And body from file "dashboards_json_payload/query_table_widget_cell_display_mode_trend.json"
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.type" is equal to "query_table"
And the response "widgets[0].definition.requests[0].formulas[0].cell_display_mode" is equal to "trend"
And the response "widgets[0].definition.requests[0].formulas[0].cell_display_mode_options.trend_type" is equal to "line"
And the response "widgets[0].definition.requests[0].formulas[0].cell_display_mode_options.y_scale" is equal to "shared"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with query_table widget and text formatting
Given new "CreateDashboard" request
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"title":"{{ unique }}",
"description":"",
"widgets":[
{
"layout":{
"x":0,
"y":0,
"width":54,
"height":32
},
"definition":{
"title":"",
"title_size":"16",
"title_align":"left",
"time":{

},
"type":"query_table",
"requests":[
{
"queries":[
{
"data_source":"metrics",
"name":"query1",
"query":"avg:system.cpu.user{*} by {host}",
"aggregator":"avg"
}
],
"formulas":[
{
"formula":"query1",
"conditional_formats":[

],
"cell_display_mode": "trend",
"cell_display_mode_options": {
"trend_type": "line",
"y_scale": "shared"
}
}
],
"sort": {
"count":500,
"order_by":[
{
"type":"formula",
"index":0,
"order":"desc"
}
]
},
"response_format":"scalar"
}
],
"has_search_bar":"auto"
}
}
],
"template_variables":[

],
"layout_type":"free",
"notify_list":[

]
}
3 changes: 3 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,9 @@ def overrides
"v1.widget_event_size" => "WidgetEventSize",
"v1.widget_field_sort" => "WidgetFieldSort",
"v1.widget_formula" => "WidgetFormula",
"v1.widget_formula_cell_display_mode_options" => "WidgetFormulaCellDisplayModeOptions",
"v1.widget_formula_cell_display_mode_options_trend_type" => "WidgetFormulaCellDisplayModeOptionsTrendType",
"v1.widget_formula_cell_display_mode_options_y_scale" => "WidgetFormulaCellDisplayModeOptionsYScale",
"v1.widget_formula_limit" => "WidgetFormulaLimit",
"v1.widget_formula_sort" => "WidgetFormulaSort",
"v1.widget_formula_style" => "WidgetFormulaStyle",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ class TableWidgetCellDisplayMode

NUMBER = "number".freeze
BAR = "bar".freeze
TREND = "trend".freeze
end
end
12 changes: 11 additions & 1 deletion lib/datadog_api_client/v1/models/widget_formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class WidgetFormula
# Define a display mode for the table cell.
attr_accessor :cell_display_mode

# Cell display mode options for the widget formula. (only if `cell_display_mode` is set to `trend`).
attr_accessor :cell_display_mode_options

# List of conditional formats.
attr_accessor :conditional_formats

Expand All @@ -50,6 +53,7 @@ def self.attribute_map
{
:'_alias' => :'alias',
:'cell_display_mode' => :'cell_display_mode',
:'cell_display_mode_options' => :'cell_display_mode_options',
:'conditional_formats' => :'conditional_formats',
:'formula' => :'formula',
:'limit' => :'limit',
Expand All @@ -64,6 +68,7 @@ def self.openapi_types
{
:'_alias' => :'String',
:'cell_display_mode' => :'TableWidgetCellDisplayMode',
:'cell_display_mode_options' => :'WidgetFormulaCellDisplayModeOptions',
:'conditional_formats' => :'Array<WidgetConditionalFormat>',
:'formula' => :'String',
:'limit' => :'WidgetFormulaLimit',
Expand Down Expand Up @@ -98,6 +103,10 @@ def initialize(attributes = {})
self.cell_display_mode = attributes[:'cell_display_mode']
end

if attributes.key?(:'cell_display_mode_options')
self.cell_display_mode_options = attributes[:'cell_display_mode_options']
end

if attributes.key?(:'conditional_formats')
if (value = attributes[:'conditional_formats']).is_a?(Array)
self.conditional_formats = value
Expand Down Expand Up @@ -167,6 +176,7 @@ def ==(o)
self.class == o.class &&
_alias == o._alias &&
cell_display_mode == o.cell_display_mode &&
cell_display_mode_options == o.cell_display_mode_options &&
conditional_formats == o.conditional_formats &&
formula == o.formula &&
limit == o.limit &&
Expand All @@ -179,7 +189,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[_alias, cell_display_mode, conditional_formats, formula, limit, number_format, style, additional_properties].hash
[_alias, cell_display_mode, cell_display_mode_options, conditional_formats, formula, limit, number_format, style, additional_properties].hash
end
end
end
Loading
Loading