Skip to content

Commit

Permalink
Improve report panel large cells handling (#698)
Browse files Browse the repository at this point in the history
* Improve report panel large cells handling

* Increased max tooltip width

* Fixed geometry

* Skip false positive failing tests
  • Loading branch information
roll authored Dec 26, 2024
1 parent a2565f5 commit 87d83ea
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 18 deletions.
22 changes: 13 additions & 9 deletions client/components/Application/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ export default function Content() {
const indexing = store.useStore((state) => state.indexing)
const path = store.useStore((state) => state.path)

return indexing ? (
<LoadingContent />
) : record && path ? (
<FileContent />
) : (
<EmptyContent />
const Content = indexing ? LoadingContent : record && path ? FileContent : EmptyContent

return (
<Box
id="content"
sx={{
height: '100vh',
overflow: 'hidden',
}}
>
<Content />
</Box>
)
}

Expand Down Expand Up @@ -66,9 +72,7 @@ function FileContent() {
store.onFileLeave()
}}
>
<Box>
<Controller />
</Box>
<Controller />
</ClickAwayListener>
</ErrorBoundary>
)
Expand Down
9 changes: 8 additions & 1 deletion client/components/Application/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ export default function Layout() {
<React.Fragment>
<Error />
<Dialog />
<Box sx={{ display: 'grid', gridTemplateColumns: `${fileMenuWidth}px 1fr` }}>
<Box
sx={{
height: '100vh',
overflow: 'hidden',
display: 'grid',
gridTemplateColumns: `${fileMenuWidth}px 1fr`,
}}
>
<Sidebar />
<Content />
</Box>
Expand Down
1 change: 1 addition & 0 deletions client/components/Application/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function Sidebar() {
id="sidebar"
sx={{
height: '100vh',
overflow: 'hidden',
borderRight: 'solid 1px #ddd',
}}
>
Expand Down
2 changes: 1 addition & 1 deletion client/components/Controllers/Base/Panels/Report.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Box from '@mui/material/Box'
import Report from '../../../Views/Report'
import * as types from '../../../../types'
import Report from '../../../Views/Report'

export interface ReportPanelProps {
report?: types.IReport
Expand Down
15 changes: 11 additions & 4 deletions client/components/Parts/Tooltips/Light.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import { styled } from '@mui/material/styles'
import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip'
import { styled } from '@mui/material/styles'

interface AllTooltipProps extends TooltipProps {
type?: string
}

export default styled(({ className, ...props }: AllTooltipProps) => (
<Tooltip arrow {...props} classes={{ popper: className }} TransitionProps={{ timeout: 0 }} placement="bottom" />
<Tooltip
arrow
classes={{ popper: className }}
TransitionProps={{ timeout: 0 }}
placement="bottom"
{...props}
/>
))(({ theme, type }) => ({
[`& .${tooltipClasses.tooltip}`]: {
backgroundColor: type == 'fileMenu' ? theme.palette.OKFNCoolGray.main : theme.palette.common.white,
backgroundColor:
type == 'fileMenu' ? theme.palette.OKFNCoolGray.main : theme.palette.common.white,
color: type == 'fileMenu' ? theme.palette.common.white : 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 16,
maxWidth: type == 'fileMenu' ? 600: null
maxWidth: '50vw',
},
[`& .${tooltipClasses.arrow}`]: {
color: theme.palette.OKFNCoolGray.main,
Expand Down
15 changes: 14 additions & 1 deletion client/components/Views/Report/Table.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import classNames from 'classnames'
import { truncate } from 'lodash'
import { useTranslation } from 'react-i18next'
import LightTooltip from '../../Parts/Tooltips/Light'

export interface ReportTableProps {
tags: string[]
Expand Down Expand Up @@ -47,7 +49,18 @@ export default function ReportTable(props: ReportTableProps) {
fail: props.data[rowNumber].errors.has(innerIndex + 1),
})}
>
<div className="cell-content">{value}</div>
{value.length > 50 ? (
<LightTooltip title={truncate(value, { length: 1000 })}>
<div
className="cell-content"
style={{ lineClamp: 1, cursor: 'pointer' }}
>
{truncate(value, { length: 50 })}
</div>
</LightTooltip>
) : (
<div className="cell-content">{value}</div>
)}
</td>
))}
</tr>
Expand Down
6 changes: 4 additions & 2 deletions server/endpoints/file/__spec__/test_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# Action


@pytest.mark.skip
@pytest.mark.skip(reason="Pytest-vcr new version bug")
@pytest.mark.vcr
def test_server_file_fetch(client):
client("/file/fetch", url=url1)
assert client("/file/read", path=url1name).bytes == url1bytes
Expand All @@ -17,7 +18,8 @@ def test_server_file_fetch(client):
]


@pytest.mark.skip
@pytest.mark.skip(reason="Pytest-vcr new version bug")
@pytest.mark.vcr
def test_server_file_fetch_to_folder(client):
client("/folder/create", path=folder1)
path = client("/file/fetch", url=url1, folder=folder1).path
Expand Down

0 comments on commit 87d83ea

Please sign in to comment.