Skip to content

Commit 38ef694

Browse files
committed
query init complete && fix config.yaml
1 parent 9ccfbd5 commit 38ef694

File tree

5 files changed

+26
-17
lines changed

5 files changed

+26
-17
lines changed

app/components/TransferColumns.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,18 @@ const TransferColumns = React.memo(() => {
135135

136136
}
137137
else{
138+
console.log("healthData in else:", healthDataList.length);
139+
console.log("eventData in else:", eventDataList.length);
138140
if(healthDataList && healthDataList.length >0 && eventDataList && eventDataList.length >0){
141+
console.log("eventDataList:", eventDataList.length);
142+
console.log("healthDataList", healthDataList.length);
139143
setMetricsPool(getMetrics('event',eventDataList).concat(getMetrics('health',healthDataList)));
140144
}
141-
else{
145+
else if(healthMetricsReady && eventMetricsReady){
142146
console.log("set concat metrics:", JSON.stringify(eventMetrics.concat(healthMetrics)));
143147
setMetricsPool(eventMetrics.concat(healthMetrics));
144148
}
149+
console.log("here");
145150

146151

147152
}

app/containers/GraphsContainer.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,27 @@ const GraphsContainer: React.FC<GraphsContainerProps> = React.memo(props => {
6666

6767
useEffect(() => {
6868
const serviceArray = service.split(' ');
69-
70-
69+
const healthServiceArray = serviceArray.filter((value : string) => value !== 'kafkametrics');
70+
// console.log("service array:", JSON.stringify(serviceArray));
71+
// console.log("health service array:", JSON.stringify(healthServiceArray));
7172
if (live) {
7273
setIntervalID(
7374
setInterval(() => {
7475
fetchCommsData(app, live);
75-
fetchHealthData(serviceArray);
76-
fetchEventData(serviceArray[0]);
76+
fetchHealthData(healthServiceArray);
77+
if(service.includes('kafkametrics')){
78+
fetchEventData('kafkametrics');
79+
}
80+
7781
}, 3000)
7882
);
7983
} else {
8084
if (intervalID) clearInterval(intervalID);
8185
fetchCommsData(app, live);
82-
fetchHealthData(serviceArray);
83-
fetchEventData(serviceArray[0]);
86+
fetchHealthData(healthServiceArray);
87+
if(service.includes('kafkametrics')){
88+
fetchEventData();
89+
}
8490
}
8591

8692
return () => {

app/context/EventContext.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const EventContextProvider: React.FC = React.memo(({ children }) => {
1919

2020
function tryParseJSON(jsonString: any) {
2121
try {
22-
// console.log("jsonString at EventContext:", jsonString);
22+
console.log("jsonString at EventContext:", jsonString);
2323
const o = JSON.parse(jsonString);
2424
if (o && typeof o === 'object') {
2525
return true;
@@ -30,8 +30,8 @@ const EventContextProvider: React.FC = React.memo(({ children }) => {
3030
return false;
3131
}
3232

33-
const fetchEventData = useCallback((serv) => {
34-
if(serv === 'kafkametrics'){
33+
const fetchEventData = useCallback(() => {
34+
// if(serv === 'kafkametrics'){
3535
// console.log("in fetchEventData in EventContext!!");
3636
ipcRenderer.removeAllListeners('kafkaResponse');
3737
ipcRenderer.send('kafkaRequest');
@@ -49,7 +49,7 @@ const EventContextProvider: React.FC = React.memo(({ children }) => {
4949

5050
});
5151

52-
}
52+
// }
5353

5454

5555
}, []);

app/context/HealthContext.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export const HealthContext = React.createContext<any>(null);
1818
const HealthContextProvider: React.FC = React.memo(({ children }) => {
1919
const [healthData, setHealthData] = useState<any>({"healthDataList":[], "healthTimeList":[]});
2020
const [services, setServices] = useState<Array<string>>([]);
21-
// const [datalist, setDataList] = useState<Array<any>>([]);
22-
// const [timelist, setTimeList] = useState<Array<any>>([]);
2321

2422
function tryParseJSON(jsonString: any) {
2523
try {
@@ -36,7 +34,7 @@ const HealthContextProvider: React.FC = React.memo(({ children }) => {
3634
}
3735

3836
const fetchHealthData = useCallback(serv => {
39-
//setServices(serv);
37+
4038
ipcRenderer.removeAllListeners('healthResponse');
4139

4240
let temp: any[] = [];
@@ -63,10 +61,10 @@ const HealthContextProvider: React.FC = React.memo(({ children }) => {
6361
});
6462

6563
}).then((dt: any) => {
66-
if(service !== 'kafkametrics'){
64+
6765
temp.push(dt);
6866
// console.log("temp is:", JSON.stringify(temp));
69-
}
67+
7068
if (checkServicesComplete(temp, serv)) {
7169

7270
setServices(serv);

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
hostPort: 9000
1+
hostPort: localhost:9000
22
lowercaseOutputName: true
33
rules:
44
- pattern: kafka.server<type=ReplicaManager, name=UnderReplicatedPartitions><>Value

0 commit comments

Comments
 (0)