Skip to content

Commit 6922aa7

Browse files
committed
finish event charts and health charts test
1 parent 38ef694 commit 6922aa7

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

app/components/TransferColumns.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useState, useContext, useEffect, useRef } from 'react';
2-
import { useIsMount } from '../context/helpers';
32
import { useParams } from 'react-router-dom';
43
import 'antd/dist/antd.less';
54
import { Switch, Table, Tag, Transfer, Button } from 'antd';

app/containers/EventContainer.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useState, useContext } from 'react';
2-
//import EventContext, EventChart
2+
import { useParams } from 'react-router-dom';
33
import { EventContext } from '../context/EventContext';
44
import { QueryContext } from '../context/QueryContext';
55
import EventChart from '../charts/EventChart';
@@ -21,10 +21,12 @@ const EventContainer: React.FC<EventContainerProps> = React.memo(props => {
2121
const { selectedMetrics } = useContext(QueryContext);
2222
const eventDataList : any[] = eventData.eventDataList;
2323
const eventTimeList : any[] = eventData.eventTimeList;
24+
const { service } = useParams<any>();
25+
2426

2527
useEffect(() => {
2628
const temp : JSX.Element[] = [];
27-
29+
console.log("service in event container", service);
2830
if (eventData && eventDataList.length > 0 && eventTimeList.length >0) {
2931
// console.log("eventDataList in EventContainer:");
3032
// console.log(JSON.stringify(eventDataList));
@@ -62,7 +64,7 @@ const EventContainer: React.FC<EventContainerProps> = React.memo(props => {
6264
});
6365
setEventChartsArr(temp);
6466
}
65-
}, [eventData]);
67+
}, [eventData, service]);
6668

6769
const getSingleTimeList = (metricName: string) => {
6870
//[{metric1: [3,6,8...]}, {metric2: [3,6,8...]}]
@@ -81,7 +83,7 @@ const EventContainer: React.FC<EventContainerProps> = React.memo(props => {
8183

8284
};
8385

84-
return <div>{eventChartsArr}</div>;
86+
return <div>{service.includes('kafkametrics')? eventChartsArr : []}</div>;
8587
});
8688

8789
export default EventContainer;

app/containers/HealthContainer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { HealthContext } from '../context/HealthContext';
33
import { QueryContext } from '../context/QueryContext';
44
import HealthChart from '../charts/HealthChart';
55
import { getTime } from '../context/helpers';
6+
import { useParams } from 'react-router-dom';
67

78
interface HealthContainerProps {
89
sizing: string;
@@ -18,7 +19,7 @@ const HealthContainer: React.FC<HealthContainerProps> = React.memo(props => {
1819
const {selectedMetrics} = useContext(QueryContext);
1920
const [healthChartsArr, setHealthChartsArr] = useState<JSX.Element[]>([]);
2021
const { category } = props;
21-
22+
const { service } = useParams<any>();
2223

2324
// console.log("HC-healthData in HealthContainer:", JSON.stringify(healthData));
2425
// console.log("HC-datalist in HealthContainer:", JSON.stringify(healthData.healthDataList));
@@ -98,7 +99,7 @@ const HealthContainer: React.FC<HealthContainerProps> = React.memo(props => {
9899

99100
}, [healthData, category]); //add category here
100101

101-
return <div>{healthChartsArr}</div>;
102+
return <div>{service !== 'kafkametrics' ? healthChartsArr : []}</div>;
102103
});
103104

104105
export default HealthContainer;

app/context/helpers.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,4 @@ export function getTime(timeList, currService, metric, category) {
113113
}
114114
});
115115
return res;
116-
}
117-
export const useIsMount = () => {
118-
const isMountRef = useRef(true);
119-
useEffect(() => {
120-
isMountRef.current = false;
121-
}, []);
122-
return isMountRef.current;
123-
};
116+
}

0 commit comments

Comments
 (0)