Beispiel #1
0
 private static void ApplyMilestone(IssueFilter filter, BoundKevValueQuery query)
 {
     if (query.IsNegated)
     {
         filter.ExcludedMilestones.Add(query.Value);
     }
     else
     {
         filter.Milestone = query.Value;
     }
 }
Beispiel #2
0
 private static void ApplyArea(IssueFilter filter, BoundKevValueQuery query)
 {
     if (query.IsNegated)
     {
         filter.ExcludedLabels.Add($"area-{query.Value}");
     }
     else
     {
         filter.IncludedLabels.Add($"area-{query.Value}");
     }
 }
Beispiel #3
0
 private static void ApplyAuthor(IssueFilter filter, BoundKevValueQuery query)
 {
     if (query.IsNegated)
     {
         filter.ExcludedAuthors.Add(query.Value);
     }
     else
     {
         filter.Author = query.Value;
     }
 }
Beispiel #4
0
 private static void ApplyAreaOwner(IssueFilter filter, BoundKevValueQuery query)
 {
     if (query.IsNegated)
     {
         filter.ExcludedAreaOwners.Add(query.Value);
     }
     else
     {
         filter.IncludedAreaOwners.Add(query.Value);
     }
 }
Beispiel #5
0
        private static void Apply(IssueFilter result, BoundKevValueQuery expression)
        {
            var key   = expression.Key.ToLowerInvariant();
            var value = expression.Value.ToLowerInvariant();

            if (_keyValueHandlers.TryGetValue((key, value), out var handler) ||
                _keyValueHandlers.TryGetValue((key, null), out handler))
            {
                handler(result, expression);
                return;
            }

            Apply(result, new BoundTextQuery(expression.IsNegated, $"{key}:{value}"));
        }
Beispiel #6
0
        private static void Apply(IssueFilter result, BoundTextQuery expression)
        {
            var terms = TextTokenizer.Tokenize(expression.Text);

            foreach (var term in terms)
            {
                if (expression.IsNegated)
                {
                    result.ExcludedTerms.Add(term);
                }
                else
                {
                    result.IncludedTerms.Add(term);
                }
            }
        }
Beispiel #7
0
        private static IssueFilter CreateFilter(BoundQuery node)
        {
            var result = new IssueFilter();

            foreach (var and in FlattenAnds(node))
            {
                switch (and)
                {
                case BoundKevValueQuery kevValueExpression:
                    Apply(result, kevValueExpression);
                    break;

                case BoundTextQuery textExpression:
                    Apply(result, textExpression);
                    break;

                default:
                    throw new Exception($"Unexpected node {and.GetType()}");
                }
            }

            return(result);
        }
Beispiel #8
0
 private static void ApplySortReactionsHeartDesc(IssueFilter filter)
 {
     filter.Sort.Add(IssueSort.ReactionsHeartDescending);
 }
Beispiel #9
0
 private static void ApplySortReactionsTada(IssueFilter filter)
 {
     filter.Sort.Add(IssueSort.ReactionsTadaAscending);
 }
Beispiel #10
0
 private static void ApplyGroupSortKey(IssueFilter filter)
 {
     filter.GroupSort.Add(IssueGroupSort.KeyAscending);
 }
Beispiel #11
0
 private static void ApplyNoLabel(IssueFilter filter, BoundKevValueQuery query)
 {
     filter.NoLabels = !query.IsNegated;
 }
Beispiel #12
0
 private static void ApplyGroupLabel(IssueFilter filter)
 {
     filter.Groups.Add(IssueGroup.Label);
 }
Beispiel #13
0
 private static void ApplyGroupAreaNode(IssueFilter filter)
 {
     filter.Groups.Add(IssueGroup.AreaNode);
 }
Beispiel #14
0
 private static void ApplyGroupAuthor(IssueFilter filter)
 {
     filter.Groups.Add(IssueGroup.Author);
 }
Beispiel #15
0
 private static void ApplyGroupOrg(IssueFilter filter)
 {
     filter.Groups.Add(IssueGroup.Org);
 }
Beispiel #16
0
 private static void ApplySortReactionsThinkingFaceDesc(IssueFilter filter)
 {
     filter.Sort.Add(IssueSort.ReactionsThinkingFaceDescending);
 }
Beispiel #17
0
 private static void ApplyNoAreaOwner(IssueFilter filter, BoundKevValueQuery query)
 {
     filter.NoAreaOwner = !query.IsNegated;
 }
Beispiel #18
0
 private static void ApplyNoMilestone(IssueFilter filter, BoundKevValueQuery query)
 {
     filter.NoMilestone = !query.IsNegated;
 }
Beispiel #19
0
 private static void ApplySortInteractionsDesc(IssueFilter filter)
 {
     filter.Sort.Add(IssueSort.InteractionsDescending);
 }
Beispiel #20
0
 private static void ApplyClosed(IssueFilter filter, BoundKevValueQuery query, RangeSyntax <DateTimeOffset> range)
 {
     filter.Closed = range.Negate(query.IsNegated);
 }
Beispiel #21
0
 private static void ApplyGroupRepo(IssueFilter filter)
 {
     filter.Groups.Add(IssueGroup.Repo);
 }
Beispiel #22
0
 private static void ApplyComments(IssueFilter filter, BoundKevValueQuery query, RangeSyntax <int> range)
 {
     filter.Comments = range.Negate(query.IsNegated);
 }
Beispiel #23
0
 private static void ApplyGroupAssignee(IssueFilter filter)
 {
     filter.Groups.Add(IssueGroup.Assignee);
 }
Beispiel #24
0
 private static void ApplyInteractions(IssueFilter filter, BoundKevValueQuery query, RangeSyntax <int> range)
 {
     filter.Interactions = range.Negate(query.IsNegated);
 }
Beispiel #25
0
 private static void ApplyGroupMilestone(IssueFilter filter)
 {
     filter.Groups.Add(IssueGroup.Milestone);
 }
Beispiel #26
0
 private static void ApplySortCreated(IssueFilter filter)
 {
     filter.Sort.Add(IssueSort.CreatedAscending);
 }
Beispiel #27
0
 private static void ApplyGroupAreaOwner(IssueFilter filter)
 {
     filter.Groups.Add(IssueGroup.AreaOwner);
 }
Beispiel #28
0
 private static void ApplySortUpdatedDesc(IssueFilter filter)
 {
     filter.Sort.Add(IssueSort.UpdatedDescending);
 }
Beispiel #29
0
 private static void ApplyGroupSortCountDesc(IssueFilter filter)
 {
     filter.GroupSort.Add(IssueGroupSort.CountDescending);
 }
Beispiel #30
0
 private static void ApplySortCommentsDesc(IssueFilter filter)
 {
     filter.Sort.Add(IssueSort.CommentsDescending);
 }