Drop unused useLogs and logsSourceLabel

Nothing imports either; useServiceLogStream replaced the hook, which
also left loading stuck on a read error.
This commit is contained in:
Juan Denis committed 2026-10-26 01:02:37 -04:00
1 parent 411ce694da
commit 0704c42daa
2 files changed
-47

No files matched your search

-40
View File
@@ -58,44 +58,4 @@ export function useMetrics(useWebSocket = true, pollInterval = DEFAULT_POLL_INTE
return { metrics, loading, error, connected, refresh: fetchMetrics };
}
export function useLogs(filepath) {
const [logs, setLogs] = useState([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
if (!filepath) return;
// Fetch initial logs
api.readLog(filepath, 100).then(result => {
if (result.success) {
setLogs(result.lines);
}
setLoading(false);
});
// Connect WebSocket for real-time updates
socketService.connect();
const unsubLine = socketService.on('log_line', (data) => {
if (data.filepath === filepath) {
setLogs(prev => [...prev.slice(-499), data.line]);
}
});
// Subscribe to log stream
socketService.subscribeLogs(filepath);
return () => {
unsubLine();
socketService.unsubscribeLogs();
};
}, [filepath]);
const clearLogs = useCallback(() => {
setLogs([]);
}, []);
return { logs, loading, clearLogs };
}
export default useMetrics;
-7
View File
@@ -22,10 +22,3 @@ export function logsToText(data) {
}
return '';
}
// Which backend the output came from ('Docker Compose', 'Docker Compose
// (legacy)', ...), when the response says. Worth showing: it explains an empty
// log more often than the log itself does.
export function logsSourceLabel(data) {
return (data && typeof data === 'object' && data.source_label) || '';
}