From 87d83ea2df47d7623ba41b9d9e48399ff97a3afa Mon Sep 17 00:00:00 2001 From: roll Date: Thu, 26 Dec 2024 08:54:36 +0000 Subject: [PATCH] Improve report panel large cells handling (#698) * Improve report panel large cells handling * Increased max tooltip width * Fixed geometry * Skip false positive failing tests --- client/components/Application/Content.tsx | 22 +++++++++++-------- client/components/Application/Layout.tsx | 9 +++++++- client/components/Application/Sidebar.tsx | 1 + .../Controllers/Base/Panels/Report.tsx | 2 +- client/components/Parts/Tooltips/Light.tsx | 15 +++++++++---- client/components/Views/Report/Table.tsx | 15 ++++++++++++- server/endpoints/file/__spec__/test_fetch.py | 6 +++-- 7 files changed, 52 insertions(+), 18 deletions(-) diff --git a/client/components/Application/Content.tsx b/client/components/Application/Content.tsx index ca84cacd..97340651 100644 --- a/client/components/Application/Content.tsx +++ b/client/components/Application/Content.tsx @@ -19,12 +19,18 @@ export default function Content() { const indexing = store.useStore((state) => state.indexing) const path = store.useStore((state) => state.path) - return indexing ? ( - - ) : record && path ? ( - - ) : ( - + const Content = indexing ? LoadingContent : record && path ? FileContent : EmptyContent + + return ( + + + ) } @@ -66,9 +72,7 @@ function FileContent() { store.onFileLeave() }} > - - - + ) diff --git a/client/components/Application/Layout.tsx b/client/components/Application/Layout.tsx index f47429c3..433ed5b1 100644 --- a/client/components/Application/Layout.tsx +++ b/client/components/Application/Layout.tsx @@ -17,7 +17,14 @@ export default function Layout() { - + diff --git a/client/components/Application/Sidebar.tsx b/client/components/Application/Sidebar.tsx index 6d1503fc..c1851381 100644 --- a/client/components/Application/Sidebar.tsx +++ b/client/components/Application/Sidebar.tsx @@ -21,6 +21,7 @@ export default function Sidebar() { id="sidebar" sx={{ height: '100vh', + overflow: 'hidden', borderRight: 'solid 1px #ddd', }} > diff --git a/client/components/Controllers/Base/Panels/Report.tsx b/client/components/Controllers/Base/Panels/Report.tsx index 39b57efc..2fa16c62 100644 --- a/client/components/Controllers/Base/Panels/Report.tsx +++ b/client/components/Controllers/Base/Panels/Report.tsx @@ -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 diff --git a/client/components/Parts/Tooltips/Light.tsx b/client/components/Parts/Tooltips/Light.tsx index 47cf03be..a780ce0f 100644 --- a/client/components/Parts/Tooltips/Light.tsx +++ b/client/components/Parts/Tooltips/Light.tsx @@ -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) => ( - + ))(({ 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, diff --git a/client/components/Views/Report/Table.tsx b/client/components/Views/Report/Table.tsx index 07c72bc0..ae9a6637 100644 --- a/client/components/Views/Report/Table.tsx +++ b/client/components/Views/Report/Table.tsx @@ -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[] @@ -47,7 +49,18 @@ export default function ReportTable(props: ReportTableProps) { fail: props.data[rowNumber].errors.has(innerIndex + 1), })} > -
{value}
+ {value.length > 50 ? ( + +
+ {truncate(value, { length: 50 })} +
+
+ ) : ( +
{value}
+ )} ))} diff --git a/server/endpoints/file/__spec__/test_fetch.py b/server/endpoints/file/__spec__/test_fetch.py index ddc54ff6..ddbc0301 100644 --- a/server/endpoints/file/__spec__/test_fetch.py +++ b/server/endpoints/file/__spec__/test_fetch.py @@ -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 @@ -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