Skip to content

Commit

Permalink
fix(Dashboard): Update line and table widget threashold 'to' and 'fro…
Browse files Browse the repository at this point in the history
…m' feilds data type from int to float

Updated the data type for the "to" and "From" feilds in "Threashold" in line and table widget from int to float(GitHub #2703)
  • Loading branch information
vagrawal-newrelic committed Jul 11, 2024
1 parent 3d498a3 commit c247baf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
8 changes: 4 additions & 4 deletions newrelic/resource_newrelic_one_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,12 @@ func dashboardWidgetLineSchemaElem() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"from": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Optional: true,
Description: "The number from which the range starts in thresholds.",
},
"to": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Optional: true,
Description: "The number at which the range ends in thresholds.",
},
Expand Down Expand Up @@ -697,12 +697,12 @@ func dashboardWidgetTableSchemaElem() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"from": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Optional: true,
Description: "The number from which the range starts in thresholds.",
},
"to": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Optional: true,
Description: "The number at which the range ends in thresholds.",
},
Expand Down
20 changes: 16 additions & 4 deletions newrelic/resource_newrelic_one_dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,12 @@ func testAccCheckNewRelicOneDashboardConfig_PageFull(pageName string, accountID
y_axis_right_zero = false
y_axis_right_series = ["A", "B"]
}
threshold {
name = "Duration Threshold"
from = 10.8
to = 30.7
severity = "critical"
}
}
widget_markdown {
Expand Down Expand Up @@ -762,8 +768,8 @@ func testAccCheckNewRelicOneDashboardConfig_PageFull(pageName string, accountID
query = "FROM Transaction SELECT average(duration) FACET appName"
}
threshold {
from = 100
to = 200
from = 100.1
to = 200.2
column_name = "C1"
severity = "unavailable"
}
Expand Down Expand Up @@ -961,8 +967,8 @@ func testAccCheckNewRelicOneDashboardConfig_PageFullChanged(pageName string, acc
y_axis_left_max = 25
is_label_visible = true
threshold {
from = 100
to = 200
from = 100.1
to = 200.2
name = "T1"
severity = "warning"
}
Expand Down Expand Up @@ -1004,6 +1010,12 @@ func testAccCheckNewRelicOneDashboardConfig_PageFullChanged(pageName string, acc
nrql_query {
query = "FROM Transaction SELECT average(duration) FACET appName LIMIT 10"
}
threshold {
from = 100.2
to = 200.4
column_name = "C1"
severity = "unavailable"
}
linked_entity_guids = ["MjUyMDUyOHxWSVp8REFTSEJPQVJEfDE2NDYzMDQ"]
}
Expand Down
8 changes: 4 additions & 4 deletions newrelic/structures_newrelic_one_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,11 @@ func expandDashboardLineWidgetConfigurationThresholdInput(d *schema.ResourceData
// and assign them to respective attributes of the DashboardLineWidgetThresholdThresholdInput object

if v, ok := lineWidgetThresholdInInputSingularInterface["from"]; ok {
t := v.(int)
t := v.(float64)
lineWidgetThresholdToBeAdded.From = &t

Check failure on line 508 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 508 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 508 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (1.21.x, ubuntu-latest)

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 508 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 508 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 508 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 508 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 508 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (1.21.x, macos-latest)

cannot use &t (value of type *float64) as *int value in assignment
}
if v, ok := lineWidgetThresholdInInputSingularInterface["to"]; ok {
t := v.(int)
t := v.(float64)
lineWidgetThresholdToBeAdded.To = &t

Check failure on line 512 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 512 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 512 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (1.21.x, ubuntu-latest)

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 512 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 512 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 512 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 512 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 512 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (1.21.x, macos-latest)

cannot use &t (value of type *float64) as *int value in assignment
}
if v, ok := lineWidgetThresholdInInputSingularInterface["name"]; ok {
Expand Down Expand Up @@ -559,11 +559,11 @@ func expandDashboardTableWidgetConfigurationThresholdInput(d *schema.ResourceDat
// and assign them to respective attributes of the DashboardTableWidgetThresholdInput object

if v, ok := tableWidgetThresholdInInputSingularInterface["from"]; ok {
t := v.(int)
t := v.(float64)
tableWidgetThresholdToBeAdded.From = &t

Check failure on line 563 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 563 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 563 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (1.21.x, ubuntu-latest)

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 563 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 563 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 563 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 563 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 563 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (1.21.x, macos-latest)

cannot use &t (value of type *float64) as *int value in assignment
}
if v, ok := tableWidgetThresholdInInputSingularInterface["to"]; ok {
t := v.(int)
t := v.(float64)
tableWidgetThresholdToBeAdded.To = &t

Check failure on line 567 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 567 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-unit

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 567 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (1.21.x, ubuntu-latest)

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 567 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 567 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / test-integration

cannot use &t (value of type *float64) as *int value in assignment

Check failure on line 567 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &t (value of type *float64) as *int value in assignment) (typecheck)

Check failure on line 567 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / lint

cannot use &t (value of type *float64) as *int value in assignment (typecheck)

Check failure on line 567 in newrelic/structures_newrelic_one_dashboard.go

View workflow job for this annotation

GitHub Actions / compile (1.21.x, macos-latest)

cannot use &t (value of type *float64) as *int value in assignment
}
if v, ok := tableWidgetThresholdInInputSingularInterface["column_name"]; ok {
Expand Down

0 comments on commit c247baf

Please sign in to comment.