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

Show details of resources from posture scan result #1698

Merged
merged 4 commits into from
Oct 31, 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 @@ -131,6 +131,7 @@ const DetailsComponent = () => {
'description',
'control_id',
'status',
'resources',
// 'compliance_check_type',
];

Expand Down Expand Up @@ -179,6 +180,26 @@ const DetailsComponent = () => {
</div>
);
})}
{cloudPosture.resources?.length ? (
<div className="flex flex-col grow basis-[100%] max-w-full gap-1 group">
<div className="basis-[45%] flex relative">
<div className="text-p3 dark:text-text-text-and-icon">Resources</div>
<CopyField value={JSON.stringify(cloudPosture.resources)} />
</div>
<div className="text-p1 flex flex-col">
{cloudPosture.resources.map((resource) => {
return (
<div
key={resource.node_id}
className="text-p1 dark:text-text-input-value break-words"
>
{resource.name}
</div>
);
})}
</div>
</div>
) : null}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import {

import { ModelCompliance } from '@/api/generated';
import { useCopyToClipboardState } from '@/components/CopyToClipboard';
import { DFLink } from '@/components/DFLink';
import { CheckIcon } from '@/components/icons/common/Check';
import { CopyLineIcon } from '@/components/icons/common/CopyLine';
import { PopOutIcon } from '@/components/icons/common/PopOut';
import { PostureStatusBadge } from '@/components/SeverityBadge';
import { PostureIcon } from '@/components/sideNavigation/icons/Posture';
import { queries } from '@/queries';
Expand Down Expand Up @@ -125,7 +127,12 @@ const DetailsComponent = () => {
}
const posture = postures[0];

const omitFields: (keyof ModelCompliance)[] = ['test_number', 'status', 'description'];
const omitFields: (keyof ModelCompliance)[] = [
'test_number',
'status',
'description',
'resources',
];

return (
<div className="flex flex-wrap gap-y-[30px] gap-x-[14px]">
Expand Down Expand Up @@ -172,6 +179,43 @@ const DetailsComponent = () => {
</div>
);
})}
{posture.resources?.length ? (
<div className="flex flex-col grow basis-[100%] max-w-full gap-1 group">
<div className="basis-[45%] flex relative">
<div className="text-p3 dark:text-text-text-and-icon">Resources</div>
<CopyField value={JSON.stringify(posture.resources)} />
</div>
<div className="text-p1 flex flex-col">
{posture.resources.map((resource) => {
if (!resource.node_id || !resource.node_type) {
return null;
}
let redirectPath = '';
if (resource.node_type === 'host') {
redirectPath = `host?hosts=${resource.node_id}`;
} else if (resource.node_type === 'container') {
redirectPath = `container?containers=${resource.node_id}`;
} else if (resource.node_type === 'cluster') {
redirectPath = `kubernetes_cluster?clusters=${resource.node_id}`;
}
return (
<DFLink
key={resource.node_id}
to={`/topology/table/${redirectPath}`}
target="_blank"
rel="noreferrer"
className="text-p2 flex items-center gap-3"
>
<span className="h-4 w-4 shrink-0">
<PopOutIcon />
</span>
<span className="truncate">{resource.name}</span>
</DFLink>
);
})}
</div>
</div>
) : null}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const Container = (props: ContainerModalProps) => {
value: 'metadata',
},
{
label: 'Monitoring',
label: 'Security Scans',
value: 'scan-results',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ContainerImage = (props: ContainerImageModalProps) => {
value: 'metadata',
},
{
label: 'Monitoring',
label: 'Security Scans',
value: 'scan-results',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const Host = (props: HostModalProps) => {
value: 'metadata',
},
{
label: 'Monitoring',
label: 'Security Scans',
value: 'scan-results',
},
{
Expand Down