feat(ui): add resource groups filter to findings view (#9812)

This commit is contained in:
Alejandro Bailo
2026-01-16 13:58:36 +01:00
committed by GitHub
parent 032499c29a
commit f47310bceb
6 changed files with 198 additions and 29 deletions

View File

@@ -92,7 +92,12 @@ export const getMetadataInfo = async ({
Object.entries(filters).forEach(([key, value]) => {
// Define filters to exclude
const excludedFilters = ["region__in", "service__in", "resource_type__in"];
const excludedFilters = [
"region__in",
"service__in",
"resource_type__in",
"resource_groups__in",
];
if (
key !== "filter[search]" &&
!excludedFilters.some((filter) => key.includes(filter))
@@ -127,7 +132,12 @@ export const getLatestMetadataInfo = async ({
Object.entries(filters).forEach(([key, value]) => {
// Define filters to exclude
const excludedFilters = ["region__in", "service__in", "resource_type__in"];
const excludedFilters = [
"region__in",
"service__in",
"resource_type__in",
"resource_groups__in",
];
if (
key !== "filter[search]" &&
!excludedFilters.some((filter) => key.includes(filter))

View File

@@ -117,12 +117,13 @@ export default async function Findings({
})()
: null;
// Extract unique regions, services, categories from the new endpoint
// Extract unique regions, services, categories, groups from the new endpoint
const uniqueRegions = metadataInfoData?.data?.attributes?.regions || [];
const uniqueServices = metadataInfoData?.data?.attributes?.services || [];
const uniqueResourceTypes =
metadataInfoData?.data?.attributes?.resource_types || [];
const uniqueCategories = metadataInfoData?.data?.attributes?.categories || [];
const uniqueGroups = metadataInfoData?.data?.attributes?.groups || [];
// Extract provider IDs and details using helper functions
const providerIds = providersData ? extractProviderIds(providersData) : [];
@@ -159,6 +160,7 @@ export default async function Findings({
uniqueServices={uniqueServices}
uniqueResourceTypes={uniqueResourceTypes}
uniqueCategories={uniqueCategories}
uniqueGroups={uniqueGroups}
/>
</div>
<Suspense key={searchParamsKey} fallback={<SkeletonTableFindings />}>

View File

@@ -13,7 +13,7 @@ import { Button } from "@/components/shadcn";
import { ExpandableSection } from "@/components/ui/expandable-section";
import { DataTableFilterCustom } from "@/components/ui/table";
import { useRelatedFilters } from "@/hooks";
import { getCategoryLabel } from "@/lib/categories";
import { getCategoryLabel, getGroupLabel } from "@/lib/categories";
import { FilterEntity, FilterType, ScanEntity, ScanProps } from "@/types";
import { ProviderProps } from "@/types/providers";
@@ -29,6 +29,7 @@ interface FindingsFiltersProps {
uniqueServices: string[];
uniqueResourceTypes: string[];
uniqueCategories: string[];
uniqueGroups: string[];
}
export const FindingsFilters = ({
@@ -41,6 +42,7 @@ export const FindingsFilters = ({
uniqueServices,
uniqueResourceTypes,
uniqueCategories,
uniqueGroups,
}: FindingsFiltersProps) => {
const [isExpanded, setIsExpanded] = useState(false);
@@ -80,6 +82,13 @@ export const FindingsFilters = ({
labelFormatter: getCategoryLabel,
index: 5,
},
{
key: FilterType.RESOURCE_GROUPS,
labelCheckboxGroup: "Resource Group",
values: uniqueGroups,
labelFormatter: getGroupLabel,
index: 6,
},
{
key: FilterType.SCAN,
labelCheckboxGroup: "Scan ID",

View File

@@ -1119,7 +1119,7 @@ export const KubernetesIcon: React.FC<IconSvgProps> = ({
};
export const LighthouseIcon: React.FC<IconSvgProps> = ({
size = 24,
size = 19,
width,
height,
...props
@@ -1127,39 +1127,173 @@ export const LighthouseIcon: React.FC<IconSvgProps> = ({
return (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 200 200"
width={size || width}
height={size || height}
width={width || size}
height={height || size}
viewBox="0 0 19 18"
fill="none"
stroke="var(--bg-button-primary)"
strokeWidth="12"
strokeLinecap="round"
strokeLinejoin="round"
{...props}
>
{/* Square container with rounded corners, broken top-right edge */}
<path
d="M30 50 Q30 30 50 30 H140
M30 50 V150 Q30 170 50 170 H150 Q170 170 170 150 V100"
d="M16.792 11.6488H17.2955L17.4214 12.404L18.0508 12.6557L17.4214 13.0333L17.2955 13.6627H16.792V11.6488Z"
fill="url(#paint0_linear_10004_99259)"
/>
{/* Slightly smaller center star */}
<path
d="M100 60
L114 89 L140 100
L114 111 L100 140
L86 111 L60 100
L86 89 Z"
d="M17.295 11.6488H16.7915L16.6657 12.404L15.7845 12.5299L16.6657 13.0333L16.7915 13.6627H17.295V11.6488Z"
fill="url(#paint1_linear_10004_99259)"
/>
{/* Small star in top-right corner */}
<path
d="M160 35
L168 50 L182 58
L168 66 L160 80
L152 66 L138 58
L152 50 Z"
d="M16.6985 13.1295C16.6854 13.0787 16.6589 13.0323 16.6218 12.9952C16.5847 12.9581 16.5383 12.9316 16.4875 12.9185L15.5865 12.6862C15.5711 12.6818 15.5576 12.6725 15.548 12.6598C15.5384 12.647 15.5331 12.6315 15.5331 12.6155C15.5331 12.5995 15.5384 12.584 15.548 12.5713C15.5576 12.5585 15.5711 12.5493 15.5865 12.5449L16.4875 12.3124C16.5383 12.2993 16.5847 12.2729 16.6218 12.2358C16.6589 12.1987 16.6854 12.1524 16.6985 12.1016L16.9309 11.2007C16.9352 11.1852 16.9444 11.1716 16.9572 11.162C16.97 11.1523 16.9855 11.147 17.0016 11.147C17.0176 11.147 17.0332 11.1523 17.0459 11.162C17.0587 11.1716 17.068 11.1852 17.0723 11.2007L17.3045 12.1016C17.3176 12.1524 17.3441 12.1988 17.3812 12.2359C17.4183 12.273 17.4647 12.2995 17.5155 12.3126L18.4165 12.5447C18.432 12.549 18.4456 12.5583 18.4554 12.571C18.4651 12.5838 18.4704 12.5995 18.4704 12.6155C18.4704 12.6316 18.4651 12.6472 18.4554 12.66C18.4456 12.6728 18.432 12.682 18.4165 12.6863L17.5155 12.9185C17.4647 12.9316 17.4183 12.9581 17.3812 12.9952C17.3441 13.0323 17.3176 13.0787 17.3045 13.1295L17.0721 14.0304C17.0678 14.0458 17.0586 14.0594 17.0458 14.0691C17.033 14.0788 17.0174 14.084 17.0014 14.084C16.9854 14.084 16.9698 14.0788 16.957 14.0691C16.9443 14.0594 16.935 14.0458 16.9307 14.0304L16.6985 13.1295Z"
stroke="url(#paint2_linear_10004_99259)"
strokeWidth="0.643499"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M2.31079 4.89459H3.04694L3.23098 5.99873L4.15116 6.36677L3.23098 6.91884L3.04694 7.83895H2.31079V4.89459Z"
fill="url(#paint3_linear_10004_99259)"
/>
<path
d="M3.04706 4.89459H2.31091L2.12687 5.99873L0.838614 6.18275L2.12687 6.91884L2.31091 7.83895H3.04706V4.89459Z"
fill="url(#paint4_linear_10004_99259)"
/>
<path
d="M2.17422 7.05874C2.15505 6.98444 2.11632 6.91664 2.06206 6.86238C2.0078 6.80812 1.93999 6.7694 1.86568 6.75023L0.54844 6.41059C0.525966 6.40421 0.506187 6.39067 0.492102 6.37204C0.478018 6.3534 0.470398 6.33068 0.470398 6.30732C0.470398 6.28396 0.478018 6.26124 0.492102 6.2426C0.506187 6.22396 0.525966 6.21043 0.54844 6.20405L1.86568 5.86419C1.93996 5.84504 2.00776 5.80635 2.06202 5.75213C2.11628 5.69792 2.15502 5.63015 2.17422 5.5559L2.51389 4.23876C2.52021 4.2162 2.53373 4.19632 2.5524 4.18216C2.57106 4.168 2.59385 4.16034 2.61728 4.16034C2.64071 4.16034 2.66349 4.168 2.68216 4.18216C2.70082 4.19632 2.71435 4.2162 2.72066 4.23876L3.06012 5.5559C3.07928 5.63019 3.11801 5.698 3.17228 5.75226C3.22654 5.80651 3.29435 5.84524 3.36865 5.86441L4.6859 6.20384C4.70855 6.21009 4.72853 6.22359 4.74276 6.24228C4.757 6.26098 4.76471 6.28382 4.76471 6.30732C4.76471 6.33082 4.757 6.35366 4.74276 6.37235C4.72853 6.39105 4.70855 6.40455 4.6859 6.4108L3.36865 6.75023C3.29435 6.7694 3.22654 6.80812 3.17228 6.86238C3.11801 6.91664 3.07928 6.98444 3.06012 7.05874L2.72044 8.37588C2.71413 8.39844 2.70061 8.41832 2.68194 8.43248C2.66328 8.44664 2.64049 8.4543 2.61706 8.4543C2.59363 8.4543 2.57085 8.44664 2.55218 8.43248C2.53351 8.41832 2.51999 8.39844 2.51368 8.37588L2.17422 7.05874Z"
stroke="url(#paint5_linear_10004_99259)"
strokeWidth="0.940817"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M7.42609 2.81921C11.9573 2.81921 13.3237 2.85331 13.7679 2.97546C16.3331 3.65291 18.0099 6.18425 17.5882 8.73816C17.4875 9.31539 17.2796 9.8738 16.9905 10.3885L16.9407 10.1913L16.9378 10.1825L16.9105 10.1073C16.8878 10.0584 16.8567 10.0136 16.8196 9.97449L16.7591 9.9198L16.6907 9.87683C16.6195 9.83923 16.5397 9.81922 16.4583 9.81921C16.3769 9.81924 16.2972 9.83916 16.2259 9.87683L16.1575 9.9198C16.0926 9.96912 16.0412 10.0341 16.0071 10.1073L15.9788 10.1825L15.9769 10.1913L15.6888 11.3055L14.5735 11.5936L14.5648 11.5966C14.4866 11.6187 14.415 11.6592 14.3568 11.7147L14.303 11.7753C14.2379 11.8616 14.2025 11.9669 14.2025 12.0751C14.2025 12.1833 14.2378 12.2895 14.303 12.3759C14.3684 12.462 14.4607 12.5241 14.5648 12.5536L14.5638 12.5546L14.5735 12.5565L14.6956 12.5878C14.6713 12.5997 14.6479 12.6133 14.6234 12.6249C13.8904 12.9691 13.8233 12.9802 12.0911 13.0135L10.3138 13.0585L9.75812 12.4921C9.45833 12.1812 9.16972 11.9257 9.12531 11.9257C9.08095 11.9293 9.03644 13.1718 9.03644 14.702V17.4784H5.14972V7.47644L5.29523 7.38855L6.25714 7.14148L6.26984 7.13757C6.46419 7.08384 6.63587 6.96787 6.75812 6.8075C6.88031 6.64687 6.94757 6.44974 6.94757 6.24792C6.94746 6.09685 6.91016 5.94847 6.84015 5.81628L6.75812 5.68933L6.65753 5.57703C6.58501 5.50863 6.50193 5.45184 6.41144 5.41003L6.26984 5.35828L6.25714 5.35535L4.19073 4.82214L3.67413 2.81921H7.42609ZM9.0589 7.95007L9.0921 9.09363L10.7581 9.12683C11.7576 9.14904 12.5906 9.1157 12.846 9.03796C13.3013 8.90462 13.7015 8.39421 13.7015 7.95007C13.7014 7.58362 13.3897 7.08369 13.0677 6.93933C12.9111 6.86172 12.0341 6.81726 10.9134 6.81726H9.0257L9.0589 7.95007ZM1.81476 2.9823L1.65167 2.81921H1.85675L1.81476 2.9823Z"
fill="url(#paint6_linear_10004_99259)"
/>
<path
d="M16.7691 0.565186H17.114L17.2002 1.08243L17.6313 1.25485L17.2002 1.51347L17.114 1.94451H16.7691V0.565186Z"
fill="url(#paint7_linear_10004_99259)"
/>
<path
d="M17.1139 0.565186H16.769L16.6828 1.08243L16.0793 1.16864L16.6828 1.51347L16.769 1.94451H17.1139V0.565186Z"
fill="url(#paint8_linear_10004_99259)"
/>
<path
d="M16.7049 1.5782C16.6959 1.54339 16.6778 1.51163 16.6524 1.48621C16.627 1.46079 16.5952 1.44265 16.5604 1.43367L15.9433 1.27456C15.9328 1.27157 15.9235 1.26523 15.9169 1.2565C15.9103 1.24777 15.9067 1.23713 15.9067 1.22618C15.9067 1.21524 15.9103 1.2046 15.9169 1.19586C15.9235 1.18713 15.9328 1.18079 15.9433 1.17781L16.5604 1.01859C16.5952 1.00962 16.6269 0.991496 16.6524 0.966097C16.6778 0.940698 16.6959 0.908955 16.7049 0.874167L16.864 0.257133C16.867 0.246565 16.8733 0.237254 16.8821 0.230621C16.8908 0.223988 16.9015 0.220398 16.9125 0.220398C16.9235 0.220398 16.9341 0.223988 16.9429 0.230621C16.9516 0.237254 16.9579 0.246565 16.9609 0.257133L17.1199 0.874167C17.1289 0.908973 17.1471 0.940738 17.1725 0.966155C17.1979 0.991573 17.2297 1.00972 17.2645 1.01869L17.8816 1.1777C17.8922 1.18063 17.9015 1.18696 17.9082 1.19572C17.9149 1.20447 17.9185 1.21518 17.9185 1.22618C17.9185 1.23719 17.9149 1.24789 17.9082 1.25665C17.9015 1.26541 17.8922 1.27173 17.8816 1.27466L17.2645 1.43367C17.2297 1.44265 17.1979 1.46079 17.1725 1.48621C17.1471 1.51163 17.1289 1.54339 17.1199 1.5782L16.9608 2.19523C16.9578 2.2058 16.9515 2.21511 16.9428 2.22174C16.934 2.22838 16.9234 2.23197 16.9124 2.23197C16.9014 2.23197 16.8907 2.22838 16.882 2.22174C16.8732 2.21511 16.8669 2.2058 16.8639 2.19523L16.7049 1.5782Z"
stroke="url(#paint9_linear_10004_99259)"
strokeWidth="0.44074"
strokeLinecap="round"
strokeLinejoin="round"
/>
<defs>
<linearGradient
id="paint0_linear_10004_99259"
x1="16.8241"
y1="11.8964"
x2="18.1535"
y2="11.9909"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#2EE59B" />
<stop offset="1" stopColor="#62DFF0" />
</linearGradient>
<linearGradient
id="paint1_linear_10004_99259"
x1="17.2565"
y1="11.8964"
x2="15.6648"
y2="12.0322"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#2EE59B" />
<stop offset="1" stopColor="#62DFF0" />
</linearGradient>
<linearGradient
id="paint2_linear_10004_99259"
x1="15.6082"
y1="11.5082"
x2="18.6858"
y2="11.8582"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#2EE59B" />
<stop offset="1" stopColor="#62DFF0" />
</linearGradient>
<linearGradient
id="paint3_linear_10004_99259"
x1="3.23098"
y1="4.89459"
x2="3.23098"
y2="7.83895"
gradientUnits="userSpaceOnUse"
>
<stop offset="0.0673077" stopColor="#0A776E" />
<stop offset="0.831731" stopColor="#23C176" />
</linearGradient>
<linearGradient
id="paint4_linear_10004_99259"
x1="1.94284"
y1="4.89459"
x2="1.94284"
y2="7.83895"
gradientUnits="userSpaceOnUse"
>
<stop offset="0.0673077" stopColor="#0A776E" />
<stop offset="0.831731" stopColor="#23C176" />
</linearGradient>
<linearGradient
id="paint5_linear_10004_99259"
x1="0.580082"
y1="4.68836"
x2="5.07973"
y2="5.20013"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#2EE59B" />
<stop offset="1" stopColor="#62DFF0" />
</linearGradient>
<linearGradient
id="paint6_linear_10004_99259"
x1="2.06038"
y1="4.62182"
x2="18.786"
y2="6.69814"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#2EE59B" />
<stop offset="1" stopColor="#62DFF0" />
</linearGradient>
<linearGradient
id="paint7_linear_10004_99259"
x1="17.2002"
y1="0.565186"
x2="17.2002"
y2="1.94451"
gradientUnits="userSpaceOnUse"
>
<stop offset="0.0673077" stopColor="#0A776E" />
<stop offset="0.831731" stopColor="#23C176" />
</linearGradient>
<linearGradient
id="paint8_linear_10004_99259"
x1="16.5966"
y1="0.565186"
x2="16.5966"
y2="1.94451"
gradientUnits="userSpaceOnUse"
>
<stop offset="0.0673077" stopColor="#0A776E" />
<stop offset="0.831731" stopColor="#23C176" />
</linearGradient>
<linearGradient
id="paint9_linear_10004_99259"
x1="15.9581"
y1="0.467756"
x2="18.0661"
y2="0.707504"
gradientUnits="userSpaceOnUse"
>
<stop stopColor="#2EE59B" />
<stop offset="1" stopColor="#62DFF0" />
</linearGradient>
</defs>
</svg>
);
};

View File

@@ -51,6 +51,19 @@ export function getCategoryLabel(id: string): string {
return formatLabel(id, "-");
}
/**
* Converts a resource group ID to a human-readable label.
* Convenience wrapper for formatLabel with "_" delimiter.
*
* Examples:
* - "ai_ml" -> "AI ML"
* - "api_gateway" -> "API Gateway"
* - "iam" -> "IAM"
*/
export function getGroupLabel(id: string): string {
return formatLabel(id, "_");
}
export function formatWord(word: string): string {
const lowerWord = word.toLowerCase();

View File

@@ -35,4 +35,5 @@ export enum FilterType {
STATUS = "status__in",
DELTA = "delta__in",
CATEGORY = "category__in",
RESOURCE_GROUPS = "resource_groups__in",
}