Skip to content

Commit eb8927e

Browse files
committed
Added missing categories to basic filter
1 parent 67098ee commit eb8927e

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/EventLogExpert.UI/Enums.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public enum FilterCategory
7575
[EnumMember(Value = "Keywords")] KeywordsDisplayNames,
7676
Source,
7777
[EnumMember(Value = "Task Category")] TaskCategory,
78+
[EnumMember(Value = "Process ID")] ProcessId,
79+
[EnumMember(Value = "Thread ID")] ThreadId,
80+
[EnumMember(Value = "User ID")] UserId,
7881
Description,
7982
Xml
8083
}

src/EventLogExpert.UI/Services/FilterService.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,30 @@ public bool TryParseExpression(string? expression, out string error, bool ignore
155155

156156
private static string GetComparisonString(FilterCategory type, FilterEvaluator evaluator) => evaluator switch
157157
{
158-
FilterEvaluator.Equals => type is FilterCategory.KeywordsDisplayNames ?
159-
$"{type}.Any(e => string.Equals(e, " :
160-
$"{type} == ",
158+
FilterEvaluator.Equals => type switch
159+
{
160+
FilterCategory.KeywordsDisplayNames => $"{type}.Any(e => string.Equals(e, ",
161+
FilterCategory.UserId => $"{type} != null && {type}.Value == ",
162+
_ => $"{type} == "
163+
},
161164
FilterEvaluator.Contains => type switch
162165
{
163166
FilterCategory.Id or FilterCategory.ActivityId => $"{type}.ToString().Contains",
164167
FilterCategory.KeywordsDisplayNames => $"{type}.Any(e => e.Contains",
168+
FilterCategory.UserId => $"{type} != null && {type}.Value.Contains",
165169
_ => $"{type}.Contains"
166170
},
167-
FilterEvaluator.NotEqual => type is FilterCategory.KeywordsDisplayNames ?
168-
$"!{type}.Any(e => string.Equals(e, " :
169-
$"{type} != ",
171+
FilterEvaluator.NotEqual => type switch
172+
{
173+
FilterCategory.KeywordsDisplayNames => $"!{type}.Any(e => string.Equals(e, ",
174+
FilterCategory.UserId => $"{type} != null && {type}.Value != ",
175+
_ => $"{type} != ",
176+
},
170177
FilterEvaluator.NotContains => type switch
171178
{
172179
FilterCategory.Id or FilterCategory.ActivityId => $"!{type}.ToString().Contains",
173180
FilterCategory.KeywordsDisplayNames => $"!{type}.Any(e => e.Contains",
181+
FilterCategory.UserId => $"{type} != null && !{type}.Value.Contains",
174182
_ => $"!{type}.Contains"
175183
},
176184
FilterEvaluator.MultiSelect => type switch

0 commit comments

Comments
 (0)