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

V2 UI scan modal fit width #971

Merged
merged 2 commits into from
Mar 27, 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 @@ -67,7 +67,7 @@ export const ConfigureScanModal = ({
}

return (
<Modal open={open} width="w-full" title={title} onOpenChange={onOpenChange}>
<Modal open={open} title={title} onOpenChange={onOpenChange}>
<div className="p-6">
{scanOptions.scanType === ScanTypeEnum.VulnerabilityScan && (
<VulnerabilityScanConfigureForm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,12 @@ export const ControlsTable = memo(
onValueChange={(v) => setSelectedTab(v)}
>
{isLoading && controlsList.length === 0 ? (
<TableSkeleton columns={3} rows={10} size={'md'} />
<TableSkeleton
columns={3}
rows={10}
size={'md'}
className={'w-screen'}
/>
) : (
<Table
size="sm"
Expand Down Expand Up @@ -381,7 +386,7 @@ export const ComplianceScanConfigureForm = ({
<Button
disabled={state === 'loading'}
loading={state === 'loading'}
size="sm"
size="xs"
color="primary"
type="submit"
className="ml-auto "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const MalwareScanConfigureForm = ({

return (
<fetcher.Form
className="flex flex-col py-2 mb-4"
className="flex flex-col mb-4 min-w-[380px]"
method="post"
action="/data-component/scan/malware"
>
Expand All @@ -172,10 +172,15 @@ export const MalwareScanConfigureForm = ({
{wantAdvanceOptions && (
<h6 className={'text-md font-medium dark:text-white'}>Advanced Options</h6>
)}
{!wantAdvanceOptions && (
<p className="text-gray-900 dark:text-white text-sm pr-3">
You can start malware scanning to find for any malware
</p>
)}
<Button
disabled={state === 'loading'}
loading={state === 'loading'}
size="sm"
size="xs"
color="primary"
className="ml-auto"
type="submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const SecretScanConfigureForm = ({

return (
<fetcher.Form
className="flex flex-col py-2 mb-4"
className="flex flex-col mb-4 min-w-[380px]"
method="post"
action="/data-component/scan/secret"
>
Expand All @@ -171,19 +171,23 @@ export const SecretScanConfigureForm = ({
{wantAdvanceOptions && (
<h6 className={'text-md font-medium dark:text-white'}>Advanced Options</h6>
)}

{!wantAdvanceOptions && (
<p className="text-gray-900 dark:text-white text-sm pr-3">
You can start secret scanning to find for any secrets
</p>
)}
<Button
disabled={state === 'loading'}
loading={state === 'loading'}
size="sm"
size="xs"
color="primary"
className="ml-auto"
type="submit"
>
Start Scan
</Button>
</div>
{wantAdvanceOptions && (
{wantAdvanceOptions ? (
<div className="flex flex-col gap-y-6">
<Checkbox
name="priorityScan"
Expand Down Expand Up @@ -224,7 +228,7 @@ export const SecretScanConfigureForm = ({
}}
/>
</div>
)}
) : null}
</fetcher.Form>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export const VulnerabilityScanConfigureForm = ({
<Button
disabled={state === 'loading'}
loading={state === 'loading'}
size="sm"
size="xs"
color="primary"
className="ml-auto"
type="submit"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cx from 'classnames';
import { useMemo, useState } from 'react';
import { IconContext } from 'react-icons';
import { FaPlay } from 'react-icons/fa';
import { HiDotsVertical } from 'react-icons/hi';
import { useSearchParams } from 'react-router-dom';
import {
Expand All @@ -11,8 +12,6 @@ import {
DropdownItem,
getRowSelectionColumn,
RowSelectionState,
Select,
SelectItem,
Table,
} from 'ui-components';

Expand Down Expand Up @@ -225,40 +224,47 @@ export const RegistryImageTagsTable = ({
<div className="text-sm text-gray-400 font-medium py-2.5">No rows selected</div>
) : (
<>
<div className="mb-2 w-[160px]">
<Select
placeholder="Select a scan"
value={selectedScanType}
sizing="xs"
onChange={(value) => {
setSelectedScanType(
value as
| typeof ScanTypeEnum.VulnerabilityScan
| typeof ScanTypeEnum.SecretScan
| typeof ScanTypeEnum.MalwareScan,
);
}}
<Dropdown
triggerAsChild={true}
align="start"
content={
<>
<DropdownItem
onClick={() => setSelectedScanType(ScanTypeEnum.VulnerabilityScan)}
>
<div className="w-4 h-4">
<VulnerabilityIcon />
</div>
Start Vulnerability Scan
</DropdownItem>
<DropdownItem
onClick={() => setSelectedScanType(ScanTypeEnum.SecretScan)}
>
<div className="w-4 h-4">
<SecretsIcon />
</div>
Start Secret Scan
</DropdownItem>
<DropdownItem
onClick={() => setSelectedScanType(ScanTypeEnum.MalwareScan)}
>
<div className="w-4 h-4">
<MalwareIcon />
</div>
Start Malware Scan
</DropdownItem>
</>
}
>
<Button
size="xs"
color="normal"
startIcon={<FaPlay />}
className="text-blue-600 dark:text-blue-500"
>
<SelectItem value={ScanTypeEnum.VulnerabilityScan}>
<div className="w-4 h-4">
<VulnerabilityIcon />
</div>
Vulnerability
</SelectItem>
<SelectItem value={ScanTypeEnum.SecretScan}>
<div className="w-4 h-4">
<SecretsIcon />
</div>
Secret
</SelectItem>
<SelectItem value={ScanTypeEnum.MalwareScan}>
<div className="w-4 h-4">
<MalwareIcon />
</div>
Malware
</SelectItem>
</Select>
</div>
Start scan
</Button>
</Dropdown>
</>
)}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { useMemo, useState } from 'react';
import { FaPlay } from 'react-icons/fa';
import { generatePath, useParams, useSearchParams } from 'react-router-dom';
import {
Button,
createColumnHelper,
Dropdown,
DropdownItem,
getRowSelectionColumn,
RowSelectionState,
Select,
SelectItem,
Table,
} from 'ui-components';

Expand Down Expand Up @@ -98,43 +100,52 @@ export const RegistryImagesTable = ({
return (
<div>
{selectedIds.length === 0 ? (
<div className="text-sm text-gray-400 font-medium py-2.5">No rows selected</div>
<div className="text-sm text-gray-400 font-medium pt-2 pb-3">
No rows selected
</div>
) : (
<>
<div className="mb-2 w-[160px]">
<Select
placeholder="Select a scan"
value={selectedScanType}
sizing="xs"
onChange={(value) => {
setSelectedScanType(
value as
| typeof ScanTypeEnum.VulnerabilityScan
| typeof ScanTypeEnum.SecretScan
| typeof ScanTypeEnum.MalwareScan,
);
}}
<Dropdown
triggerAsChild={true}
align="start"
content={
<>
<DropdownItem
onClick={() => setSelectedScanType(ScanTypeEnum.VulnerabilityScan)}
>
<div className="w-4 h-4">
<VulnerabilityIcon />
</div>
Start Vulnerability Scan
</DropdownItem>
<DropdownItem
onClick={() => setSelectedScanType(ScanTypeEnum.SecretScan)}
>
<div className="w-4 h-4">
<SecretsIcon />
</div>
Start Secret Scan
</DropdownItem>
<DropdownItem
onClick={() => setSelectedScanType(ScanTypeEnum.MalwareScan)}
>
<div className="w-4 h-4">
<MalwareIcon />
</div>
Start Malware Scan
</DropdownItem>
</>
}
>
<Button
size="xs"
color="normal"
startIcon={<FaPlay />}
className="text-blue-600 dark:text-blue-500"
>
<SelectItem value={ScanTypeEnum.VulnerabilityScan}>
<div className="w-4 h-4">
<VulnerabilityIcon />
</div>
Vulnerability
</SelectItem>
<SelectItem value={ScanTypeEnum.SecretScan}>
<div className="w-4 h-4">
<SecretsIcon />
</div>
Secret
</SelectItem>
<SelectItem value={ScanTypeEnum.MalwareScan}>
<div className="w-4 h-4">
<MalwareIcon />
</div>
Malware
</SelectItem>
</Select>
</div>
Start scan
</Button>
</Dropdown>
</>
)}
<ConfigureScanModal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const Modal: FC<ModalProps> = ({
children,
footer,
elementToFocusOnCloseRef,
width = 'w-4/12', // 33.333333%
width = '',
open,
...rest
}) => {
Expand Down