Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrap text option for pipeline run logs #2616

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/src/concepts/dashboard/DashboardLogViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const DashboardLogViewer: React.FC<{
footer: JSX.Element | false;
onScroll: React.ComponentProps<typeof LogViewer>['onScroll'];
height?: number | string;
}> = ({ data, logViewerRef, toolbar, footer, onScroll, height = '100%' }) => (
isTextWrapped?: boolean;
}> = ({ data, logViewerRef, toolbar, footer, onScroll, height = '100%', isTextWrapped }) => (
<LogViewer
data-testid="logs"
hasLineNumbers={false}
Expand All @@ -18,6 +19,7 @@ const DashboardLogViewer: React.FC<{
toolbar={toolbar}
footer={footer}
onScroll={onScroll}
isTextWrapped={isTextWrapped}
/>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect } from 'react';
import {
Button,
Checkbox,
DropdownList,
Icon,
Spinner,
Expand Down Expand Up @@ -89,6 +90,7 @@ const LogsTabForPodName: React.FC<{ podName: string; isFailedPod: boolean }> = (
const [isFullScreen, setIsFullScreen] = React.useState(false);
const [showSearchbar, setShowsearchbar] = React.useState(false);
const [isKebabOpen, setIsKebabOpen] = React.useState(false);
const [isTextWrapped, setIsTextWrapped] = React.useState(true);

const logsTabRef = React.useRef<HTMLDivElement>(null);
const dispatchResizeEvent = useDebounceCallback(
Expand Down Expand Up @@ -229,6 +231,7 @@ const LogsTabForPodName: React.FC<{ podName: string; isFailedPod: boolean }> = (
height="calc(100% - 75px)"
data={data}
logViewerRef={logViewerRef}
isTextWrapped={isTextWrapped}
toolbar={
!error && (
<Toolbar className={isFullScreen ? 'pf-v5-u-p-sm' : ''}>
Expand Down Expand Up @@ -309,6 +312,15 @@ const LogsTabForPodName: React.FC<{ podName: string; isFailedPod: boolean }> = (
)}
</ToolbarGroup>
<ToolbarGroup align={{ default: 'alignRight' }}>
<ToolbarItem alignSelf="center">
<Checkbox
label="Wrap text"
aria-label="wrap text checkbox"
isChecked={isTextWrapped}
id="wrap-text-checkbox"
onChange={(_event, value) => setIsTextWrapped(value)}
/>
</ToolbarItem>
<ToolbarItem spacer={{ default: 'spacerNone' }}>
{downloading && <Spinner size="sm" className="pf-v5-u-my-sm" />}
{podContainers.length <= 1 ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ const LogsTabStatus: React.FC<LogsTabStatusProps> = ({
>
<p>
The log refreshes every {Math.floor(LOG_REFRESH_RATE / 1000)} seconds and displays the
latest {LOG_TAIL_LINES} lines. Exceptionally long lines are abridged. To view the full log
for this task, you can{' '}
latest {LOG_TAIL_LINES} lines. To view the full log for this task, you can{' '}
<Button isDisabled={!isLogsAvailable} variant="link" isInline onClick={onDownload}>
download all step logs
</Button>{' '}
Expand Down
Loading