mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-03-22 03:08:23 +00:00
feat(ui): add loading transition and TreeSpinner to drill-down
- Show opacity transition on groups table when drilling down - Use TreeSpinner with "Loading resources..." text in drill-down view - Match provider wizard spinner style with button-primary color Ref: PROWLER-881
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
RowSelectionState,
|
||||
useReactTable,
|
||||
} from "@tanstack/react-table";
|
||||
import { ChevronLeft, Loader2 } from "lucide-react";
|
||||
import { ChevronLeft } from "lucide-react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { SeverityBadge, StatusFindingBadge } from "@/components/ui/table";
|
||||
import { TreeSpinner } from "@/components/shadcn/tree-view/tree-spinner";
|
||||
import { useInfiniteResources } from "@/hooks/use-infinite-resources";
|
||||
import { cn, hasDateOrScanFilter } from "@/lib";
|
||||
import { FindingGroupRow, FindingResourceRow } from "@/types";
|
||||
@@ -250,8 +251,11 @@ export function FindingsGroupDrillDown({
|
||||
|
||||
{/* Loading indicator */}
|
||||
{isLoading && (
|
||||
<div className="flex items-center justify-center py-8">
|
||||
<Loader2 className="text-text-neutral-tertiary size-6 animate-spin" />
|
||||
<div className="flex items-center justify-center gap-2 py-8">
|
||||
<TreeSpinner className="size-6" />
|
||||
<span className="text-text-neutral-tertiary text-sm">
|
||||
Loading resources...
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ export function FindingsGroupTable({
|
||||
const [expandedGroup, setExpandedGroup] = useState<FindingGroupRow | null>(
|
||||
null,
|
||||
);
|
||||
const [isDrillingDown, setIsDrillingDown] = useState(false);
|
||||
|
||||
// Track finding group IDs to detect data changes (e.g., after muting)
|
||||
const currentIds = (data ?? []).map((g) => g.id).join(",");
|
||||
@@ -82,9 +83,14 @@ export function FindingsGroupTable({
|
||||
};
|
||||
|
||||
const handleDrillDown = (checkId: string, group: FindingGroupRow) => {
|
||||
setExpandedCheckId(checkId);
|
||||
setExpandedGroup(group);
|
||||
setIsDrillingDown(true);
|
||||
setRowSelection({});
|
||||
// Brief loading state before switching to drill-down view
|
||||
setTimeout(() => {
|
||||
setExpandedCheckId(checkId);
|
||||
setExpandedGroup(group);
|
||||
setIsDrillingDown(false);
|
||||
}, 150);
|
||||
};
|
||||
|
||||
const handleCollapse = () => {
|
||||
@@ -128,6 +134,7 @@ export function FindingsGroupTable({
|
||||
getRowCanSelect={getRowCanSelect}
|
||||
showSearch
|
||||
searchPlaceholder="Search by Check ID"
|
||||
isLoading={isDrillingDown}
|
||||
/>
|
||||
|
||||
{selectedFindingIds.length > 0 && (
|
||||
|
||||
Reference in New Issue
Block a user