@@ -44,23 +44,25 @@ const HealthContainer: React.FC<HealthContainerProps> = React.memo(props => {
44
44
45
45
datalist . forEach ( ( element : { } ) => {
46
46
const categoryName : string = Object . keys ( element ) [ 0 ] ;
47
- // 'element' is the category found in the datalist response from the server query for metrics data
48
- // the above forEach method loops through the different categories
49
- // 'category' variable is the specific category passed in to HealthContainer via prop drilling
50
- // 'category' is the string Memory, CPU, or others that are in the Category column of the Query Selector interface
51
- // 'categoryName' is the string that is Memory/CPU/other inside the metrics data response ('datalist' or 'timelist')
52
- // when the 'element'/'categoryName' matches the 'category' selected in the Query Selection interface...
53
- // ... it will dive into that Category object to pull out a chart for each metric selected in the selection interface
54
- // selectedMetricsList is derived from the selectedMetrics that were in the QueryContext
55
- // selectedMetricsList is how we know which metrics should be made into a chart
56
- // selectedMetricsList is the way we can give one chart the multiple metrics being requested
47
+ /*
48
+ 'element' is the category found in the datalist response from the server query for metrics data.
49
+ The above forEach method loops through the different categories.
50
+ The 'category' variable is the specific category passed in to HealthContainer via prop drilling.
51
+ The 'category' is the string Memory, CPU, or others that are in the Category column of the Query Selector interface.
52
+ The 'categoryName' is the string that is Memory/CPU/other inside the metrics data response ('datalist' or 'timelist').
53
+ When the 'element'/'categoryName' matches the 'category' selected in the Query Selection interface...
54
+ ... it will dive into that Category object to pull out a chart for each metric selected in the selection interface.
55
+ selectedMetricsList is derived from the selectedMetrics that were in the QueryContext.
56
+ selectedMetricsList is how we know which metrics should be made into a chart.
57
+ selectedMetricsList is the way we can give one chart the multiple metrics being requested.
58
+ */
57
59
if ( category === categoryName ) {
58
60
const categoryObj : [ ] = element [ categoryName ] ;
59
61
for ( const metricObj of categoryObj ) {
60
62
const serviceName : string = Object . keys ( metricObj ) [ 0 ] ;
61
- const serviceValArr : any [ ] = Object . values ( metricObj ) ;
62
- const serviceVals : any [ ] = serviceValArr [ 0 ] ;
63
- for ( const serviceMetric of serviceVals ) {
63
+ const serviceMetricsArr : any [ ] = Object . values ( metricObj ) . flat ( ) ;
64
+ console . log ( 'serviceMetricsArr: ' , serviceMetricsArr ) ; // -> array of objects.
65
+ for ( const serviceMetric of serviceMetricsArr ) {
64
66
const metric : string = Object . keys ( serviceMetric ) [ 0 ] ;
65
67
const valueList = Object . values ( serviceMetric ) [ 0 ] ;
66
68
const newTimeList : any = getTime ( timelist , serviceName , metric , categoryName ) ;
0 commit comments