Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Dashboards] Fix is_column_break issues #1140

Merged
merged 3 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 9 additions & 3 deletions datadog/resource_datadog_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,12 +987,18 @@ func buildTerraformWidget(datadogWidget datadogV1.Widget, k *utils.ResourceDataK

// Build layout
if v, ok := datadogWidget.GetLayoutOk(); ok {
terraformWidget["widget_layout"] = []map[string]int64{{
widgetLayout := map[string]interface{}{
"x": (*v).GetX(),
"y": (*v).GetY(),
"height": (*v).GetHeight(),
"width": (*v).GetWidth(),
}}
}
if value, ok := (*v).GetIsColumnBreakOk(); ok {
widgetLayout["is_column_break"] = value
}
terraformWidget["widget_layout"] = [](map[string]interface{}){
widgetLayout,
}
}
terraformWidget["id"] = datadogWidget.GetId()

Expand Down Expand Up @@ -1136,7 +1142,7 @@ func buildDatadogWidgetLayout(terraformLayout map[string]interface{}) *datadogV1
datadogLayout.SetY(int64(terraformLayout["y"].(int)))
datadogLayout.SetHeight(int64(terraformLayout["height"].(int)))
datadogLayout.SetWidth(int64(terraformLayout["width"].(int)))
if value, ok := terraformLayout["is_column_break"].(bool); ok {
if value, ok := terraformLayout["is_column_break"].(bool); ok && value {
datadogLayout.SetIsColumnBreak(value)
}
return datadogLayout
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021-05-19T19:45:39.34159-04:00
2021-07-12T11:25:24.046699+02:00
70 changes: 24 additions & 46 deletions datadog/tests/cassettes/TestAccDatadogDashboardEventStream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 1
interactions:
- request:
body: |
{"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"free","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","widgets":[{"definition":{"event_size":"l","query":"*","tags_execution":"and","time":{"live_span":"4h"},"title":"Widget Title","title_align":"right","title_size":"16","type":"event_stream"},"layout":{"height":43,"is_column_break":false,"width":32,"x":5,"y":5}}]}
{"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"free","notify_list":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","widgets":[{"definition":{"event_size":"l","query":"*","tags_execution":"and","time":{"live_span":"4h"},"title":"Widget Title","title_align":"right","title_size":"16","type":"event_stream"},"layout":{"height":43,"width":32,"x":5,"y":5}}]}
form: {}
headers:
Accept:
Expand All @@ -13,11 +13,11 @@ interactions:
Dd-Operation-Id:
- CreateDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard
method: POST
response:
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"hgw-kkx-56n","title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","url":"/dashboard/hgw-kkx-56n/tf-testaccdatadogdashboardeventstream-local-1621467939","created_at":"2021-05-19T23:45:40.663940+00:00","modified_at":"2021-05-19T23:45:40.663940+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"is_column_break":false,"x":5,"height":43},"id":4337925842615708}],"layout_type":"free"}'
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"p4i-69v-wza","title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","url":"/dashboard/p4i-69v-wza/tf-testaccdatadogdashboardeventstream-local-1626081924","created_at":"2021-07-12T09:25:26.328377+00:00","modified_at":"2021-07-12T09:25:26.328377+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"x":5,"height":43},"id":3389778989732665}],"layout_type":"free"}'
headers:
Cache-Control:
- no-cache
Expand All @@ -28,7 +28,7 @@ interactions:
Content-Type:
- application/json
Date:
- Wed, 19 May 2021 23:45:43 GMT
- Mon, 12 Jul 2021 09:25:29 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -37,10 +37,6 @@ interactions:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- SY1h8ScsWq+kYmtbh63ltMLFAZsQjqfrgvdfAoRX+9TzT1sgMBRYaFRwfWWRRe9a
X-Dd-Version:
- "35.4569410"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
Expand All @@ -55,11 +51,11 @@ interactions:
Dd-Operation-Id:
- GetDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
method: GET
response:
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"hgw-kkx-56n","title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","url":"/dashboard/hgw-kkx-56n/tf-testaccdatadogdashboardeventstream-local-1621467939","created_at":"2021-05-19T23:45:40.663940+00:00","modified_at":"2021-05-19T23:45:40.663940+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"is_column_break":false,"x":5,"height":43},"id":4337925842615708}],"layout_type":"free"}'
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"p4i-69v-wza","title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","url":"/dashboard/p4i-69v-wza/tf-testaccdatadogdashboardeventstream-local-1626081924","created_at":"2021-07-12T09:25:26.328377+00:00","modified_at":"2021-07-12T09:25:26.328377+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"x":5,"height":43},"id":3389778989732665}],"layout_type":"free"}'
headers:
Cache-Control:
- no-cache
Expand All @@ -70,7 +66,7 @@ interactions:
Content-Type:
- application/json
Date:
- Wed, 19 May 2021 23:45:43 GMT
- Mon, 12 Jul 2021 09:25:29 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -79,10 +75,6 @@ interactions:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- LcgNasIYBRkNppmD6mCKE9J6iv0eEjosuuHR5V5zw2fWbR54i39C8dhdK8zDq/40
X-Dd-Version:
- "35.4569410"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
Expand All @@ -97,11 +89,11 @@ interactions:
Dd-Operation-Id:
- GetDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
method: GET
response:
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"hgw-kkx-56n","title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","url":"/dashboard/hgw-kkx-56n/tf-testaccdatadogdashboardeventstream-local-1621467939","created_at":"2021-05-19T23:45:40.663940+00:00","modified_at":"2021-05-19T23:45:40.663940+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"is_column_break":false,"x":5,"height":43},"id":4337925842615708}],"layout_type":"free"}'
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"p4i-69v-wza","title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","url":"/dashboard/p4i-69v-wza/tf-testaccdatadogdashboardeventstream-local-1626081924","created_at":"2021-07-12T09:25:26.328377+00:00","modified_at":"2021-07-12T09:25:26.328377+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"x":5,"height":43},"id":3389778989732665}],"layout_type":"free"}'
headers:
Cache-Control:
- no-cache
Expand All @@ -112,7 +104,7 @@ interactions:
Content-Type:
- application/json
Date:
- Wed, 19 May 2021 23:45:43 GMT
- Mon, 12 Jul 2021 09:25:29 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -121,10 +113,6 @@ interactions:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- dPySkcOzIZtKyMKDAAzuysY3gNGGj6RtYogGuSb76E8mPvoqzREyRp6lPYm91hQU
X-Dd-Version:
- "35.4569410"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
Expand All @@ -139,11 +127,11 @@ interactions:
Dd-Operation-Id:
- GetDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
method: GET
response:
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"hgw-kkx-56n","title":"tf-TestAccDatadogDashboardEventStream-local-1621467939","url":"/dashboard/hgw-kkx-56n/tf-testaccdatadogdashboardeventstream-local-1621467939","created_at":"2021-05-19T23:45:40.663940+00:00","modified_at":"2021-05-19T23:45:40.663940+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"is_column_break":false,"x":5,"height":43},"id":4337925842615708}],"layout_type":"free"}'
body: '{"notify_list":[],"description":"Created using the Datadog provider in Terraform","author_name":null,"template_variable_presets":[],"template_variables":[],"is_read_only":true,"id":"p4i-69v-wza","title":"tf-TestAccDatadogDashboardEventStream-local-1626081924","url":"/dashboard/p4i-69v-wza/tf-testaccdatadogdashboardeventstream-local-1626081924","created_at":"2021-07-12T09:25:26.328377+00:00","modified_at":"2021-07-12T09:25:26.328377+00:00","author_handle":"[email protected]","widgets":[{"definition":{"title_size":"16","title":"Widget Title","title_align":"right","tags_execution":"and","time":{"live_span":"4h"},"query":"*","type":"event_stream","event_size":"l"},"layout":{"y":5,"width":32,"x":5,"height":43},"id":3389778989732665}],"layout_type":"free"}'
headers:
Cache-Control:
- no-cache
Expand All @@ -154,7 +142,7 @@ interactions:
Content-Type:
- application/json
Date:
- Wed, 19 May 2021 23:45:44 GMT
- Mon, 12 Jul 2021 09:25:30 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -163,10 +151,6 @@ interactions:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- 5gfwVh/5HZ+AnGd/Di93w3NEWC6KMHT9KzmHEiRJmNdOjBtAsbOcgVFyqEChw71h
X-Dd-Version:
- "35.4569410"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
Expand All @@ -181,11 +165,11 @@ interactions:
Dd-Operation-Id:
- DeleteDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
method: DELETE
response:
body: '{"deleted_dashboard_id":"hgw-kkx-56n"}'
body: '{"deleted_dashboard_id":"p4i-69v-wza"}'
headers:
Cache-Control:
- no-cache
Expand All @@ -196,7 +180,7 @@ interactions:
Content-Type:
- application/json
Date:
- Wed, 19 May 2021 23:45:45 GMT
- Mon, 12 Jul 2021 09:25:31 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -205,10 +189,6 @@ interactions:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Debug:
- nLnnBNvlCFDECRnZvzDb0z4sAO35G+IMidcAs8vrCKyjvsKWE8Yd9S3n6OjZ1qRN
X-Dd-Version:
- "35.4569410"
X-Frame-Options:
- SAMEORIGIN
status: 200 OK
Expand All @@ -223,11 +203,11 @@ interactions:
Dd-Operation-Id:
- GetDashboard
User-Agent:
- terraform-provider-datadog/dev (terraform 2.4.4; terraform-cli 0.14.7) datadog-api-client-go/1.0.0-beta.22 (go go1.15.11; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/hgw-kkx-56n
- terraform-provider-datadog/dev (terraform 2.7.0; terraform-cli 0.14.6) datadog-api-client-go/1.1.1+dev (go go1.16.2; os darwin; arch amd64)
url: https://api.datadoghq.com/api/v1/dashboard/p4i-69v-wza
method: GET
response:
body: '{"errors": ["Dashboard with ID hgw-kkx-56n not found"]}'
body: '{"errors": ["Dashboard with ID p4i-69v-wza not found"]}'
headers:
Cache-Control:
- no-cache
Expand All @@ -238,7 +218,7 @@ interactions:
Content-Type:
- application/json
Date:
- Wed, 19 May 2021 23:45:45 GMT
- Mon, 12 Jul 2021 09:25:32 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand All @@ -247,8 +227,6 @@ interactions:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Dd-Version:
- "35.4569410"
X-Frame-Options:
- SAMEORIGIN
status: 404 Not Found
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021-05-19T19:45:39.34166-04:00
2021-07-12T11:25:24.046699+02:00
Loading