-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Toplist widget's stacked display style - remove legend as require…
…d field (#2184) Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
465f013
commit cc2b046
Showing
8 changed files
with
168 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
""" | ||
Create a new dashboard with a toplist widget with stacked type and no legend specified | ||
""" | ||
|
||
from datadog_api_client import ApiClient, Configuration | ||
from datadog_api_client.v1.api.dashboards_api import DashboardsApi | ||
from datadog_api_client.v1.model.dashboard import Dashboard | ||
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType | ||
from datadog_api_client.v1.model.formula_and_function_metric_aggregation import FormulaAndFunctionMetricAggregation | ||
from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource | ||
from datadog_api_client.v1.model.formula_and_function_metric_query_definition import ( | ||
FormulaAndFunctionMetricQueryDefinition, | ||
) | ||
from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat | ||
from datadog_api_client.v1.model.group_type import GroupType | ||
from datadog_api_client.v1.model.toplist_widget_definition import ToplistWidgetDefinition | ||
from datadog_api_client.v1.model.toplist_widget_definition_type import ToplistWidgetDefinitionType | ||
from datadog_api_client.v1.model.toplist_widget_request import ToplistWidgetRequest | ||
from datadog_api_client.v1.model.toplist_widget_scaling import ToplistWidgetScaling | ||
from datadog_api_client.v1.model.toplist_widget_stacked import ToplistWidgetStacked | ||
from datadog_api_client.v1.model.toplist_widget_stacked_type import ToplistWidgetStackedType | ||
from datadog_api_client.v1.model.toplist_widget_style import ToplistWidgetStyle | ||
from datadog_api_client.v1.model.widget import Widget | ||
from datadog_api_client.v1.model.widget_formula import WidgetFormula | ||
from datadog_api_client.v1.model.widget_group_sort import WidgetGroupSort | ||
from datadog_api_client.v1.model.widget_layout import WidgetLayout | ||
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan | ||
from datadog_api_client.v1.model.widget_sort import WidgetSort | ||
from datadog_api_client.v1.model.widget_sort_by import WidgetSortBy | ||
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign | ||
|
||
body = Dashboard( | ||
title="Example-Dashboard", | ||
description="", | ||
widgets=[ | ||
Widget( | ||
layout=WidgetLayout( | ||
x=0, | ||
y=0, | ||
width=47, | ||
height=15, | ||
), | ||
definition=ToplistWidgetDefinition( | ||
title="", | ||
title_size="16", | ||
title_align=WidgetTextAlign.LEFT, | ||
time=WidgetLegacyLiveSpan(), | ||
style=ToplistWidgetStyle( | ||
display=ToplistWidgetStacked( | ||
type=ToplistWidgetStackedType.STACKED, | ||
), | ||
scaling=ToplistWidgetScaling.RELATIVE, | ||
palette="dog_classic", | ||
), | ||
type=ToplistWidgetDefinitionType.TOPLIST, | ||
requests=[ | ||
ToplistWidgetRequest( | ||
queries=[ | ||
FormulaAndFunctionMetricQueryDefinition( | ||
data_source=FormulaAndFunctionMetricDataSource.METRICS, | ||
name="query1", | ||
query="avg:system.cpu.user{*} by {service}", | ||
aggregator=FormulaAndFunctionMetricAggregation.AVG, | ||
), | ||
], | ||
formulas=[ | ||
WidgetFormula( | ||
formula="query1", | ||
), | ||
], | ||
sort=WidgetSortBy( | ||
count=10, | ||
order_by=[ | ||
WidgetGroupSort( | ||
type=GroupType.GROUP, | ||
name="service", | ||
order=WidgetSort.ASCENDING, | ||
), | ||
], | ||
), | ||
response_format=FormulaAndFunctionResponseFormat.SCALAR, | ||
), | ||
], | ||
), | ||
), | ||
], | ||
template_variables=[], | ||
layout_type=DashboardLayoutType.FREE, | ||
is_read_only=False, | ||
notify_list=[], | ||
) | ||
|
||
configuration = Configuration() | ||
with ApiClient(configuration) as api_client: | ||
api_instance = DashboardsApi(api_client) | ||
response = api_instance.create_dashboard(body=body) | ||
|
||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...te_a_new_dashboard_with_a_toplist_widget_with_stacked_type_and_no_legend_specified.frozen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2024-09-30T17:24:52.299Z |
42 changes: 42 additions & 0 deletions
42
...eate_a_new_dashboard_with_a_toplist_widget_with_stacked_type_and_no_legend_specified.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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_with_stacked_type_and_no_legend_specified-1727717092","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":{"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 | ||
content-type: | ||
- application/json | ||
method: POST | ||
uri: https://api.datadoghq.com/api/v1/dashboard | ||
response: | ||
body: | ||
string: '{"id":"2az-xeg-xar","title":"Test-Create_a_new_dashboard_with_a_toplist_widget_with_stacked_type_and_no_legend_specified-1727717092","description":"","author_handle":"[email protected]","author_name":null,"layout_type":"free","url":"/dashboard/2az-xeg-xar/test-createanewdashboardwithatoplistwidgetwithstackedtypeandnolegendspecified-17","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":{"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":688132644515996}],"notify_list":[],"created_at":"2024-09-30T17:24:52.542207+00:00","modified_at":"2024-09-30T17:24:52.542207+00:00","experience_type":"default","restricted_roles":[]} | ||
' | ||
headers: | ||
content-type: | ||
- application/json | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
accept: | ||
- application/json | ||
method: DELETE | ||
uri: https://api.datadoghq.com/api/v1/dashboard/2az-xeg-xar | ||
response: | ||
body: | ||
string: '{"deleted_dashboard_id":"2az-xeg-xar"} | ||
' | ||
headers: | ||
content-type: | ||
- application/json | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters