Skip to content

Commit

Permalink
Dashboards - Toplist widget style - Add palette (#2146)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Sep 6, 2024
1 parent 45a96f8 commit b8784cb
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 22 deletions.
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": "2024-09-04 17:12:33.836340",
"spec_repo_commit": "8e0507d2"
"regenerated": "2024-09-06 21:00:01.018907",
"spec_repo_commit": "3dff532a"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-04 17:12:33.853825",
"spec_repo_commit": "8e0507d2"
"regenerated": "2024-09-06 21:00:01.036744",
"spec_repo_commit": "3dff532a"
}
}
}
3 changes: 3 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17115,6 +17115,9 @@ components:
properties:
display:
$ref: '#/components/schemas/ToplistWidgetDisplay'
palette:
description: Color palette to apply to the widget.
type: string
scaling:
$ref: '#/components/schemas/ToplistWidgetScaling'
type: object
Expand Down
1 change: 1 addition & 0 deletions examples/v1/dashboards/CreateDashboard_1213075383.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
legend=ToplistWidgetLegend.INLINE,
),
scaling=ToplistWidgetScaling.RELATIVE,
palette="dog_classic",
),
type=ToplistWidgetDefinitionType.TOPLIST,
requests=[
Expand Down
1 change: 1 addition & 0 deletions examples/v1/dashboards/CreateDashboard_2563642929.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
legend=ToplistWidgetLegend.INLINE,
),
scaling=ToplistWidgetScaling.RELATIVE,
palette="dog_classic",
),
type=ToplistWidgetDefinitionType.TOPLIST,
requests=[
Expand Down
8 changes: 8 additions & 0 deletions src/datadog_api_client/v1/model/toplist_widget_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ def openapi_types(_):

return {
"display": (ToplistWidgetDisplay,),
"palette": (str,),
"scaling": (ToplistWidgetScaling,),
}

attribute_map = {
"display": "display",
"palette": "palette",
"scaling": "scaling",
}

def __init__(
self_,
display: Union[ToplistWidgetDisplay, ToplistWidgetStacked, ToplistWidgetFlat, UnsetType] = unset,
palette: Union[str, UnsetType] = unset,
scaling: Union[ToplistWidgetScaling, UnsetType] = unset,
**kwargs,
):
Expand All @@ -48,11 +51,16 @@ def __init__(
:param display: Top list widget display options.
:type display: ToplistWidgetDisplay, optional
:param palette: Color palette to apply to the widget.
:type palette: str, optional
:param scaling: Top list widget scaling definition.
:type scaling: ToplistWidgetScaling, optional
"""
if display is not unset:
kwargs["display"] = display
if palette is not unset:
kwargs["palette"] = palette
if scaling is not unset:
kwargs["scaling"] = scaling
super().__init__(kwargs)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-05-21T14:43:42.680Z
2024-09-06T12:10:50.473Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_a_toplist_widget_sorted_by_group-1716302622","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*}
by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}'
body: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_a_toplist_widget_sorted_by_group-1725624650","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*}
by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}'
headers:
accept:
- application/json
Expand All @@ -11,9 +11,9 @@ interactions:
uri: https://api.datadoghq.com/api/v1/dashboard
response:
body:
string: '{"id":"wbt-nas-fux","title":"Test-Create_a_new_dashboard_with_a_toplist_widget_sorted_by_group-1716302622","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
Account","layout_type":"free","url":"/dashboard/wbt-nas-fux/test-createanewdashboardwithatoplistwidgetsortedbygroup-1716302622","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*}
by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":4714578700620842}],"notify_list":[],"created_at":"2024-05-21T14:43:42.875646+00:00","modified_at":"2024-05-21T14:43:42.875646+00:00","restricted_roles":[]}
string: '{"id":"pr4-bz7-nn3","title":"Test-Create_a_new_dashboard_with_a_toplist_widget_sorted_by_group-1725624650","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
Account","layout_type":"free","url":"/dashboard/pr4-bz7-nn3/test-createanewdashboardwithatoplistwidgetsortedbygroup-1725624650","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*}
by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":8644525358047960}],"notify_list":[],"created_at":"2024-09-06T12:10:50.735923+00:00","modified_at":"2024-09-06T12:10:50.735923+00:00","restricted_roles":[]}
'
headers:
Expand All @@ -28,10 +28,10 @@ interactions:
accept:
- application/json
method: DELETE
uri: https://api.datadoghq.com/api/v1/dashboard/wbt-nas-fux
uri: https://api.datadoghq.com/api/v1/dashboard/pr4-bz7-nn3
response:
body:
string: '{"deleted_dashboard_id":"wbt-nas-fux"}
string: '{"deleted_dashboard_id":"pr4-bz7-nn3"}
'
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-05-15T20:07:42.432Z
2024-09-06T12:10:51.099Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_toplist_widget-1715803662","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*}
by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}'
body: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_toplist_widget-1725624651","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*}
by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}'
headers:
accept:
- application/json
Expand All @@ -11,9 +11,9 @@ interactions:
uri: https://api.datadoghq.com/api/v1/dashboard
response:
body:
string: '{"id":"y3a-6s5-ycw","title":"Test-Create_a_new_dashboard_with_toplist_widget-1715803662","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
Account","layout_type":"free","url":"/dashboard/y3a-6s5-ycw/test-createanewdashboardwithtoplistwidget-1715803662","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*}
by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":1848529953140569}],"notify_list":[],"created_at":"2024-05-15T20:07:42.589379+00:00","modified_at":"2024-05-15T20:07:42.589379+00:00","restricted_roles":[]}
string: '{"id":"q25-ie2-8p9","title":"Test-Create_a_new_dashboard_with_toplist_widget-1725624651","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
Account","layout_type":"free","url":"/dashboard/q25-ie2-8p9/test-createanewdashboardwithtoplistwidget-1725624651","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*}
by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":6898333964604098}],"notify_list":[],"created_at":"2024-09-06T12:10:51.371974+00:00","modified_at":"2024-09-06T12:10:51.371974+00:00","restricted_roles":[]}
'
headers:
Expand All @@ -28,10 +28,10 @@ interactions:
accept:
- application/json
method: DELETE
uri: https://api.datadoghq.com/api/v1/dashboard/y3a-6s5-ycw
uri: https://api.datadoghq.com/api/v1/dashboard/q25-ie2-8p9
response:
body:
string: '{"deleted_dashboard_id":"y3a-6s5-ycw"}
string: '{"deleted_dashboard_id":"q25-ie2-8p9"}
'
headers:
Expand Down
2 changes: 1 addition & 1 deletion tests/v1/features/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Feature: Dashboards
@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with a toplist widget sorted by group
Given new "CreateDashboard" request
And body with value {"title":"{{ unique }}","description":"","widgets":[{"layout":{"x":0,"y":0,"width":47,"height":15},"definition":{"title":"","title_size":"16","title_align":"left","time":{},"style":{"display": {"type": "stacked","legend": "inline"},"scaling": "relative"},"type":"toplist","requests":[{"queries":[{"data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} by {service}","aggregator":"avg"}],"formulas":[{"formula":"query1"}],"sort":{"count":10,"order_by":[{"type":"group","name":"service","order":"asc"}]},"response_format":"scalar"}]}}],"template_variables":[],"layout_type":"free","is_read_only":false,"notify_list":[]}
And body with value {"title":"{{ unique }}","description":"","widgets":[{"layout":{"x":0,"y":0,"width":47,"height":15},"definition":{"title":"","title_size":"16","title_align":"left","time":{},"style":{"display": {"type": "stacked","legend": "inline"},"scaling": "relative","palette": "dog_classic"},"type":"toplist","requests":[{"queries":[{"data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} by {service}","aggregator":"avg"}],"formulas":[{"formula":"query1"}],"sort":{"count":10,"order_by":[{"type":"group","name":"service","order":"asc"}]},"response_format":"scalar"}]}}],"template_variables":[],"layout_type":"free","is_read_only":false,"notify_list":[]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.type" is equal to "toplist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"type": "stacked",
"legend": "inline"
},
"scaling": "relative"
"scaling": "relative",
"palette": "dog_classic"
},
"type":"toplist",
"requests":[
Expand Down

0 comments on commit b8784cb

Please sign in to comment.