Skip to content

Add sort field to List Stream Widget's request query #1167

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
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.4",
"regenerated": "2023-05-30 14:28:50.844064",
"spec_repo_commit": "adf5379f"
"regenerated": "2023-05-31 17:18:45.436506",
"spec_repo_commit": "3b710977"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-05-30 14:28:50.856438",
"spec_repo_commit": "adf5379f"
"regenerated": "2023-05-31 17:18:45.449938",
"spec_repo_commit": "3b710977"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4289,6 +4289,8 @@ components:
description: Widget query.
example: '@service:app'
type: string
sort:
$ref: '#/components/schemas/WidgetFieldSort'
storage:
description: Option for storage location. Feature in Private Beta.
example: indexes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2023-05-31T17:12:24.532Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"log": {
"_recordingName": "Dashboards/Create a new dashboard with list_stream widget with a valid sort parameter ASC",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "262beabe444a04ecc32e92679e01c03d",
"_order": 0,
"cache": {},
"request": {
"bodySize": 417,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 558,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"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\"}}]}"
},
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard"
},
"response": {
"bodySize": 831,
"content": {
"mimeType": "application/json",
"size": 831,
"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\":\"frog@datadoghq.com\",\"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"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 517,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2023-05-31T17:12:24.552Z",
"time": 195
},
{
"_id": "df6728de39f0d9a8232b235100fbe048",
"_order": 0,
"cache": {},
"request": {
"bodySize": 0,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
}
],
"headersSize": 520,
"httpVersion": "HTTP/1.1",
"method": "DELETE",
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard/td2-he3-3vj"
},
"response": {
"bodySize": 39,
"content": {
"mimeType": "application/json",
"size": 39,
"text": "{\"deleted_dashboard_id\":\"td2-he3-3vj\"}\n"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 516,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2023-05-31T17:12:24.760Z",
"time": 156
}
],
"pages": [],
"version": "1.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2023-05-31T17:12:24.923Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"log": {
"_recordingName": "Dashboards/Create a new dashboard with list_stream widget with a valid sort parameter DESC",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "4d9af33ac1a645396afe64b02fe6a4df",
"_order": 0,
"cache": {},
"request": {
"bodySize": 419,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 559,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"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\"}}]}"
},
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard"
},
"response": {
"bodySize": 833,
"content": {
"mimeType": "application/json",
"size": 833,
"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\":\"frog@datadoghq.com\",\"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"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 517,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2023-05-31T17:12:24.928Z",
"time": 146
},
{
"_id": "3505733a41737b1a0aac71a2f23552b6",
"_order": 0,
"cache": {},
"request": {
"bodySize": 0,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
}
],
"headersSize": 520,
"httpVersion": "HTTP/1.1",
"method": "DELETE",
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard/mwn-7ph-8z8"
},
"response": {
"bodySize": 39,
"content": {
"mimeType": "application/json",
"size": 39,
"text": "{\"deleted_dashboard_id\":\"mwn-7ph-8z8\"}\n"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 516,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2023-05-31T17:12:25.081Z",
"time": 169
}
],
"pages": [],
"version": "1.2"
}
}
51 changes: 51 additions & 0 deletions examples/v1/dashboards/CreateDashboard_1877023900.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Create a new dashboard with list_stream widget with a valid sort parameter ASC
*/

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiCreateDashboardRequest = {
body: {
layoutType: "ordered",
title: "Example-Dashboard with list_stream widget",
widgets: [
{
definition: {
type: "list_stream",
requests: [
{
columns: [
{
width: "auto",
field: "timestamp",
},
],
query: {
dataSource: "event_stream",
queryString: "",
eventSize: "l",
sort: {
column: "timestamp",
order: "asc",
},
},
responseFormat: "event_list",
},
],
},
},
],
},
};

apiInstance
.createDashboard(params)
.then((data: v1.Dashboard) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
51 changes: 51 additions & 0 deletions examples/v1/dashboards/CreateDashboard_2361531620.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Create a new dashboard with list_stream widget with a valid sort parameter DESC
*/

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiCreateDashboardRequest = {
body: {
layoutType: "ordered",
title: "Example-Dashboard with list_stream widget",
widgets: [
{
definition: {
type: "list_stream",
requests: [
{
columns: [
{
width: "auto",
field: "timestamp",
},
],
query: {
dataSource: "event_stream",
queryString: "",
eventSize: "l",
sort: {
column: "timestamp",
order: "desc",
},
},
responseFormat: "event_list",
},
],
},
},
],
},
};

apiInstance
.createDashboard(params)
.then((data: v1.Dashboard) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
26 changes: 26 additions & 0 deletions features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,32 @@ Feature: Dashboards
And the response "widgets[0].definition.type" is equal to "list_stream"
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "apm_issue_stream"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with list_stream widget with a valid sort parameter ASC
Given new "CreateDashboard" request
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"}]}}]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.type" is equal to "list_stream"
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "asc"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with list_stream widget with a valid sort parameter DESC
Given new "CreateDashboard" request
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"}]}}]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.type" is equal to "list_stream"
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "desc"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with log_stream widget
Given new "CreateDashboard" request
Expand Down
Loading