refactor(devices): remove secoes de alertas de postura e historico
All checks were successful
All checks were successful
This commit is contained in:
parent
ad5e26f211
commit
1a75a69d4a
1 changed files with 0 additions and 60 deletions
|
|
@ -5783,66 +5783,6 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
|
|||
</section>
|
||||
) : null}
|
||||
|
||||
{/* Postura/Alertas */}
|
||||
{Array.isArray(device?.postureAlerts) && device?.postureAlerts?.length ? (
|
||||
<section className="space-y-2">
|
||||
<h4 className="text-sm font-semibold">Alertas de postura</h4>
|
||||
<div className="space-y-2">
|
||||
{device?.postureAlerts?.map((a: { kind?: string; message?: string; severity?: string }, i: number) => (
|
||||
<div
|
||||
key={`alert-${i}`}
|
||||
className={cn(
|
||||
"flex items-center justify-between rounded-md border px-3 py-2 text-sm",
|
||||
postureSeverityClass(a?.severity)
|
||||
)}
|
||||
>
|
||||
<span className="font-medium text-foreground">{a?.message ?? formatPostureAlertKind(a?.kind)}</span>
|
||||
<Badge variant="outline">{formatPostureAlertKind(a?.kind)}</Badge>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Última avaliação: {device?.lastPostureAt ? formatRelativeTime(new Date(device.lastPostureAt)) : "—"}
|
||||
</p>
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
{!isManualMobile ? (
|
||||
<section className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<h4 className="text-sm font-semibold">Histórico de alertas</h4>
|
||||
{deviceAlertsHistory.length > 0 ? (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
Últimos {deviceAlertsHistory.length} {deviceAlertsHistory.length === 1 ? "evento" : "eventos"}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
{deviceAlertsHistory.length > 0 ? (
|
||||
<div className="relative max-h-64 overflow-y-auto pr-2">
|
||||
<div className="absolute left-3 top-3 bottom-3 w-px bg-slate-200" />
|
||||
<ol className="space-y-3 pl-6">
|
||||
{deviceAlertsHistory.map((alert) => {
|
||||
const date = new Date(alert.createdAt)
|
||||
return (
|
||||
<li key={alert.id} className="relative rounded-md border border-slate-200/80 bg-white px-3 py-2 text-xs shadow-sm">
|
||||
<span className="absolute -left-5 top-3 inline-flex size-3 items-center justify-center rounded-full border border-white bg-slate-200 ring-2 ring-white" />
|
||||
<div className={cn("flex items-center justify-between", postureSeverityClass(alert.severity))}>
|
||||
<span className="text-xs font-medium uppercase tracking-wide text-slate-600">{formatPostureAlertKind(alert.kind)}</span>
|
||||
<span className="text-xs text-slate-500">{formatRelativeTime(date)}</span>
|
||||
</div>
|
||||
<p className="mt-1 text-sm text-foreground">{alert.message ?? formatPostureAlertKind(alert.kind)}</p>
|
||||
<p className="mt-1 text-[11px] text-muted-foreground">{format(date, "dd/MM/yyyy HH:mm:ss")}</p>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ol>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-xs text-muted-foreground">Nenhum alerta registrado para este dispositivo.</p>
|
||||
)}
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
<div className="flex flex-wrap gap-2 pt-2">
|
||||
{Array.isArray(software) && software.length > 0 ? (
|
||||
<Button size="sm" variant="outline" onClick={() => exportCsv(software, "softwares.csv")}>Softwares CSV</Button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue