Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
chore(ui): small cleanup (#1990)
Browse files Browse the repository at this point in the history
* chore(ui): remove unused getScanName function

Signed-off-by: András Jáky <[email protected]>

* chore(ui): fix FINDINGHS->FINDINGS typo

Signed-off-by: András Jáky <[email protected]>

* chore(ui): remove unnecessary paths

Signed-off-by: András Jáky <[email protected]>

* chore(ui): fix configmation->confirmation typo

Signed-off-by: András Jáky <[email protected]>

---------

Signed-off-by: András Jáky <[email protected]>
  • Loading branch information
akijakya authored Aug 9, 2024
1 parent 42a2fd7 commit f564bc8
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 35 deletions.
7 changes: 3 additions & 4 deletions ui/src/layout/AssetScans/AssetScanDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand All @@ -30,7 +29,7 @@ const DetailsContent = ({ data }) => {
{
id: "findings",
title: "Findings",
path: ASSET_SCAN_DETAILS_PATHS.FINDINGHS,
path: ASSET_SCAN_DETAILS_PATHS.FINDINGS,
component: () => (
<Findings
findingsSummary={summary}
Expand Down
1 change: 0 additions & 1 deletion ui/src/layout/Assets/AssetDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from "layout/detail-displays";

const ASSET_DETAILS_PATHS = {
ASSET_DETAILS: "",
FINDINGS: "findings",
};

Expand Down
2 changes: 0 additions & 2 deletions ui/src/layout/Findings/Exploits/ExploitDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TabExploitDetails from "./TabExploitDetails";
import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable";

const EXPLOIT_DETAILS_PATHS = {
EXPLOIT_DETAILS: "",
ASSET_LIST: "assets",
};

Expand All @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => {
id: "general",
title: "Exploit details",
isIndex: true,
path: EXPLOIT_DETAILS_PATHS.EXPLOIT_DETAILS,
component: () => <TabExploitDetails data={data} />,
},
{
Expand Down
2 changes: 0 additions & 2 deletions ui/src/layout/Findings/Malware/MalwareDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TabMalwareDetails from "./TabMalwareDetails";
import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable";

const MALWARE_DETAILS_PATHS = {
MALWARE_DETAILS: "",
ASSET_LIST: "assets",
};

Expand All @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => {
id: "general",
title: "Malware details",
isIndex: true,
path: MALWARE_DETAILS_PATHS.MALWARE_DETAILS,
component: () => <TabMalwareDetails data={data} />,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TabMisconfigurationDetails from "./TabMisconfigurationDetails";
import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable";

const MISCONFIGURATION_DETAILS_PATHS = {
MISCONFIGURATION_DETAILS: "",
ASSET_LIST: "assets",
};

Expand All @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => {
id: "general",
title: "Misconfiguration details",
isIndex: true,
path: MISCONFIGURATION_DETAILS_PATHS.MISCONFIGURATION_DETAILS,
component: () => <TabMisconfigurationDetails data={data} />,
},
{
Expand Down
2 changes: 0 additions & 2 deletions ui/src/layout/Findings/Packages/PackageDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TabPackageDetails from "./TabPackageDetails";
import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable";

const PACKAGE_DETAILS_PATHS = {
PACKAGE_DETAILS: "",
ASSET_LIST: "assets",
};

Expand All @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => {
id: "general",
title: "Package details",
isIndex: true,
path: PACKAGE_DETAILS_PATHS.PACKAGE_DETAILS,
component: () => <TabPackageDetails data={data} />,
},
{
Expand Down
2 changes: 0 additions & 2 deletions ui/src/layout/Findings/Rootkits/RootkitDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TabRootkitDetails from "./TabRootkitDetails";
import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable";

const ROOTKIT_DETAILS_PATHS = {
ROOTKIT_DETAILS: "",
ASSET_LIST: "assets",
};

Expand All @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => {
id: "general",
title: "Rootkit details",
isIndex: true,
path: ROOTKIT_DETAILS_PATHS.ROOTKIT_DETAILS,
component: () => <TabRootkitDetails data={data} />,
},
{
Expand Down
2 changes: 0 additions & 2 deletions ui/src/layout/Findings/Secrets/SecretDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TabSecretDetails from "./TabSecretDetails";
import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable";

const SECRET_DETAILS_PATHS = {
SECRET_DETAILS: "",
ASSET_LIST: "assets",
};

Expand All @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => {
id: "general",
title: "Secret details",
isIndex: true,
path: SECRET_DETAILS_PATHS.SECRET_DETAILS,
component: () => <TabSecretDetails data={data} />,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TabVulnerabilityDetails from "./TabVulnerabilityDetails";
import AssetsForFindingTable from "layout/Assets/AssetsForFindingTable";

const VULNERABILITY_DETAILS_PATHS = {
VULNERABILITY_DETAILS: "",
ASSET_LIST: "assets",
};

Expand All @@ -23,7 +22,6 @@ const DetailsContent = ({ data }) => {
id: "general",
title: "Vulnerability details",
isIndex: true,
path: VULNERABILITY_DETAILS_PATHS.VULNERABILITY_DETAILS,
component: () => <TabVulnerabilityDetails data={data} />,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -109,28 +109,28 @@ const ConfigurationActionsDisplay = ({ data, onDelete, onUpdate }) => {
event.stopPropagation();
event.preventDefault();

setDeleteConfigmationData(data);
setDeleteConfirmationData(data);
}}
/>
</div>
{!isNull(deleteConfigmationData) && (
{!isNull(deleteConfirmationData) && (
<Modal
title="Delete configmation"
title="Delete confirmation"
isMediumTitle
className="scan-config-delete-confirmation"
onClose={closeDeleteConfigmation}
onClose={closeDeleteConfirmation}
height={250}
doneTitle="Delete"
onDone={() => {
deleteConfiguration(deleteConfigmationData.id);
closeDeleteConfigmation();
deleteConfiguration(deleteConfirmationData.id);
closeDeleteConfirmation();
}}
>
<span>{`Once `}</span>
<BoldText>{deleteConfigmationData.name}</BoldText>
<BoldText>{deleteConfirmationData.name}</BoldText>
<span>{` will be deleted, the action cannot be reverted`}</span>
<br />
<span>{`Are you sure you want to delete ${deleteConfigmationData.name}?`}</span>
<span>{`Are you sure you want to delete ${deleteConfirmationData.name}?`}</span>
</Modal>
)}
</>
Expand Down
5 changes: 2 additions & 3 deletions ui/src/layout/Scans/Scans/ScanDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ 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,
} from "layout/detail-displays";
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 (
<TabbedPage
Expand Down
3 changes: 0 additions & 3 deletions ui/src/utils/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ export const cronExpressionToHuman = (value) =>
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 {};
Expand Down

0 comments on commit f564bc8

Please sign in to comment.