show placeholder in logs for nullable fields

This commit is contained in:
miloschwartz
2026-08-19 10:51:21 -04:00
parent e377afe9f6
commit 5f1218f7b1
5 changed files with 117 additions and 30 deletions
+29 -10
View File
@@ -294,7 +294,14 @@ export default function GeneralPage() {
}, },
{ {
accessorKey: "ip", accessorKey: "ip",
header: () => <span className="px-2">{t("ip")}</span> header: () => <span className="px-2">{t("ip")}</span>,
cell: ({ row }) => {
return row.original.ip ? (
row.original.ip
) : (
<span className="text-xs text-muted-foreground">-</span>
);
}
}, },
{ {
accessorKey: "location", accessorKey: "location",
@@ -357,7 +364,10 @@ export default function GeneralPage() {
); );
}, },
cell: ({ row }) => { cell: ({ row }) => {
if (!row.original.resourceNiceId) { if (
!row.original.resourceNiceId ||
!row.original.resourceName
) {
return ( return (
<span className="text-xs text-muted-foreground">-</span> <span className="text-xs text-muted-foreground">-</span>
); );
@@ -411,14 +421,19 @@ export default function GeneralPage() {
); );
}, },
cell: ({ row }) => { cell: ({ row }) => {
const typeLabel = const typeLabel = row.original.type
row.original.type === "ssh" || ? row.original.type === "ssh" ||
row.original.type === "rdp" || row.original.type === "rdp" ||
row.original.type === "vnc" row.original.type === "vnc"
? row.original.type.toUpperCase() ? row.original.type.toUpperCase()
: row.original.type.charAt(0).toUpperCase() + : row.original.type.charAt(0).toUpperCase() +
row.original.type.slice(1); row.original.type.slice(1)
return <span>{typeLabel || "-"}</span>; : null;
return typeLabel ? (
<span>{typeLabel}</span>
) : (
<span className="text-xs text-muted-foreground">-</span>
);
} }
}, },
{ {
@@ -455,7 +470,9 @@ export default function GeneralPage() {
{row.original.actor} {row.original.actor}
</> </>
) : ( ) : (
<>-</> <span className="text-xs text-muted-foreground">
-
</span>
)} )}
</span> </span>
); );
@@ -466,7 +483,9 @@ export default function GeneralPage() {
header: () => <span className="px-2">{t("actorId")}</span>, header: () => <span className="px-2">{t("actorId")}</span>,
cell: ({ row }) => ( cell: ({ row }) => (
<span className="flex items-center gap-1"> <span className="flex items-center gap-1">
{row.original.actorId || "-"} {row.original.actorId || (
<span className="text-xs text-muted-foreground">-</span>
)}
</span> </span>
) )
} }
+10 -2
View File
@@ -303,7 +303,11 @@ export default function GeneralPage() {
) : ( ) : (
<Key className="h-4 w-4" /> <Key className="h-4 w-4" />
)} )}
{row.original.actor} {row.original.actor || (
<span className="text-xs text-muted-foreground">
-
</span>
)}
</span> </span>
); );
} }
@@ -314,7 +318,11 @@ export default function GeneralPage() {
cell: ({ row }) => { cell: ({ row }) => {
return ( return (
<span className="flex items-center gap-1"> <span className="flex items-center gap-1">
{row.original.actorId} {row.original.actorId || (
<span className="text-xs text-muted-foreground">
-
</span>
)}
</span> </span>
); );
} }
+17 -4
View File
@@ -297,7 +297,11 @@ export default function AiSessionLogsPage() {
return ( return (
<span className="flex items-center gap-1"> <span className="flex items-center gap-1">
<Bot className="h-4 w-4" /> <Bot className="h-4 w-4" />
{row.original.providerName || "-"} {row.original.providerName || (
<span className="text-xs text-muted-foreground">
-
</span>
)}
</span> </span>
); );
} }
@@ -353,7 +357,11 @@ export default function AiSessionLogsPage() {
); );
}, },
cell: ({ row }) => { cell: ({ row }) => {
return <span>{row.original.requestedModel || "-"}</span>; return row.original.requestedModel ? (
<span>{row.original.requestedModel}</span>
) : (
<span className="text-xs text-muted-foreground">-</span>
);
} }
}, },
{ {
@@ -378,7 +386,10 @@ export default function AiSessionLogsPage() {
); );
}, },
cell: ({ row }) => { cell: ({ row }) => {
if (!row.original.resourceNiceId) { if (
!row.original.resourceNiceId ||
!row.original.resourceName
) {
return ( return (
<span className="text-xs text-muted-foreground">-</span> <span className="text-xs text-muted-foreground">-</span>
); );
@@ -471,7 +482,9 @@ export default function AiSessionLogsPage() {
{row.original.userEmail} {row.original.userEmail}
</> </>
) : ( ) : (
<>-</> <span className="text-xs text-muted-foreground">
-
</span>
)} )}
</span> </span>
); );
@@ -311,7 +311,9 @@ export default function ConnectionLogsPage() {
cell: ({ row }) => { cell: ({ row }) => {
return ( return (
<span className="whitespace-nowrap font-mono text-xs"> <span className="whitespace-nowrap font-mono text-xs">
{row.original.protocol?.toUpperCase()} {row.original.protocol?.toUpperCase() || (
<span className="text-muted-foreground">-</span>
)}
</span> </span>
); );
} }
@@ -338,7 +340,10 @@ export default function ConnectionLogsPage() {
); );
}, },
cell: ({ row }) => { cell: ({ row }) => {
if (!row.original.resourceNiceId) { if (
!row.original.resourceNiceId ||
!row.original.resourceName
) {
return ( return (
<span className="text-xs text-muted-foreground">-</span> <span className="text-xs text-muted-foreground">-</span>
); );
@@ -394,11 +399,14 @@ export default function ConnectionLogsPage() {
</Link> </Link>
); );
} }
return ( if (row.original.clientName) {
<span className="whitespace-nowrap"> return (
{row.original.clientName ?? "-"} <span className="whitespace-nowrap">
</span> {row.original.clientName}
); </span>
);
}
return <span className="text-xs text-muted-foreground">-</span>;
} }
}, },
{ {
@@ -431,17 +439,19 @@ export default function ConnectionLogsPage() {
</span> </span>
); );
} }
return <span>-</span>; return <span className="text-xs text-muted-foreground">-</span>;
} }
}, },
{ {
accessorKey: "sourceAddr", accessorKey: "sourceAddr",
header: () => <span className="px-2">{t("sourceAddress")}</span>, header: () => <span className="px-2">{t("sourceAddress")}</span>,
cell: ({ row }) => { cell: ({ row }) => {
return ( return row.original.sourceAddr ? (
<span className="whitespace-nowrap font-mono text-xs"> <span className="whitespace-nowrap font-mono text-xs">
{row.original.sourceAddr} {row.original.sourceAddr}
</span> </span>
) : (
<span className="text-xs text-muted-foreground">-</span>
); );
} }
}, },
@@ -467,10 +477,12 @@ export default function ConnectionLogsPage() {
); );
}, },
cell: ({ row }) => { cell: ({ row }) => {
return ( return row.original.destAddr ? (
<span className="whitespace-nowrap font-mono text-xs"> <span className="whitespace-nowrap font-mono text-xs">
{row.original.destAddr} {row.original.destAddr}
</span> </span>
) : (
<span className="text-xs text-muted-foreground">-</span>
); );
} }
}, },
+39 -4
View File
@@ -347,7 +347,14 @@ export default function GeneralPage() {
}, },
{ {
accessorKey: "ip", accessorKey: "ip",
header: ({ column }) => <span className="px-2">{t("ip")}</span> header: ({ column }) => <span className="px-2">{t("ip")}</span>,
cell: ({ row }) => {
return row.original.ip ? (
row.original.ip
) : (
<span className="text-xs text-muted-foreground">-</span>
);
}
}, },
{ {
accessorKey: "location", accessorKey: "location",
@@ -411,7 +418,10 @@ export default function GeneralPage() {
); );
}, },
cell: ({ row }) => { cell: ({ row }) => {
if (!row.original.resourceNiceId) { if (
!row.original.resourceNiceId ||
!row.original.resourceName
) {
return ( return (
<span className="text-xs text-muted-foreground">-</span> <span className="text-xs text-muted-foreground">-</span>
); );
@@ -458,6 +468,11 @@ export default function GeneralPage() {
); );
}, },
cell: ({ row }) => { cell: ({ row }) => {
if (!row.original.host) {
return (
<span className="text-xs text-muted-foreground">-</span>
);
}
return ( return (
<span className="flex items-center gap-1"> <span className="flex items-center gap-1">
{row.original.tls ? ( {row.original.tls ? (
@@ -490,6 +505,13 @@ export default function GeneralPage() {
/> />
</div> </div>
); );
},
cell: ({ row }) => {
return row.original.path ? (
row.original.path
) : (
<span className="text-xs text-muted-foreground">-</span>
);
} }
}, },
@@ -524,6 +546,13 @@ export default function GeneralPage() {
/> />
</div> </div>
); );
},
cell: ({ row }) => {
return row.original.method ? (
row.original.method
) : (
<span className="text-xs text-muted-foreground">-</span>
);
} }
}, },
{ {
@@ -566,7 +595,11 @@ export default function GeneralPage() {
cell: ({ row }) => { cell: ({ row }) => {
return ( return (
<span className="flex items-center gap-1"> <span className="flex items-center gap-1">
{reasonMap[row.original.reason]} {reasonMap[row.original.reason] ?? (
<span className="text-xs text-muted-foreground">
-
</span>
)}
</span> </span>
); );
} }
@@ -605,7 +638,9 @@ export default function GeneralPage() {
{row.original.actor} {row.original.actor}
</> </>
) : ( ) : (
<>-</> <span className="text-xs text-muted-foreground">
-
</span>
)} )}
</span> </span>
); );