Skip to content

Commit 16fb708

Browse files
Hub: filter by status
1 parent 93ba60e commit 16fb708

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/Certify.Server/Certify.Server.Hub.Api.Client/Certify.Server.Hub.Api.Client.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3349,9 +3349,9 @@ public virtual async System.Threading.Tasks.Task<ActionResult> RemoveAcmeAccount
33493349
/// </summary>
33503350
/// <returns>OK</returns>
33513351
/// <exception cref="ApiException">A server side error occurred.</exception>
3352-
public virtual System.Threading.Tasks.Task<ManagedCertificateSummaryResult> GetHubManagedItemsAsync(string instanceId, string keyword, int? page, int? pageSize)
3352+
public virtual System.Threading.Tasks.Task<ManagedCertificateSummaryResult> GetHubManagedItemsAsync(string instanceId, string keyword, ManagedCertificateHealth? health, int? page, int? pageSize)
33533353
{
3354-
return GetHubManagedItemsAsync(instanceId, keyword, page, pageSize, System.Threading.CancellationToken.None);
3354+
return GetHubManagedItemsAsync(instanceId, keyword, health, page, pageSize, System.Threading.CancellationToken.None);
33553355
}
33563356

33573357
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
@@ -3360,7 +3360,7 @@ public virtual System.Threading.Tasks.Task<ManagedCertificateSummaryResult> GetH
33603360
/// </summary>
33613361
/// <returns>OK</returns>
33623362
/// <exception cref="ApiException">A server side error occurred.</exception>
3363-
public virtual async System.Threading.Tasks.Task<ManagedCertificateSummaryResult> GetHubManagedItemsAsync(string instanceId, string keyword, int? page, int? pageSize, System.Threading.CancellationToken cancellationToken)
3363+
public virtual async System.Threading.Tasks.Task<ManagedCertificateSummaryResult> GetHubManagedItemsAsync(string instanceId, string keyword, ManagedCertificateHealth? health, int? page, int? pageSize, System.Threading.CancellationToken cancellationToken)
33643364
{
33653365
var client_ = _httpClient;
33663366
var disposeClient_ = false;
@@ -3384,6 +3384,10 @@ public virtual async System.Threading.Tasks.Task<ManagedCertificateSummaryResult
33843384
{
33853385
urlBuilder_.Append(System.Uri.EscapeDataString("keyword")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(keyword, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
33863386
}
3387+
if (health != null)
3388+
{
3389+
urlBuilder_.Append(System.Uri.EscapeDataString("health")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(health, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
3390+
}
33873391
if (page != null)
33883392
{
33893393
urlBuilder_.Append(System.Uri.EscapeDataString("page")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(page, System.Globalization.CultureInfo.InvariantCulture))).Append('&');

src/Certify.Server/Certify.Server.Hub.Api/Controllers/internal/HubController.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public HubController(ILogger<CertificateController> logger, ICertifyInternalApiC
4747
[Route("items")]
4848
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
4949
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ManagedCertificateSummaryResult))]
50-
public async Task<IActionResult> GetHubManagedItems(string? instanceId, string? keyword, int? page = null, int? pageSize = null)
50+
public async Task<IActionResult> GetHubManagedItems(string? instanceId, string? keyword, Models.ManagedCertificateHealth? health = null, int? page = null, int? pageSize = null)
5151
{
5252
var result = new ManagedCertificateSummaryResult();
5353

@@ -57,13 +57,15 @@ public async Task<IActionResult> GetHubManagedItems(string? instanceId, string?
5757
result.TotalResults = managedItems.Values.SelectMany(s => s.Items).Count();
5858

5959
var list = new List<ManagedCertificateSummary>();
60+
6061
foreach (var remote in managedItems.Values)
6162
{
6263
if (string.IsNullOrEmpty(instanceId) || (instanceId == remote.InstanceId))
6364
{
6465
list.AddRange(
6566
remote.Items
66-
.Where(i => string.IsNullOrWhiteSpace(keyword) || (!string.IsNullOrWhiteSpace(keyword) && i.Name?.Contains(keyword) == true))
67+
.Where(i => string.IsNullOrWhiteSpace(keyword) || (!string.IsNullOrWhiteSpace(keyword) && i.Name?.Contains(keyword, StringComparison.InvariantCultureIgnoreCase) == true))
68+
.Where(i => health == null || (health != null && i.Health == health))
6769
.Select(i =>
6870
{
6971
var instance = instances.FirstOrDefault(i => i.InstanceId == remote.InstanceId);

0 commit comments

Comments
 (0)