@@ -9,7 +9,6 @@ interface HealthContainerProps {
99 sizing : string ;
1010 colourGenerator : Function ;
1111 category : string ;
12- //currentService: string;
1312}
1413
1514interface Params {
@@ -38,10 +37,6 @@ const DockerHealthContainer: React.FC<HealthContainerProps> = React.memo(props =
3837 const [ currChunk , setCurrChunk ] = useState < JSX . Element [ ] > ( [ ] ) ;
3938 const chunkSize = 7 ;
4039 let [ isGrafana , setIsGrafana ] = useState ( false ) ;
41- /**
42- * This function filters the selectedMetrics array down to only metrics that match the category of this instance of HealthContainer.
43- * Once that has finished, it then filters the healthData down to the current category and the filteredMetrics.
44- */
4540
4641 function nextChunk ( ) {
4742 const nextChunk = healthChartsArr . slice ( currIndex , currIndex + chunkSize ) ;
@@ -55,7 +50,7 @@ const DockerHealthContainer: React.FC<HealthContainerProps> = React.memo(props =
5550 }
5651
5752 const filterSelectedMetricsAndHealthData = ( ) : DockerDataObject => {
58- // define a filtered health data object for output
53+ // define a filtered docker data object for output
5954 // define an array of filteredMetricNames for later use
6055 const filteredHealthData = { } ;
6156 const filteredMetricNames : string [ ] = [ ] ;
@@ -79,7 +74,7 @@ const DockerHealthContainer: React.FC<HealthContainerProps> = React.memo(props =
7974 filteredHealthData [ service ] = { } ;
8075 const categoryObjects = healthData [ service ] ;
8176 for ( const categoryName in categoryObjects ) {
82- // if the category in healthData matches the category passed down to this HealthContainer , iterate over the related metrics
77+ // if the category in healthData matches the category passed down to this DockerHealthContainer , iterate over the related metrics
8378 if ( categoryName === category ) {
8479 const metricObjects = categoryObjects [ categoryName ] ;
8580 for ( const metric in metricObjects ) {
@@ -107,9 +102,7 @@ const DockerHealthContainer: React.FC<HealthContainerProps> = React.memo(props =
107102
108103 // function to generate charts using the type-sorted data
109104 const generateHealthCharts = ( sortedData : DockerDataObject ) : void => {
110- //onst chartsArray: JSX.Element[] = [];
111105 const grafanaChartsArray : JSX . Element [ ] = [ ] ;
112- //let parsedName: string = '';
113106 const keymaker = ( ) => {
114107 return Math . floor ( Math . random ( ) * 1000 ) ;
115108 } ;
@@ -120,17 +113,7 @@ const DockerHealthContainer: React.FC<HealthContainerProps> = React.memo(props =
120113 // pass down the value of the current data type and service
121114 const chartData = metricObjects [ metricName ] ;
122115 const token = chartData . token ;
123- // chartsArray.push(
124- // <HealthChart
125- // key={'H' + keymaker()}
126- // dataType={dataType}
127- // serviceName={serviceName}
128- // chartData={chartData}
129- // categoryName={category}
130- // sizing={sizing}
131- // colourGenerator={colourGenerator}
132- // />
133- // );
116+
134117 console . log ( "plotting grafana" )
135118 grafanaChartsArray . push (
136119 < GrafanaEventChart metricName = { metricName } token = { token } /> ) ;
@@ -146,16 +129,12 @@ const DockerHealthContainer: React.FC<HealthContainerProps> = React.memo(props =
146129 useEffect ( ( ) => {
147130 // returns an object containing only the healthData for the current category and the metrics the User selected
148131 const filteredHealthData = filterSelectedMetricsAndHealthData ( ) ;
149- // returns an object containing the filtered data sorted by data type
150- //const typeSortedHealthData = healthDataGroupedByDataType(filteredHealthData);
151132 // invoking generateCharts with the sorted data will update healthChartsArr in state with the list of charts to be rendered
152133 generateHealthCharts ( filteredHealthData ) ;
153134 } , [ category ] ) ;
154135
155- // JJ-ADDITION
156136 return (
157137 < div >
158- { /* <div id="grafana" onClick={() => { setIsGrafana(!isGrafana) }}>Grafana</div> */ }
159138 { service . includes ( 'kafkametrics' ) || service . includes ( 'kubernetesmetrics' ) || service . includes ( 'books' ) || service . includes ( 'customers' ) || service . includes ( 'frontend' ) || service . includes ( 'orders' ) ? currChunk : [ ] }
160139 { healthChartsArr . length > chunkSize && (
161140 < >
0 commit comments