diff --git a/src/components/visual/ResultCard/result_section.tsx b/src/components/visual/ResultCard/result_section.tsx index 7961b0f91..523146bc2 100644 --- a/src/components/visual/ResultCard/result_section.tsx +++ b/src/components/visual/ResultCard/result_section.tsx @@ -1,9 +1,22 @@ import AssignmentOutlinedIcon from '@mui/icons-material/AssignmentOutlined'; +import CloseOutlinedIcon from '@mui/icons-material/CloseOutlined'; import ExpandLess from '@mui/icons-material/ExpandLess'; import ExpandMore from '@mui/icons-material/ExpandMore'; import LabelOutlinedIcon from '@mui/icons-material/LabelOutlined'; import SimCardOutlinedIcon from '@mui/icons-material/SimCardOutlined'; -import { Box, Collapse, IconButton, Menu, MenuItem, Tooltip, useTheme } from '@mui/material'; +import TableViewOutlinedIcon from '@mui/icons-material/TableViewOutlined'; +import { + Box, + Collapse, + Dialog, + DialogContent, + DialogTitle, + IconButton, + Menu, + MenuItem, + Tooltip, + useTheme +} from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import useClipboard from 'commons/components/utils/hooks/useClipboard'; import useALContext from 'components/hooks/useALContext'; @@ -16,7 +29,7 @@ import Heuristic from 'components/visual/Heuristic'; import SectionHighlight from 'components/visual/SectionHighlight'; import Tag from 'components/visual/Tag'; import Verdict from 'components/visual/Verdict'; -import React, { useCallback, useMemo } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { GraphBody } from './graph_body'; import { ImageBody } from './image_body'; @@ -34,6 +47,7 @@ import { URLBody } from './url_body'; const CLIPBOARD_ICON = ; const HEURISTIC_ICON = ; +const TABLE_ICON = ; const TAGS_ICON = ; const ATTACK_ICON = ( = ({ const { t } = useTranslation(['fileDetail']); const classes = useStyles(); const theme = useTheme(); - const [open, setOpen] = React.useState(!section.auto_collapse || printable); - const [render, setRender] = React.useState(!section.auto_collapse || printable); - const [showTags, setShowTags] = React.useState(false); - const [showHeur, setShowHeur] = React.useState(false); - const [showAttack, setShowAttack] = React.useState(false); - const { getKey, hasHighlightedKeys } = useHighlighter(); const { c12nDef } = useALContext(); - const [state, setState] = React.useState(null); const { copy } = useClipboard(); + const { getKey, hasHighlightedKeys } = useHighlighter(); const { showSafeResults } = useSafeResults(); + const [state, setState] = useState<{ mouseX: number; mouseY: number }>(null); + const [open, setOpen] = useState(!section.auto_collapse || printable); + const [render, setRender] = useState(!section.auto_collapse || printable); + const [showTags, setShowTags] = useState(false); + const [showHeur, setShowHeur] = useState(false); + const [showAttack, setShowAttack] = useState(false); + const [showTable, setShowTable] = useState(false); + const allTags = useMemo(() => { const tagList = []; if (!printable) { @@ -207,6 +223,18 @@ const WrappedResultSection: React.FC = ({ {CLIPBOARD_ICON} {t('clipboard')} + {section.body_format === 'TABLE' && ( + { + setShowTable(true); + setState(null); + }} + > + {TABLE_ICON} + {t('table.menubutton')} + + )} {!highlighted && section.heuristic && ( = ({ )} )} + {section.body_format !== 'TABLE' ? null : ( + setShowTable(false)} + > +
+ setShowTable(false)} + > + + + {t('table.title')} + + + +
+
+ )}
= ({ {!printable && ( <>
+ {section.body_format !== 'TABLE' ? null : ( + + { + setShowTable(true); + setState(null); + }} + > + + + + )} {section.heuristic && ( diff --git a/src/components/visual/ResultCard/table_body.tsx b/src/components/visual/ResultCard/table_body.tsx index f03ea55f2..c68862eb2 100644 --- a/src/components/visual/ResultCard/table_body.tsx +++ b/src/components/visual/ResultCard/table_body.tsx @@ -1,10 +1,11 @@ -import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Theme } from '@mui/material'; +import type { Theme } from '@mui/material'; +import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@mui/material'; import createStyles from '@mui/styles/createStyles'; import makeStyles from '@mui/styles/makeStyles'; import withStyles from '@mui/styles/withStyles'; import type { TableBody as TableData } from 'components/models/base/result_body'; +import TitleKey from 'components/visual/TitleKey'; import { default as React } from 'react'; -import TitleKey from '../TitleKey'; import { KVBody } from './kv_body'; import { TextBody } from './text_body'; diff --git a/src/locales/en/file/detail.json b/src/locales/en/file/detail.json index 5371b6742..d4a0c1f6d 100644 --- a/src/locales/en/file/detail.json +++ b/src/locales/en/file/detail.json @@ -72,6 +72,8 @@ "show_tags": "Tags", "size": "Size", "supplementary": "Supplementary files", + "table.menubutton": "Enlarge the table", + "table.title": "Result Table", "title": "File Details", "type": "Type", "uri_identification": "URI Identification", diff --git a/src/locales/fr/file/detail.json b/src/locales/fr/file/detail.json index 74f8d9350..3a5c7c1c4 100644 --- a/src/locales/fr/file/detail.json +++ b/src/locales/fr/file/detail.json @@ -72,6 +72,8 @@ "show_tags": "Étiquettes", "size": "Taille", "supplementary": "Fichiers supplémentaires", + "table.menubutton": "Élargir le tableau", + "table.title": "Tableau des résultats", "tags": "Tags", "title": "Détails du fichier", "type": "Type",