Skip to content

Commit

Permalink
Convert Log Viewer to PF Log Viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
ppadti committed Nov 27, 2023
1 parent 87936a2 commit b5712c9
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 126 deletions.
21 changes: 21 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@patternfly/react-code-editor": "^5.1.1",
"@patternfly/react-core": "^5.1.1",
"@patternfly/react-icons": "^5.1.1",
"@patternfly/react-log-viewer": "^5.0.0",
"@patternfly/react-styles": "^5.1.1",
"@patternfly/react-table": "^5.1.1",
"@patternfly/react-topology": "^5.1.0",
Expand Down
23 changes: 23 additions & 0 deletions frontend/src/concepts/dashboard/DashboardLogViewer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { LogViewer } from '@patternfly/react-log-viewer';
import React from 'react';

const DashboardLogViewer: React.FC<{
data: string;
logViewerRef: React.MutableRefObject<{ scrollToBottom: () => void } | undefined>;
toolbar: JSX.Element;
footer: JSX.Element | false;
onScroll: React.ComponentProps<typeof LogViewer>['onScroll'];
}> = ({ data, logViewerRef, toolbar, footer, onScroll }) => (
<div id="complex-toolbar-demo" style={{ height: '100%' }}>
<LogViewer
data={data}
innerRef={logViewerRef}
height={'100%'}
toolbar={toolbar}
footer={footer}
onScroll={onScroll}
/>
</div>
);

export default DashboardLogViewer;
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ const PipelineRunDrawerRightContent: React.FC<PipelineRunDrawerRightContentProps
parameters,
onClose,
}) => {
const [, setWidth] = React.useState<number>(0);

if (!task) {
return null;
}

return (
<DrawerPanelContent
onResize={(_event: MouseEvent | TouchEvent | React.KeyboardEvent, newWidth: number) => {
setWidth(newWidth);
}}
isResizable
widths={{ default: 'width_33', lg: 'width_50' }}
minSize="400px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const PipelineRunDrawerRightTabs: React.FC<PipelineRunDrawerRightTabsProps> = ({
taskReferences,
parameters,
}) => {
const [selection, setSelection] = React.useState(PipelineRunNodeTabs.INPUT_OUTPUT);
const [selection, setSelection] = React.useState(PipelineRunNodeTabs.LOGS);

const tabContentProps = (tab: PipelineRunNodeTabs): React.ComponentProps<typeof TabContent> => ({
id: tab,
Expand Down
Loading

0 comments on commit b5712c9

Please sign in to comment.