From f564bc8b60fc18981fe17888fa7d7c37d30cb614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20J=C3=A1ky?= Date: Fri, 9 Aug 2024 17:46:18 +0200 Subject: [PATCH] chore(ui): small cleanup (#1990) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(ui): remove unused getScanName function Signed-off-by: András Jáky * chore(ui): fix FINDINGHS->FINDINGS typo Signed-off-by: András Jáky * chore(ui): remove unnecessary paths Signed-off-by: András Jáky * chore(ui): fix configmation->confirmation typo Signed-off-by: András Jáky --------- Signed-off-by: András Jáky --- ui/src/layout/AssetScans/AssetScanDetails.jsx | 7 +++---- ui/src/layout/Assets/AssetDetails.jsx | 1 - .../Findings/Exploits/ExploitDetails.jsx | 2 -- .../Findings/Malware/MalwareDetails.jsx | 2 -- .../MisconfigurationDetails.jsx | 2 -- .../Findings/Packages/PackageDetails.jsx | 2 -- .../Findings/Rootkits/RootkitDetails.jsx | 2 -- .../layout/Findings/Secrets/SecretDetails.jsx | 2 -- .../Vulnerabilities/VulnerabilityDetails.jsx | 2 -- .../ConfigurationActionsDisplay/index.jsx | 20 +++++++++---------- ui/src/layout/Scans/Scans/ScanDetails.jsx | 5 ++--- ui/src/utils/utils.jsx | 3 --- 12 files changed, 15 insertions(+), 35 deletions(-) diff --git a/ui/src/layout/AssetScans/AssetScanDetails.jsx b/ui/src/layout/AssetScans/AssetScanDetails.jsx index a77b177b6..b9fa98148 100644 --- a/ui/src/layout/AssetScans/AssetScanDetails.jsx +++ b/ui/src/layout/AssetScans/AssetScanDetails.jsx @@ -3,13 +3,12 @@ import { useLocation } from "react-router-dom"; import DetailsPageWrapper from "components/DetailsPageWrapper"; import TabbedPage from "components/TabbedPage"; import { APIS } from "utils/systemConsts"; -import { formatDate, getScanName } from "utils/utils"; +import { formatDate } from "utils/utils"; import { Findings } from "layout/detail-displays"; import TabAssetScanDetails from "./TabAssetScanDetails"; const ASSET_SCAN_DETAILS_PATHS = { - ASSET_SCAN_DETAILS: "", - FINDINGHS: "findings", + FINDINGS: "findings", }; const DetailsContent = ({ data }) => { @@ -30,7 +29,7 @@ const DetailsContent = ({ data }) => { { id: "findings", title: "Findings", - path: ASSET_SCAN_DETAILS_PATHS.FINDINGHS, + path: ASSET_SCAN_DETAILS_PATHS.FINDINGS, component: () => ( { id: "general", title: "Exploit details", isIndex: true, - path: EXPLOIT_DETAILS_PATHS.EXPLOIT_DETAILS, component: () => , }, { diff --git a/ui/src/layout/Findings/Malware/MalwareDetails.jsx b/ui/src/layout/Findings/Malware/MalwareDetails.jsx index 844c17056..a20c3e714 100644 --- a/ui/src/layout/Findings/Malware/MalwareDetails.jsx +++ b/ui/src/layout/Findings/Malware/MalwareDetails.jsx @@ -6,7 +6,6 @@ import TabMalwareDetails from "./TabMalwareDetails"; import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable"; const MALWARE_DETAILS_PATHS = { - MALWARE_DETAILS: "", ASSET_LIST: "assets", }; @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => { id: "general", title: "Malware details", isIndex: true, - path: MALWARE_DETAILS_PATHS.MALWARE_DETAILS, component: () => , }, { diff --git a/ui/src/layout/Findings/Misconfigurations/MisconfigurationDetails.jsx b/ui/src/layout/Findings/Misconfigurations/MisconfigurationDetails.jsx index 7f9069c99..c6e18062e 100644 --- a/ui/src/layout/Findings/Misconfigurations/MisconfigurationDetails.jsx +++ b/ui/src/layout/Findings/Misconfigurations/MisconfigurationDetails.jsx @@ -6,7 +6,6 @@ import TabMisconfigurationDetails from "./TabMisconfigurationDetails"; import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable"; const MISCONFIGURATION_DETAILS_PATHS = { - MISCONFIGURATION_DETAILS: "", ASSET_LIST: "assets", }; @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => { id: "general", title: "Misconfiguration details", isIndex: true, - path: MISCONFIGURATION_DETAILS_PATHS.MISCONFIGURATION_DETAILS, component: () => , }, { diff --git a/ui/src/layout/Findings/Packages/PackageDetails.jsx b/ui/src/layout/Findings/Packages/PackageDetails.jsx index f606c09aa..7d61adb7e 100644 --- a/ui/src/layout/Findings/Packages/PackageDetails.jsx +++ b/ui/src/layout/Findings/Packages/PackageDetails.jsx @@ -6,7 +6,6 @@ import TabPackageDetails from "./TabPackageDetails"; import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable"; const PACKAGE_DETAILS_PATHS = { - PACKAGE_DETAILS: "", ASSET_LIST: "assets", }; @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => { id: "general", title: "Package details", isIndex: true, - path: PACKAGE_DETAILS_PATHS.PACKAGE_DETAILS, component: () => , }, { diff --git a/ui/src/layout/Findings/Rootkits/RootkitDetails.jsx b/ui/src/layout/Findings/Rootkits/RootkitDetails.jsx index 6f58e7395..fd19047e1 100644 --- a/ui/src/layout/Findings/Rootkits/RootkitDetails.jsx +++ b/ui/src/layout/Findings/Rootkits/RootkitDetails.jsx @@ -6,7 +6,6 @@ import TabRootkitDetails from "./TabRootkitDetails"; import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable"; const ROOTKIT_DETAILS_PATHS = { - ROOTKIT_DETAILS: "", ASSET_LIST: "assets", }; @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => { id: "general", title: "Rootkit details", isIndex: true, - path: ROOTKIT_DETAILS_PATHS.ROOTKIT_DETAILS, component: () => , }, { diff --git a/ui/src/layout/Findings/Secrets/SecretDetails.jsx b/ui/src/layout/Findings/Secrets/SecretDetails.jsx index 67c2f17d2..36e87afd3 100644 --- a/ui/src/layout/Findings/Secrets/SecretDetails.jsx +++ b/ui/src/layout/Findings/Secrets/SecretDetails.jsx @@ -6,7 +6,6 @@ import TabSecretDetails from "./TabSecretDetails"; import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable"; const SECRET_DETAILS_PATHS = { - SECRET_DETAILS: "", ASSET_LIST: "assets", }; @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => { id: "general", title: "Secret details", isIndex: true, - path: SECRET_DETAILS_PATHS.SECRET_DETAILS, component: () => , }, { diff --git a/ui/src/layout/Findings/Vulnerabilities/VulnerabilityDetails.jsx b/ui/src/layout/Findings/Vulnerabilities/VulnerabilityDetails.jsx index 2bf6b94ac..eda1fc717 100644 --- a/ui/src/layout/Findings/Vulnerabilities/VulnerabilityDetails.jsx +++ b/ui/src/layout/Findings/Vulnerabilities/VulnerabilityDetails.jsx @@ -6,7 +6,6 @@ import TabVulnerabilityDetails from "./TabVulnerabilityDetails"; import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable"; const VULNERABILITY_DETAILS_PATHS = { - VULNERABILITY_DETAILS: "", ASSET_LIST: "assets", }; @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => { id: "general", title: "Vulnerability details", isIndex: true, - path: VULNERABILITY_DETAILS_PATHS.VULNERABILITY_DETAILS, component: () => , }, { diff --git a/ui/src/layout/Scans/Configurations/ConfigurationActionsDisplay/index.jsx b/ui/src/layout/Scans/Configurations/ConfigurationActionsDisplay/index.jsx index c7d19396b..5c8604fbc 100644 --- a/ui/src/layout/Scans/Configurations/ConfigurationActionsDisplay/index.jsx +++ b/ui/src/layout/Scans/Configurations/ConfigurationActionsDisplay/index.jsx @@ -27,8 +27,8 @@ const ConfigurationActionsDisplay = ({ data, onDelete, onUpdate }) => { const disableStartScan = Date.now() - new Date(operationTime).valueOf() <= 0 && !cronLine; - const [deleteConfigmationData, setDeleteConfigmationData] = useState(null); - const closeDeleteConfigmation = () => setDeleteConfigmationData(null); + const [deleteConfirmationData, setDeleteConfirmationData] = useState(null); + const closeDeleteConfirmation = () => setDeleteConfirmationData(null); const [{ deleting }, deleteConfiguration] = useDelete(APIS.SCAN_CONFIGS); const prevDeleting = usePrevious(deleting); @@ -109,28 +109,28 @@ const ConfigurationActionsDisplay = ({ data, onDelete, onUpdate }) => { event.stopPropagation(); event.preventDefault(); - setDeleteConfigmationData(data); + setDeleteConfirmationData(data); }} /> - {!isNull(deleteConfigmationData) && ( + {!isNull(deleteConfirmationData) && ( { - deleteConfiguration(deleteConfigmationData.id); - closeDeleteConfigmation(); + deleteConfiguration(deleteConfirmationData.id); + closeDeleteConfirmation(); }} > {`Once `} - {deleteConfigmationData.name} + {deleteConfirmationData.name} {` will be deleted, the action cannot be reverted`}
- {`Are you sure you want to delete ${deleteConfigmationData.name}?`} + {`Are you sure you want to delete ${deleteConfirmationData.name}?`}
)} diff --git a/ui/src/layout/Scans/Scans/ScanDetails.jsx b/ui/src/layout/Scans/Scans/ScanDetails.jsx index 8984ac020..15e67e82d 100644 --- a/ui/src/layout/Scans/Scans/ScanDetails.jsx +++ b/ui/src/layout/Scans/Scans/ScanDetails.jsx @@ -3,7 +3,7 @@ import { useLocation } from "react-router-dom"; import DetailsPageWrapper from "components/DetailsPageWrapper"; import TabbedPage from "components/TabbedPage"; import { APIS } from "utils/systemConsts"; -import { formatDate, getScanName } from "utils/utils"; +import { formatDate } from "utils/utils"; import { ScanDetails as ScanDetailsTab, Findings, @@ -11,14 +11,13 @@ import { import ScanActionsDisplay from "./ScanActionsDisplay"; export const SCAN_DETAILS_PATHS = { - SCAN_DETALS: "", FINDINGS: "findings", }; const DetailsContent = ({ data, fetchData }) => { const { pathname } = useLocation(); - const { id, name, startTime } = data; + const { id, name } = data; return ( export const formatNumber = (value) => new Intl.NumberFormat("en-US").format(parseInt(value || 0, 10)); -export const getScanName = ({ name, startTime }) => - `${name} ${formatDate(startTime)}`; - export const getHighestVersionCvssData = (cvssData) => { if (isEmpty(cvssData)) { return {};