Skip to content

Commit

Permalink
Add search capability to logviewer
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrews committed Feb 6, 2023
1 parent ff45a28 commit 617039c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"@emotion/react": "^11.10.0",
"@mui/material": "^5.10.0",
"@patternfly/react-core": "^4.276.6",
"@patternfly/react-log-viewer": "^4.87.100",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
Expand Down
27 changes: 27 additions & 0 deletions web/src/LogStationLogViewer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import {LogViewer, LogViewerSearch} from '@patternfly/react-log-viewer';
import { Toolbar, ToolbarContent, ToolbarItem } from '@patternfly/react-core';
import "@patternfly/react-core/dist/styles/base.css";

const LogStationLogViewer = (props) => {

return (
<LogViewer hasLineNumbers={false}
height={'100%'}
width={'100%'}
data={props.data}
theme={'dark'}
isTextWrapped={true}
toolbar={
<Toolbar>
<ToolbarContent>
<ToolbarItem>
<LogViewerSearch minSearchChars={2} placeholder={" search"}/>
</ToolbarItem>
</ToolbarContent>
</Toolbar>
}/>
);
};

export default LogStationLogViewer;
13 changes: 0 additions & 13 deletions web/src/LogViewerComponent.js

This file was deleted.

6 changes: 3 additions & 3 deletions web/src/MainLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './LogViewer.css';
import LogViewerComponent from "./LogViewerComponent";
import LogStationLogViewer from "./LogStationLogViewer";

import Container from '@mui/material/Container';
import Tabs from '@mui/material/Tabs';
Expand Down Expand Up @@ -36,8 +36,8 @@ const MainLayout = (props) => {
sx={{color: '#ffffff', background: '#222', textTransform: 'unset'}}/>
</Tabs>
</Box>
<Box sx={{width: '100%', height: '92vh', m: 0, p: 0}} className="LogViewer">
<LogViewerComponent data={props.lines}/>
<Box sx={{width: '100%', height: '92vh'}} className="LogViewer">
<LogStationLogViewer data={props.lines}/>
</Box>
</Container>
);
Expand Down

0 comments on commit 617039c

Please sign in to comment.