Skip to content

Commit 3bf051e

Browse files
committed
added polling by using setInterval function within useEffect
1 parent 3073e7f commit 3bf051e

8 files changed

+7
-3
lines changed

karmada_agent.db

192 KB
Binary file not shown.

karmada_controller_manager.db

548 KB
Binary file not shown.

karmada_scheduler.db

100 KB
Binary file not shown.

karmada_scheduler.db-journal

40.6 KB
Binary file not shown.
96 KB
Binary file not shown.
80 KB
Binary file not shown.
72 KB
Binary file not shown.

ui/apps/dashboard/src/pages/metrics/diagram.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ const Diagram: React.FC<MetricTabsProps> = ({ activeTab, setActiveTab, component
2929
setLogs(null); // Optionally clear logs on error
3030
}
3131
};
32-
32+
3333
useEffect(() => {
3434
if (componentName && podsName && metricName) {
35-
getLogs(componentName, podsName, metricName);
35+
const intervalId = setInterval(() => {
36+
getLogs(componentName, podsName, metricName);
37+
}, 5000); // Poll every 5 seconds
38+
39+
return () => clearInterval(intervalId); // Cleanup on unmount
3640
} else {
3741
setLogs(null);
3842
}
39-
}, [componentName, podsName, metricName]); // Removed lastUpdated
43+
}, [componentName, podsName, metricName]);
4044

4145
const showModal = () => {
4246
setVisible(true);

0 commit comments

Comments
 (0)