Skip to content

Commit 46a8f93

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add sort field to List Stream Widget's request query (#1167)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent bcb46d6 commit 46a8f93

File tree

10 files changed

+365
-4
lines changed

10 files changed

+365
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2023-05-30 14:28:50.844064",
8-
"spec_repo_commit": "adf5379f"
7+
"regenerated": "2023-05-31 17:18:45.436506",
8+
"spec_repo_commit": "3b710977"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-05-30 14:28:50.856438",
13-
"spec_repo_commit": "adf5379f"
12+
"regenerated": "2023-05-31 17:18:45.449938",
13+
"spec_repo_commit": "3b710977"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4289,6 +4289,8 @@ components:
42894289
description: Widget query.
42904290
example: '@service:app'
42914291
type: string
4292+
sort:
4293+
$ref: '#/components/schemas/WidgetFieldSort'
42924294
storage:
42934295
description: Option for storage location. Feature in Private Beta.
42944296
example: indexes
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2023-05-31T17:12:24.532Z"
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Create a new dashboard with list_stream widget with a valid sort parameter ASC",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "262beabe444a04ecc32e92679e01c03d",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 417,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 558,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_ASC-1685553144 with list_stream widget\",\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"timestamp\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"event_stream\",\"event_size\":\"l\",\"query_string\":\"\",\"sort\":{\"column\":\"timestamp\",\"order\":\"asc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"}}]}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/dashboard"
39+
},
40+
"response": {
41+
"bodySize": 831,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 831,
45+
"text": "{\"id\":\"td2-he3-3vj\",\"title\":\"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_ASC-1685553144 with list_stream widget\",\"description\":null,\"author_handle\":\"[email protected]\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/td2-he3-3vj/test-createanewdashboardwithliststreamwidgetwithavalidsortparameterasc-168555314\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"timestamp\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"event_stream\",\"event_size\":\"l\",\"query_string\":\"\",\"sort\":{\"column\":\"timestamp\",\"order\":\"asc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"},\"id\":4579982797049164}],\"notify_list\":null,\"created_at\":\"2023-05-31T17:12:24.700217+00:00\",\"modified_at\":\"2023-05-31T17:12:24.700217+00:00\",\"restricted_roles\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 517,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2023-05-31T17:12:24.552Z",
61+
"time": 195
62+
},
63+
{
64+
"_id": "df6728de39f0d9a8232b235100fbe048",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 520,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/dashboard/td2-he3-3vj"
82+
},
83+
"response": {
84+
"bodySize": 39,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 39,
88+
"text": "{\"deleted_dashboard_id\":\"td2-he3-3vj\"}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 516,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2023-05-31T17:12:24.760Z",
104+
"time": 156
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2023-05-31T17:12:24.923Z"
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Create a new dashboard with list_stream widget with a valid sort parameter DESC",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "4d9af33ac1a645396afe64b02fe6a4df",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 419,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 559,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_DESC-1685553144 with list_stream widget\",\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"timestamp\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"event_stream\",\"event_size\":\"l\",\"query_string\":\"\",\"sort\":{\"column\":\"timestamp\",\"order\":\"desc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"}}]}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/dashboard"
39+
},
40+
"response": {
41+
"bodySize": 833,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 833,
45+
"text": "{\"id\":\"mwn-7ph-8z8\",\"title\":\"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_DESC-1685553144 with list_stream widget\",\"description\":null,\"author_handle\":\"[email protected]\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/mwn-7ph-8z8/test-createanewdashboardwithliststreamwidgetwithavalidsortparameterdesc-16855531\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"timestamp\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"event_stream\",\"event_size\":\"l\",\"query_string\":\"\",\"sort\":{\"column\":\"timestamp\",\"order\":\"desc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"},\"id\":8830087860290510}],\"notify_list\":null,\"created_at\":\"2023-05-31T17:12:25.020023+00:00\",\"modified_at\":\"2023-05-31T17:12:25.020023+00:00\",\"restricted_roles\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 517,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2023-05-31T17:12:24.928Z",
61+
"time": 146
62+
},
63+
{
64+
"_id": "3505733a41737b1a0aac71a2f23552b6",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 520,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/dashboard/mwn-7ph-8z8"
82+
},
83+
"response": {
84+
"bodySize": 39,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 39,
88+
"text": "{\"deleted_dashboard_id\":\"mwn-7ph-8z8\"}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 516,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2023-05-31T17:12:25.081Z",
104+
"time": 169
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Create a new dashboard with list_stream widget with a valid sort parameter ASC
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.DashboardsApi(configuration);
9+
10+
const params: v1.DashboardsApiCreateDashboardRequest = {
11+
body: {
12+
layoutType: "ordered",
13+
title: "Example-Dashboard with list_stream widget",
14+
widgets: [
15+
{
16+
definition: {
17+
type: "list_stream",
18+
requests: [
19+
{
20+
columns: [
21+
{
22+
width: "auto",
23+
field: "timestamp",
24+
},
25+
],
26+
query: {
27+
dataSource: "event_stream",
28+
queryString: "",
29+
eventSize: "l",
30+
sort: {
31+
column: "timestamp",
32+
order: "asc",
33+
},
34+
},
35+
responseFormat: "event_list",
36+
},
37+
],
38+
},
39+
},
40+
],
41+
},
42+
};
43+
44+
apiInstance
45+
.createDashboard(params)
46+
.then((data: v1.Dashboard) => {
47+
console.log(
48+
"API called successfully. Returned data: " + JSON.stringify(data)
49+
);
50+
})
51+
.catch((error: any) => console.error(error));
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Create a new dashboard with list_stream widget with a valid sort parameter DESC
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.DashboardsApi(configuration);
9+
10+
const params: v1.DashboardsApiCreateDashboardRequest = {
11+
body: {
12+
layoutType: "ordered",
13+
title: "Example-Dashboard with list_stream widget",
14+
widgets: [
15+
{
16+
definition: {
17+
type: "list_stream",
18+
requests: [
19+
{
20+
columns: [
21+
{
22+
width: "auto",
23+
field: "timestamp",
24+
},
25+
],
26+
query: {
27+
dataSource: "event_stream",
28+
queryString: "",
29+
eventSize: "l",
30+
sort: {
31+
column: "timestamp",
32+
order: "desc",
33+
},
34+
},
35+
responseFormat: "event_list",
36+
},
37+
],
38+
},
39+
},
40+
],
41+
},
42+
};
43+
44+
apiInstance
45+
.createDashboard(params)
46+
.then((data: v1.Dashboard) => {
47+
console.log(
48+
"API called successfully. Returned data: " + JSON.stringify(data)
49+
);
50+
})
51+
.catch((error: any) => console.error(error));

features/v1/dashboards.feature

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,32 @@ Feature: Dashboards
390390
And the response "widgets[0].definition.type" is equal to "list_stream"
391391
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "apm_issue_stream"
392392

393+
@team:DataDog/dashboards-backend
394+
Scenario: Create a new dashboard with list_stream widget with a valid sort parameter ASC
395+
Given new "CreateDashboard" request
396+
And body with value {"layout_type": "ordered","title": "{{ unique }} with list_stream widget","widgets": [{"definition": {"type": "list_stream","requests": [{"columns": [{"width": "auto","field": "timestamp"}],"query": {"data_source": "event_stream","query_string": "","event_size": "l", "sort": {"column": "timestamp", "order": "asc"}},"response_format": "event_list"}]}}]}
397+
When the request is sent
398+
Then the response status is 200 OK
399+
And the response "widgets[0].definition.type" is equal to "list_stream"
400+
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
401+
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
402+
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
403+
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
404+
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "asc"
405+
406+
@team:DataDog/dashboards-backend
407+
Scenario: Create a new dashboard with list_stream widget with a valid sort parameter DESC
408+
Given new "CreateDashboard" request
409+
And body with value {"layout_type": "ordered","title": "{{ unique }} with list_stream widget","widgets": [{"definition": {"type": "list_stream","requests": [{"columns": [{"width": "auto","field": "timestamp"}],"query": {"data_source": "event_stream","query_string": "","event_size": "l", "sort": {"column": "timestamp", "order": "desc"}},"response_format": "event_list"}]}}]}
410+
When the request is sent
411+
Then the response status is 200 OK
412+
And the response "widgets[0].definition.type" is equal to "list_stream"
413+
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
414+
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
415+
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
416+
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
417+
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "desc"
418+
393419
@team:DataDog/dashboards-backend
394420
Scenario: Create a new dashboard with log_stream widget
395421
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)