Skip to content

Commit

Permalink
Fixed pagination in data source handler
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalii-bezuhlyi committed Sep 5, 2024
1 parent d732fc4 commit c4e55d7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Apps.XTM/DataSourceHandlers/ProjectDataHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Apps.XTM.Actions;
using Apps.XTM.Invocables;
using Apps.XTM.Models.Request.Projects;
using Blackbird.Applications.Sdk.Common.Dynamic;
using Blackbird.Applications.Sdk.Common.Invocation;

Expand All @@ -12,11 +11,9 @@ public class ProjectDataHandler(InvocationContext invocationContext)
public async Task<Dictionary<string, string>> GetDataAsync(DataSourceContext context, CancellationToken cancellationToken)
{
var actions = new ProjectActions(InvocationContext, null!);
var response = await actions.ListProjects(new ListProjectsRequest());
var response = await actions.ListProjects(new() { Name = context.SearchString });

return response.Projects
.Where(x => context.SearchString == null || x.Name.Contains(context.SearchString, StringComparison.OrdinalIgnoreCase))
.Take(20)
.ToDictionary(x => x.Id, x => x.Name);
}
}

0 comments on commit c4e55d7

Please sign in to comment.