diff --git a/ui/src/app/applications/components/pod-logs-viewer/pod-logs-viewer.tsx b/ui/src/app/applications/components/pod-logs-viewer/pod-logs-viewer.tsx index 79f8a854c2def..72629d306e902 100644 --- a/ui/src/app/applications/components/pod-logs-viewer/pod-logs-viewer.tsx +++ b/ui/src/app/applications/components/pod-logs-viewer/pod-logs-viewer.tsx @@ -8,7 +8,7 @@ import {LogEntry} from '../../../shared/models'; import {services, ViewPreferences} from '../../../shared/services'; import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer'; -import List from 'react-virtualized/dist/commonjs/List'; +import Grid from 'react-virtualized/dist/commonjs/Grid'; import './pod-logs-viewer.scss'; import {CopyLogsButton} from './copy-logs-button'; @@ -26,6 +26,7 @@ import {TailSelector} from './tail-selector'; import {PodNamesToggleButton} from './pod-names-toggle-button'; import Ansi from 'ansi-to-react'; import {AutoScrollButton} from './auto-scroll-button'; +import {GridCellProps} from 'react-virtualized/dist/es/Grid'; export interface PodLogsProps { namespace: string; @@ -133,14 +134,22 @@ export const PodsLogsViewer = (props: PodLogsProps) => { // show the log content, highlight the filter text log.content?.replace(highlight, (substring: string) => whiteOnYellow + substring + reset); - const rowRenderer = ({index, key, style}: {index: number; key: string; style: React.CSSProperties}) => { + const cellRenderer = ({rowIndex, key, style}: GridCellProps) => { return (
-); }; + // calculate the width of the grid based on the longest log line + const maxWidth = + 14 * + logs + .map(renderLog) + .map(v => v.length) + .reduce((a, b) => Math.max(a, b), 0); + return ({renderLog(logs[index], index)} +{renderLog(logs[rowIndex], rowIndex)}