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 2eaf8103fcb63..30b101eecc4f8 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,6 @@ import {LogEntry} from '../../../shared/models';
import {services, ViewPreferences} from '../../../shared/services';
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';
-import Grid from 'react-virtualized/dist/commonjs/Grid';
import './pod-logs-viewer.scss';
import {CopyLogsButton} from './copy-logs-button';
@@ -24,9 +23,9 @@ import {LogMessageFilter} from './log-message-filter';
import {SinceSecondsSelector} from './since-seconds-selector';
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';
+import {WrapLinesButton} from './wrap-lines-button';
+import Ansi from 'ansi-to-react';
export interface PodLogsProps {
namespace: string;
@@ -133,22 +132,15 @@ export const PodsLogsViewer = (props: PodLogsProps) => {
(viewTimestamps ? (lineNum === 0 || (logs[lineNum - 1].timeStamp !== log.timeStamp ? log.timeStampStr : '').padEnd(30)) + ' ' : '') +
// show the log content, highlight the filter text
log.content?.replace(highlight, (substring: string) => whiteOnYellow + substring + reset);
-
- const cellRenderer = ({rowIndex, key, style}: GridCellProps) => {
- return (
-
- {renderLog(logs[rowIndex], rowIndex)}
-
- );
- };
-
- // 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);
+ const logsContent = (width: number, height: number, isWrapped: boolean) => (
+
+ {logs.map((log, lineNum) => (
+
+ {renderLog(log, lineNum)}
+
+ ))}
+
+ );
return (
services.viewPreferences.getPreferences()}>
@@ -173,6 +165,7 @@ export const PodsLogsViewer = (props: PodLogsProps) => {
+
@@ -189,20 +182,7 @@ export const PodsLogsViewer = (props: PodLogsProps) => {
onWheel={e => {
if (e.deltaY < 0) setScrollToBottom(false);
}}>
-
- {({width, height}: {width: number; height: number}) => (
-
- )}
-
+ {({width, height}: {width: number; height: number}) => logsContent(width, height, prefs.appDetails.wrapLines)}
);
diff --git a/ui/src/app/applications/components/pod-logs-viewer/wrap-lines-button.tsx b/ui/src/app/applications/components/pod-logs-viewer/wrap-lines-button.tsx
new file mode 100644
index 0000000000000..9caee043fdd39
--- /dev/null
+++ b/ui/src/app/applications/components/pod-logs-viewer/wrap-lines-button.tsx
@@ -0,0 +1,17 @@
+import {services, ViewPreferences} from '../../../shared/services';
+import * as React from 'react';
+import {ToggleButton} from '../../../shared/components/toggle-button';
+
+// WrapLinesButton is a component that wraps log lines.
+export const WrapLinesButton = ({prefs}: {prefs: ViewPreferences}) => (
+ {
+ const wrap = prefs.appDetails.wrapLines;
+ services.viewPreferences.updatePreferences({...prefs, appDetails: {...prefs.appDetails, wrapLines: !wrap}});
+ }}
+ toggled={prefs.appDetails.wrapLines}
+ icon='share'
+ rotate={true}
+ />
+);
diff --git a/ui/src/app/shared/components/button.tsx b/ui/src/app/shared/components/button.tsx
index 33b9b30da48da..8530f3492a738 100644
--- a/ui/src/app/shared/components/button.tsx
+++ b/ui/src/app/shared/components/button.tsx
@@ -12,7 +12,8 @@ export const Button = ({
className,
style,
disabled,
- beat
+ beat,
+ rotate
}: {
onClick?: MouseEventHandler;
children?: ReactNode;
@@ -23,13 +24,14 @@ export const Button = ({
style?: CSSProperties;
disabled?: boolean;
beat?: boolean;
+ rotate?: boolean;
}) => (
);
diff --git a/ui/src/app/shared/components/toggle-button.tsx b/ui/src/app/shared/components/toggle-button.tsx
index af2b7a4c54275..eb0957b87bb05 100644
--- a/ui/src/app/shared/components/toggle-button.tsx
+++ b/ui/src/app/shared/components/toggle-button.tsx
@@ -11,7 +11,8 @@ export const ToggleButton = ({
toggled,
beat,
disabled,
- icon
+ icon,
+ rotate
}: {
toggled: boolean;
beat?: boolean;
@@ -20,11 +21,13 @@ export const ToggleButton = ({
title: string;
disabled?: boolean;
icon: Icon;
+ rotate?: boolean;
}) => (