feat(auditlog): multi-value AuditLogQueryFilter dimensions
This commit is contained in:
@@ -114,10 +114,10 @@ public sealed class AuditQueryModel
|
||||
var (fromUtc, toUtc) = ResolveTimeWindow(utcNow);
|
||||
|
||||
return new AuditLogQueryFilter(
|
||||
Channel: Channels.Count > 0 ? Channels.First() : null,
|
||||
Kind: Kinds.Count > 0 ? Kinds.First() : null,
|
||||
Status: status,
|
||||
SourceSiteId: SiteIdentifiers.Count > 0 ? SiteIdentifiers.First() : null,
|
||||
Channels: Channels.Count > 0 ? new[] { Channels.First() } : null,
|
||||
Kinds: Kinds.Count > 0 ? new[] { Kinds.First() } : null,
|
||||
Statuses: status is { } s ? new[] { s } : null,
|
||||
SourceSiteIds: SiteIdentifiers.Count > 0 ? new[] { SiteIdentifiers.First() } : null,
|
||||
Target: string.IsNullOrWhiteSpace(TargetSearch) ? null : TargetSearch.Trim(),
|
||||
Actor: string.IsNullOrWhiteSpace(ActorSearch) ? null : ActorSearch.Trim(),
|
||||
CorrelationId: null,
|
||||
|
||||
@@ -129,9 +129,9 @@ public partial class AuditLogPage
|
||||
}
|
||||
|
||||
_currentFilter = new AuditLogQueryFilter(
|
||||
Channel: channel,
|
||||
Status: status,
|
||||
SourceSiteId: site,
|
||||
Channels: channel is { } ch ? new[] { ch } : null,
|
||||
Statuses: status is { } st ? new[] { st } : null,
|
||||
SourceSiteIds: site is { } siteId ? new[] { siteId } : null,
|
||||
Target: target,
|
||||
Actor: actor,
|
||||
CorrelationId: correlationId);
|
||||
@@ -181,21 +181,24 @@ public partial class AuditLogPage
|
||||
}
|
||||
|
||||
var parts = new List<KeyValuePair<string, string?>>(9);
|
||||
if (filter.Channel is { } ch)
|
||||
// Task 8: the filter dimensions are multi-value now; the export query-string
|
||||
// is still single-value, so emit the first selected value of each list.
|
||||
// Task 9 widens the query-string contract to carry the full set.
|
||||
if (filter.Channels is { Count: > 0 } channels)
|
||||
{
|
||||
parts.Add(new("channel", ch.ToString()));
|
||||
parts.Add(new("channel", channels[0].ToString()));
|
||||
}
|
||||
if (filter.Kind is { } kind)
|
||||
if (filter.Kinds is { Count: > 0 } kinds)
|
||||
{
|
||||
parts.Add(new("kind", kind.ToString()));
|
||||
parts.Add(new("kind", kinds[0].ToString()));
|
||||
}
|
||||
if (filter.Status is { } status)
|
||||
if (filter.Statuses is { Count: > 0 } statuses)
|
||||
{
|
||||
parts.Add(new("status", status.ToString()));
|
||||
parts.Add(new("status", statuses[0].ToString()));
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(filter.SourceSiteId))
|
||||
if (filter.SourceSiteIds is { Count: > 0 } sourceSiteIds && !string.IsNullOrWhiteSpace(sourceSiteIds[0]))
|
||||
{
|
||||
parts.Add(new("site", filter.SourceSiteId));
|
||||
parts.Add(new("site", sourceSiteIds[0]));
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(filter.Target))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user