Skip to content

Commit

Permalink
Merge branch 'main' into 416/export-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Dec 26, 2024
2 parents 3c83192 + 87d83ea commit be046ff
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 31 deletions.
3 changes: 0 additions & 3 deletions client/assets/delete_icon.svg

This file was deleted.

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
18 changes: 15 additions & 3 deletions client/components/Editors/Base/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from '@mui/material/Button'
import Typography from '@mui/material/Typography'
import { useTheme } from '@mui/material/styles'
import { useTranslation } from 'react-i18next'
import deleteIcon from '../../../assets/delete_icon.svg'
import DeleteIcon from '../../Parts/Icons/DeleteIcon'

interface EditorListItemProps {
kind: string
Expand All @@ -31,16 +31,19 @@ export default function EditorListItem(props: EditorListItemProps) {
component="span"
title={`${t('remove')} ${capitalize(props.kind)}`}
sx={{
'& img': {
'& svg': {
width: '22px',
'&:hover': {
fill: (theme) => theme.palette.OKFNRed500.main,
},
},
}}
onClick={(ev) => {
ev.stopPropagation()
props.onRemoveClick?.()
}}
>
<img src={deleteIcon} alt="" />
<DeleteIcon color="OKFNGray700" />
</Button>
)
}
Expand Down Expand Up @@ -70,6 +73,15 @@ export default function EditorListItem(props: EditorListItemProps) {
padding: '12px 16px',
whiteSpace: 'nowrap',
borderColor: '#E6E7EB',
animation: 'highlight 3s ease-in-out',
'@keyframes highlight': {
'0%': {
borderColor: (theme) => theme.palette.OKFNBlue.main,
},
'100%': {
borderColor: '#E6E7EB',
},
},
'&:hover': {
borderColor: (theme) => theme.palette.OKFNBlue.main,
},
Expand Down
10 changes: 8 additions & 2 deletions client/components/Editors/Resource/Sections/Licenses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function LicenseList() {

return (
<>
<EditorList kind="license" query={query}>
<EditorList
kind="license"
query={query}
onAddClick={licenseItems.length > 0 ? () => setDialogOpen(true) : null}
>
<EditorHelp helpItem={helpItem} withIcon />
{licenseItems.length > 0 ? (
licenseItems.map(({ index, license }) => (
Expand All @@ -53,7 +57,9 @@ function LicenseList() {
) : (
<NothingToSee
buttonText={t('add-license')}
onAddClick={() => setDialogOpen(true)}
onAddClick={() => {
setDialogOpen(true)
}}
/>
)}
</EditorList>
Expand Down
4 changes: 2 additions & 2 deletions client/components/Parts/Cards/NothingToSee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default function NothingToSee(props: any){
textTransform: 'capitalize',
marginTop: '10px',
'&:hover': {
backgroundColor: (theme) => theme.palette.OKFNBlue.main,
color: 'white'
backgroundColor: (theme) => theme.palette.OKFNBlue.main,
color: 'white'
}
} }}>
{props.buttonText}
Expand Down
10 changes: 10 additions & 0 deletions client/components/Parts/Icons/DeleteIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createSvgIcon } from '@mui/material/utils'

const DeleteIcon : any = createSvgIcon(
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M4.47869 5.99921C4.47869 5.73411 4.26379 5.51921 3.99869 5.51921C3.7336 5.51921 3.51869 5.73411 3.51869 5.99921H4.47869ZM12.482 5.99921C12.482 5.73411 12.2671 5.51921 12.002 5.51921C11.7369 5.51921 11.522 5.73411 11.522 5.99921H12.482ZM9.81434 6.66615C9.81434 6.40105 9.59943 6.18615 9.33434 6.18615C9.06924 6.18615 8.85434 6.40105 8.85434 6.66615H9.81434ZM8.85434 11.3348C8.85434 11.5999 9.06924 11.8148 9.33434 11.8148C9.59943 11.8148 9.81434 11.5999 9.81434 11.3348H8.85434ZM7.14642 6.66615C7.14642 6.40105 6.93152 6.18615 6.66642 6.18615C6.40133 6.18615 6.18642 6.40105 6.18642 6.66615H7.14642ZM6.18642 11.3348C6.18642 11.5999 6.40133 11.8148 6.66642 11.8148C6.93152 11.8148 7.14642 11.5999 7.14642 11.3348H6.18642ZM2.99826 3.51839C2.73316 3.51839 2.51826 3.73329 2.51826 3.99839C2.51826 4.26349 2.73316 4.47839 2.99826 4.47839V3.51839ZM13.0024 4.47839C13.2675 4.47839 13.4824 4.26349 13.4824 3.99839C13.4824 3.73329 13.2675 3.51839 13.0024 3.51839V4.47839ZM4.87715 3.84658C4.79332 4.09808 4.92923 4.36991 5.18073 4.45374C5.43222 4.53757 5.70405 4.40165 5.78788 4.15016L4.87715 3.84658ZM5.69533 2.90992L6.1507 3.06171L6.15074 3.0616L5.69533 2.90992ZM6.96119 1.99754L6.96108 2.47754H6.96119V1.99754ZM9.03939 1.99754V2.47754L9.03999 2.47754L9.03939 1.99754ZM10.3066 2.90992L10.7621 2.75863L10.762 2.75824L10.3066 2.90992ZM10.2125 4.14966C10.2961 4.40124 10.5678 4.53746 10.8194 4.45391C11.0709 4.37035 11.2072 4.09867 11.1236 3.84708L10.2125 4.14966ZM3.51869 5.99921V12.6686H4.47869V5.99921H3.51869ZM3.51869 12.6686C3.51869 13.6704 4.3308 14.4825 5.33258 14.4825V13.5225C4.86099 13.5225 4.47869 13.1402 4.47869 12.6686H3.51869ZM5.33258 14.4825H10.6681V13.5225H5.33258V14.4825ZM10.6681 14.4825C11.6699 14.4825 12.482 13.6704 12.482 12.6686H11.522C11.522 13.1402 11.1397 13.5225 10.6681 13.5225V14.4825ZM12.482 12.6686V5.99921H11.522V12.6686H12.482ZM8.85434 6.66615V11.3348H9.81434V6.66615H8.85434ZM6.18642 6.66615V11.3348H7.14642V6.66615H6.18642ZM2.99826 4.47839H13.0024V3.51839H2.99826V4.47839ZM5.78788 4.15016L6.1507 3.06171L5.23997 2.75813L4.87715 3.84658L5.78788 4.15016ZM6.15074 3.0616C6.26693 2.71275 6.59339 2.47745 6.96108 2.47754L6.96131 1.51754C6.18024 1.51735 5.48675 2.01719 5.23993 2.75824L6.15074 3.0616ZM6.96119 2.47754H9.03939V1.51754H6.96119V2.47754ZM9.03999 2.47754C9.40799 2.47708 9.73489 2.71245 9.85118 3.0616L10.762 2.75824C10.515 2.01655 9.82054 1.51657 9.0388 1.51754L9.03999 2.47754ZM9.85105 3.06121L10.2125 4.14966L11.1236 3.84708L10.7621 2.75863L9.85105 3.06121Z"/>
</svg>,
'Delete',
)

export default DeleteIcon
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
10 changes: 5 additions & 5 deletions client/components/Parts/Trees/File.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TreeItem, TreeItemProps, TreeView, treeItemClasses } from '@mui/x-tree-
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import closedFolderIcon from '../../../assets/closed_folder_icon.svg'
import deleteIcon from '../../../assets/delete_icon.svg'
import DeleteIcon from '../Icons/DeleteIcon'
import openFileLocationIcon from '../../../assets/open_file_location_icon.svg'
import openFolderIcon from '../../../assets/open_folder_icon.svg'
import renameIcon from '../../../assets/rename_icon.svg'
Expand Down Expand Up @@ -233,15 +233,15 @@ const StyledTreeItem = styled(
<MenuItem onClick={handleDelete}>
<ListItemIcon
sx={{
paddingTop: '6px',
paddingTop: '3px',
alignSelf: 'flex-start',
minWidth: '24px',
'& img': {
width: '20px',
'& svg': {
width: '22px'
},
}}
>
{<img src={deleteIcon} alt="" />}
<DeleteIcon color="OKFNRed500" />
</ListItemIcon>
<ListItemText
primaryTypographyProps={{
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: 6 additions & 0 deletions client/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ declare module '@mui/material/Button' {
OKFNGray700: true
}
}
declare module './components/Parts/Icons/DeleteIcon' {
interface SvgIconPropsColorOverrides {
OKFNRed500: true
OKFNGray700: true
}
}

export const DEFAULT = createTheme({
typography: {
Expand Down
2 changes: 2 additions & 0 deletions server/endpoints/file/__spec__/test_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Action


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


@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)
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"DOM",
"dom.iterable"
],
"allowJs": true,
"declaration": true,
"esModuleInterop": true,
"resolveJsonModule": true,
Expand Down

0 comments on commit be046ff

Please sign in to comment.