trafficcontrol
trafficcontrol copied to clipboard
buildHttpStatusChartData Cannot read property 'forEach' of null
This Bug Report affects these Traffic Control components:
- Traffic Portal
Current behavior:
The ds charts view in TP has an error if the api returns no values. Example:
https://tp.domain.tld/#!/delivery-services/42/charts?type=HTTP <-- this view calls GET /api/4.0/deliveryservice_stats
If the api endpoint returns no values (series.values = null), it will throw this error:
Cannot read property 'forEach' of null
Expected behavior:
Handle the empty value without throwing an error.
Steps to reproduce:
See current behavior
IMO a set of no results in the series is best represented by the empty set ([]
in JSON, which is actually an Array not a Set) instead of null
. But also that's partly coming from InfluxDB's enthusiastic use of null
, so idk how much we want to do about that. Though it would also solve the issue by just not needing to handle that case.
In any case, I think this is probably a three-line fix wherever it gets implemented, so I think this is probably a good first issue.
IMO a set of no results in the series is best represented by the empty set (
[]
in JSON, which is actually an Array not a Set) instead ofnull
. But also that's partly coming from InfluxDB's enthusiastic use ofnull
, so idk how much we want to do about that. Though it would also solve the issue by just not needing to handle that case.In any case, I think this is probably a three-line fix wherever it gets implemented, so I think this is probably a good first issue.
yeah, should be a simple null check
Can I pick this up? What files would I need to look at?
@mitchell852 I created a PR, please take a look!