mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-09 21:14:22 +00:00
feat(ui): hint the resource re-check beside Last seen (#12883)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user