From 76302c602337e94bc637093104b6455ae63ca014 Mon Sep 17 00:00:00 2001 From: cccs-nr Date: Wed, 22 Jan 2025 17:33:05 +0000 Subject: [PATCH 1/4] Added a Dialog to view the ResultTable in a wide format --- .../visual/ResultCard/result_section.tsx | 74 ++++++++++++++++--- .../visual/ResultCard/table_body.tsx | 5 +- src/locales/en/file/detail.json | 2 + src/locales/fr/file/detail.json | 2 + 4 files changed, 72 insertions(+), 11 deletions(-) diff --git a/src/components/visual/ResultCard/result_section.tsx b/src/components/visual/ResultCard/result_section.tsx index 7961b0f91..cd6ba48cc 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('show_table')} + + )} {!highlighted && section.heuristic && ( = ({ )} )} + {section.body_format !== 'TABLE' ? null : ( + setShowTable(false)} + > +
+ setShowTable(false)} + > + + + {t('result_table')} + + + +
+
+ )}
Date: Wed, 22 Jan 2025 17:41:39 +0000 Subject: [PATCH 2/4] Changed the wordings --- src/components/visual/ResultCard/result_section.tsx | 4 ++-- src/locales/en/file/detail.json | 4 ++-- src/locales/fr/file/detail.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/visual/ResultCard/result_section.tsx b/src/components/visual/ResultCard/result_section.tsx index cd6ba48cc..181def90a 100644 --- a/src/components/visual/ResultCard/result_section.tsx +++ b/src/components/visual/ResultCard/result_section.tsx @@ -232,7 +232,7 @@ const WrappedResultSection: React.FC = ({ }} > {TABLE_ICON} - {t('show_table')} + {t('table.menubutton')} )} {!highlighted && section.heuristic && ( @@ -288,7 +288,7 @@ const WrappedResultSection: React.FC = ({ > - {t('result_table')} + {t('table.title')} Date: Thu, 23 Jan 2025 18:29:45 +0000 Subject: [PATCH 3/4] Changed the translation --- src/locales/en/file/detail.json | 2 +- src/locales/fr/file/detail.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/en/file/detail.json b/src/locales/en/file/detail.json index 40d7996e6..87a0a422c 100644 --- a/src/locales/en/file/detail.json +++ b/src/locales/en/file/detail.json @@ -72,7 +72,7 @@ "show_tags": "Tags", "size": "Size", "supplementary": "Supplementary files", - "table.menubutton": "Show large table", + "table.menubutton": "Expand table", "table.title": "Result Table", "title": "File Details", "type": "Type", diff --git a/src/locales/fr/file/detail.json b/src/locales/fr/file/detail.json index caf6e5c59..c769612e7 100644 --- a/src/locales/fr/file/detail.json +++ b/src/locales/fr/file/detail.json @@ -72,7 +72,7 @@ "show_tags": "Étiquettes", "size": "Taille", "supplementary": "Fichiers supplémentaires", - "table.menubutton": "Afficher le tableau en large", + "table.menubutton": "Agrandir le tableau", "table.title": "Tableau des résultats", "tags": "Tags", "title": "Détails du fichier", From 0b66f0f7cd1910e07a930be1f1fd5e01f18fff36 Mon Sep 17 00:00:00 2001 From: cccs-nr Date: Thu, 23 Jan 2025 18:31:00 +0000 Subject: [PATCH 4/4] Changed the translation --- src/locales/en/file/detail.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/en/file/detail.json b/src/locales/en/file/detail.json index 87a0a422c..4b3d28723 100644 --- a/src/locales/en/file/detail.json +++ b/src/locales/en/file/detail.json @@ -72,7 +72,7 @@ "show_tags": "Tags", "size": "Size", "supplementary": "Supplementary files", - "table.menubutton": "Expand table", + "table.menubutton": "Expand the table", "table.title": "Result Table", "title": "File Details", "type": "Type",