feat(ui): hint the resource re-check beside Last seen (#12883)

This commit is contained in:
Alejandro Bailo
2026-09-25 14:55:21 +02:00
committed by GitHub
parent 26d9d24e5d
commit c2b8092461
8 changed files with 273 additions and 32 deletions
+23
View File
@@ -0,0 +1,23 @@
"use client";
import { useAuth } from "@/hooks/use-auth";
import {
isPartialScanAvailable,
isPartialScanTarget,
} from "@/lib/partial-scans";
import { isCloud } from "@/lib/shared/env";
import type { PartialScanTarget } from "@/types/partial-scans";
/** The target to re-check, or null when the feature or the row cannot offer it. */
export function usePartialScanTarget(
target: Partial<PartialScanTarget> | null | undefined,
): PartialScanTarget | null {
const { hasPermission } = useAuth();
const isAvailable = isPartialScanAvailable({
cloudEnabled: isCloud(),
canManageScans: hasPermission("manage_scans"),
});
return isAvailable && isPartialScanTarget(target) ? target : null;
}