Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added breadcrumb to all remainings scan type #951

Merged
merged 3 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,28 @@ export const ControlsTable = memo(
{selectedTab === '' ? (
<p>Please select at least one compliance type to start your scan.</p>
) : (
<Tabs value={selectedTab} tabs={tabs} onValueChange={(v) => setSelectedTab(v)}>
{isLoading && controlsList.length === 0 ? (
<TableSkeleton columns={3} rows={10} size={'md'} />
) : (
<Table
size="sm"
data={controlsList}
columns={columns}
enablePagination
enableColumnResizing
enableSorting
/>
)}
</Tabs>
<>
{nodeIds.length === 1 ? (
<Tabs
value={selectedTab}
tabs={tabs}
onValueChange={(v) => setSelectedTab(v)}
>
{isLoading && controlsList.length === 0 ? (
<TableSkeleton columns={3} rows={10} size={'md'} />
) : (
<Table
size="sm"
data={controlsList}
columns={columns}
enablePagination
enableColumnResizing
enableSorting
/>
)}
</Tabs>
) : null}
</>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { FaHistory } from 'react-icons/fa';
import { FiFilter } from 'react-icons/fi';
import {
HiArchive,
HiArrowSmLeft,
HiBell,
HiChevronLeft,
HiChevronRight,
HiDotsVertical,
HiEye,
HiEyeOff,
Expand All @@ -29,6 +29,8 @@ import { toast } from 'sonner';
import { twMerge } from 'tailwind-merge';
import {
Badge,
Breadcrumb,
BreadcrumbLink,
Button,
Card,
Checkbox,
Expand Down Expand Up @@ -208,7 +210,7 @@ async function getScans(
low: result.severity_counts?.['low'] ?? 0,
unknown: result.severity_counts?.['unknown'] ?? 0,
},
nodeName: result.host_name,
nodeName: result.node_name,
nodeType: result.node_type,
nodeId: result.node_id,
timestamp: result.updated_at,
Expand Down Expand Up @@ -1006,21 +1008,17 @@ const HeaderComponent = ({
const { nodeType, nodeName } = resolvedData;
return (
<>
<DFLink
to={`/malware/scans?nodeType=${nodeType}`}
className="flex hover:no-underline items-center justify-center mr-2"
>
<IconContext.Provider
value={{
className: 'w-5 h-5 text-blue-600 dark:text-blue-500 ',
}}
>
<HiArrowSmLeft />
</IconContext.Provider>
</DFLink>
<span className="text-sm font-medium text-gray-700 dark:text-gray-200">
MALWARE SCAN RESULTS - {nodeType} / {nodeName}
</span>
<Breadcrumb separator={<HiChevronRight />} transparent>
<BreadcrumbLink>
<DFLink to={'/malware'}>MALWARE</DFLink>
</BreadcrumbLink>
<BreadcrumbLink>
<DFLink to={`/malware/scans?nodeType=${nodeType}`}>{nodeType}</DFLink>
</BreadcrumbLink>
<BreadcrumbLink>
<span className="inherit cursor-auto">{nodeName}</span>
</BreadcrumbLink>
</Breadcrumb>
</>
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IconContext } from 'react-icons';
import { FiFilter } from 'react-icons/fi';
import {
HiArchive,
HiArrowSmLeft,
HiChevronRight,
HiClock,
HiDotsVertical,
HiDownload,
Expand All @@ -32,6 +32,8 @@ import {
import { toast } from 'sonner';
import {
Badge,
Breadcrumb,
BreadcrumbLink,
Button,
CircleSpinner,
createColumnHelper,
Expand Down Expand Up @@ -836,21 +838,15 @@ const MalwareScans = () => {
return (
<div>
<div className="flex p-1 pl-2 w-full items-center shadow bg-white dark:bg-gray-800">
<DFLink
to={'/malware'}
className="flex hover:no-underline items-center justify-center mr-2"
>
<IconContext.Provider
value={{
className: 'w-5 h-5 text-blue-600 dark:text-blue-500 ',
}}
>
<HiArrowSmLeft />
</IconContext.Provider>
</DFLink>
<span className="text-sm font-medium text-gray-700 dark:text-gray-200">
MALWARE SCANS
</span>
<Breadcrumb separator={<HiChevronRight />} transparent>
<BreadcrumbLink>
<DFLink to={'/malware'}>MALWARES</DFLink>
</BreadcrumbLink>
<BreadcrumbLink>
<span className="inherit cursor-auto">MALWARE SCANS</span>
</BreadcrumbLink>
</Breadcrumb>

<span className="ml-2">
{navigation.state === 'loading' ? <CircleSpinner size="xs" /> : null}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,23 @@ import { DFAwait } from '@/utils/suspense';
import { getPageFromSearchParams } from '@/utils/table';
import { usePageNavigation } from '@/utils/usePageNavigation';

enum ActionEnumType {
START_SCAN = 'start_scan',
VIEW_SCAN = 'view_scan',
VIEW_INVENTORY = 'view_inventory',
REFRESH_DATA = 'refresh_data',
}
// TODO: remove this once we have correct type from api
const getNodeTypeByProviderName = (providerName: string) => {
switch (providerName) {
case 'linux':
return 'host';
case 'aws':
return 'aws';
case 'gcp':
return 'gcp';
case 'azure':
return 'azure';
case 'kubernetes':
return 'kubernetes_cluster';
default:
throw new Error('Invalid provider name');
}
};

export interface AccountData {
id: string;
Expand Down Expand Up @@ -377,6 +388,11 @@ const PostureTable = () => {
const accounts = resolvedData?.accounts ?? [];
const totalRows = resolvedData?.totalRows ?? 0;
const currentPage = resolvedData?.currentPage ?? 0;
const cloudProvider = accounts[0]?.cloud_provider ?? '';

if (!cloudProvider) {
throw new Error('Cloud provider is required to show table');
}
return (
<div>
<Modal
Expand All @@ -400,8 +416,8 @@ const PostureTable = () => {
});
}}
data={{
nodeType: 'aws',
nodeIds: Object.keys(openScanConfigure),
nodeType: getNodeTypeByProviderName(cloudProvider),
nodeIds: openScanConfigure.nodeIds,
images: [],
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,22 @@ const ScanResusltTable = () => {
<PostureIcon />
</div>
</div>
<div className="truncate">{info.getValue()}</div>
<div className="truncate">{info.row.original.test_number}</div>
</DFLink>
),
header: () => 'ID',
minSize: 90,
size: 100,
maxSize: 110,
header: () => 'Test ID',
minSize: 50,
size: 60,
maxSize: 65,
}),
columnHelper.accessor('test_category', {
enableSorting: false,
enableResizing: false,
cell: (info) => info.getValue(),
header: () => 'Category',
minSize: 80,
size: 90,
maxSize: 95,
}),
columnHelper.accessor('compliance_check_type', {
enableSorting: false,
Expand Down Expand Up @@ -898,7 +907,7 @@ const HeaderComponent = () => {
<>
<Breadcrumb separator={<HiChevronRight />} transparent>
<BreadcrumbLink>
<DFLink to={'/posture'}>REGISTRIES</DFLink>
<DFLink to={'/posture'}>POSTURE</DFLink>
</BreadcrumbLink>
<BreadcrumbLink>
<DFLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { FaHistory } from 'react-icons/fa';
import { FiFilter } from 'react-icons/fi';
import {
HiArchive,
HiArrowSmLeft,
HiBell,
HiChevronLeft,
HiChevronRight,
HiDotsVertical,
HiEye,
HiEyeOff,
Expand All @@ -29,6 +29,8 @@ import { toast } from 'sonner';
import { twMerge } from 'tailwind-merge';
import {
Badge,
Breadcrumb,
BreadcrumbLink,
Button,
Card,
Checkbox,
Expand Down Expand Up @@ -1010,21 +1012,17 @@ const HeaderComponent = ({
const { nodeType, nodeName } = resolvedData;
return (
<>
<DFLink
to={`/secret/scans?nodeType=${nodeType}`}
className="flex hover:no-underline items-center justify-center mr-2"
>
<IconContext.Provider
value={{
className: 'w-5 h-5 text-blue-600 dark:text-blue-500 ',
}}
>
<HiArrowSmLeft />
</IconContext.Provider>
</DFLink>
<span className="text-sm font-medium text-gray-700 dark:text-gray-200">
SECRET SCAN RESULTS - {nodeType} / {nodeName}
</span>
<Breadcrumb separator={<HiChevronRight />} transparent>
<BreadcrumbLink>
<DFLink to={'/secret'}>SECRETS</DFLink>
</BreadcrumbLink>
<BreadcrumbLink>
<DFLink to={`/secret/scans?nodeType=${nodeType}`}>{nodeType}</DFLink>
</BreadcrumbLink>
<BreadcrumbLink>
<span className="inherit cursor-auto">{nodeName}</span>
</BreadcrumbLink>
</Breadcrumb>
</>
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IconContext } from 'react-icons';
import { FiFilter } from 'react-icons/fi';
import {
HiArchive,
HiArrowSmLeft,
HiChevronRight,
HiClock,
HiDotsVertical,
HiDownload,
Expand All @@ -32,6 +32,8 @@ import {
import { toast } from 'sonner';
import {
Badge,
Breadcrumb,
BreadcrumbLink,
Button,
CircleSpinner,
createColumnHelper,
Expand Down Expand Up @@ -838,21 +840,15 @@ const SecretScans = () => {
return (
<div>
<div className="flex p-1 pl-2 w-full items-center shadow bg-white dark:bg-gray-800">
<DFLink
to={'/secret'}
className="flex hover:no-underline items-center justify-center mr-2"
>
<IconContext.Provider
value={{
className: 'w-5 h-5 text-blue-600 dark:text-blue-500 ',
}}
>
<HiArrowSmLeft />
</IconContext.Provider>
</DFLink>
<span className="text-sm font-medium text-gray-700 dark:text-gray-200">
SECRET SCANS
</span>
<Breadcrumb separator={<HiChevronRight />} transparent>
<BreadcrumbLink>
<DFLink to={'/secret'}>SECRETS</DFLink>
</BreadcrumbLink>
<BreadcrumbLink>
<span className="inherit cursor-auto">SECRET SCANS</span>
</BreadcrumbLink>
</Breadcrumb>

<span className="ml-2">
{navigation.state === 'loading' ? <CircleSpinner size="xs" /> : null}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import cx from 'classnames';
import { capitalize } from 'lodash-es';
import { Suspense, useMemo } from 'react';
import { IconContext } from 'react-icons';
import { HiArrowSmLeft, HiExternalLink } from 'react-icons/hi';
import { HiChevronRight, HiExternalLink } from 'react-icons/hi';
import {
Await,
LoaderFunctionArgs,
Outlet,
useLoaderData,
Expand All @@ -13,6 +12,8 @@ import {
} from 'react-router-dom';
import {
Badge,
Breadcrumb,
BreadcrumbLink,
CircleSpinner,
createColumnHelper,
SortingState,
Expand Down Expand Up @@ -329,21 +330,15 @@ const MostExploitableVulnerabilities = () => {
return (
<div>
<div className="flex p-2 pl-2 w-full items-center shadow bg-white dark:bg-gray-800">
<DFLink
to={'/vulnerability'}
className="flex hover:no-underline items-center justify-center mr-2"
>
<IconContext.Provider
value={{
className: 'w-5 h-5 text-blue-600 dark:text-blue-500 ',
}}
>
<HiArrowSmLeft />
</IconContext.Provider>
</DFLink>
<span className="text-sm font-medium text-gray-700 dark:text-gray-200">
MOST EXPLOITABLE VULNERABILITIES
</span>
<Breadcrumb separator={<HiChevronRight />} transparent>
<BreadcrumbLink>
<DFLink to={'/vulnerability'}>VULNERABILITIES</DFLink>
</BreadcrumbLink>
<BreadcrumbLink>
<span className="inherit cursor-auto"> MOST EXPLOITABLE VULNERABILITIES</span>
</BreadcrumbLink>
</Breadcrumb>

<span className="ml-2 max-h-5 flex items-center">
{navigation.state === 'loading' ? <CircleSpinner size="xs" /> : null}
</span>
Expand Down
Loading