mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-24 20:53:06 +00:00
fixed nul ref and changed agent version display
This commit is contained in:
@@ -240,7 +240,7 @@ namespace AutopilotMonitor.Functions.Services
|
||||
var groups = matchingEvents
|
||||
.Select(e => new { Event = e, Key = GetDataFieldValue(e, condition.DataField) })
|
||||
.Where(x => !string.IsNullOrEmpty(x.Key))
|
||||
.GroupBy(x => x.Key, StringComparer.OrdinalIgnoreCase)
|
||||
.GroupBy(x => x.Key!, StringComparer.OrdinalIgnoreCase)
|
||||
.Where(g => g.Count() >= groupThreshold)
|
||||
.ToList();
|
||||
|
||||
@@ -248,20 +248,27 @@ namespace AutopilotMonitor.Functions.Services
|
||||
{
|
||||
var worst = groups.OrderByDescending(g => g.Count()).First();
|
||||
var firstEvent = worst.First().Event;
|
||||
var appName = GetDataFieldValue(firstEvent, "appName") ?? worst.Key;
|
||||
var groupKey = worst.Key;
|
||||
var appName = GetDataFieldValue(firstEvent, "appName") ?? groupKey;
|
||||
return (true, new Dictionary<string, object>
|
||||
{
|
||||
["eventId"] = firstEvent.EventId,
|
||||
["eventId"] = firstEvent.EventId ?? string.Empty,
|
||||
["sequence"] = firstEvent.Sequence,
|
||||
["timestamp"] = firstEvent.Timestamp,
|
||||
["groupKey"] = worst.Key,
|
||||
["appName"] = appName,
|
||||
["groupKey"] = groupKey,
|
||||
["appName"] = appName ?? groupKey,
|
||||
["count"] = worst.Count(),
|
||||
["threshold"] = groupThreshold
|
||||
});
|
||||
}
|
||||
|
||||
return (false, new Dictionary<string, object> { ["totalEvents"] = matchingEvents.Count, ["distinctApps"] = matchingEvents.Select(e => GetDataFieldValue(e, condition.DataField)).Where(k => k != null).Distinct(StringComparer.OrdinalIgnoreCase).Count() });
|
||||
var distinctApps = matchingEvents
|
||||
.Select(e => GetDataFieldValue(e, condition.DataField))
|
||||
.Where(k => k != null)
|
||||
.Cast<string>()
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Count();
|
||||
return (false, new Dictionary<string, object> { ["totalEvents"] = matchingEvents.Count, ["distinctApps"] = distinctApps });
|
||||
}
|
||||
|
||||
// count_gte: global count across all matching events
|
||||
|
||||
@@ -1512,7 +1512,7 @@ function DeviceDetailsCard({ events }: { events: EnrollmentEvent[] }) {
|
||||
<DetailRow label="Boot Time" value={new Date(bootTime?.bootTime || agentStarted?.bootTime).toLocaleString()} />
|
||||
)}
|
||||
{bootTime?.uptimeMinutes && <DetailRow label="Uptime until enrollment starts" value={`${Math.floor(bootTime.uptimeMinutes / 60)}h ${bootTime.uptimeMinutes % 60}m`} />}
|
||||
{agentStarted?.agentVersion && <DetailRow label="Monitor Agent Version" value={agentStarted.agentVersion} />}
|
||||
{agentStarted?.agentVersion && <DetailRow label="Monitor Agent Version" value={agentStarted.agentVersion.replace(/\+[0-9a-f]{8,}$/, v => v.slice(0, 8))} />}
|
||||
{imeVersion && <DetailRow label="IME Agent Version" value={imeVersion.version ?? imeVersion.agentVersion ?? "Unknown"} />}
|
||||
{(deviceLocation?.country || deviceLocation?.Country) && (
|
||||
<DetailRow label="Country" value={deviceLocation.country ?? deviceLocation.Country} />
|
||||
|
||||
Reference in New Issue
Block a user