Skip to content

Commit 39705d5

Browse files
committed
fix: address PR review feedback
- Fix typo: 'Highest completed versioned' → 'Highest completed version' - Fix Migrations sidebar icon: Play → DatabaseZap to match routes.svelte.ts - Fix nullable dereference warnings in AdminControllerTests: split Terms()?.Buckets into separate assertions - Fix generic catch clause in AdminController: catch Exception, log error before returning Problem
1 parent 628aa36 commit 39705d5

4 files changed

Lines changed: 21 additions & 8 deletions

File tree

src/Exceptionless.Web/ClientApp/src/routes/(app)/(components)/layouts/sidebar-user.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import GitHub from '@lucide/svelte/icons/github';
2828
import LayoutDashboard from '@lucide/svelte/icons/layout-dashboard';
2929
import LogOut from '@lucide/svelte/icons/log-out';
30+
import DatabaseZap from '@lucide/svelte/icons/database-zap';
3031
import Play from '@lucide/svelte/icons/play';
3132
import Plus from '@lucide/svelte/icons/plus';
3233
import Settings from '@lucide/svelte/icons/settings';
@@ -221,7 +222,7 @@
221222
<A variant="ghost" href={resolve('/(app)/system/actions')} class="w-full" onclick={onMenuClick}>Actions</A>
222223
</DropdownMenu.Item>
223224
<DropdownMenu.Item>
224-
<Play />
225+
<DatabaseZap />
225226
<A variant="ghost" href={resolve('/(app)/system/migrations')} class="w-full" onclick={onMenuClick}>Migrations</A>
226227
</DropdownMenu.Item>
227228
</DropdownMenu.SubContent>

src/Exceptionless.Web/ClientApp/src/routes/(app)/system/migrations/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
</Card.Header>
8888
<Card.Content>
8989
<div class="text-2xl font-bold">{data.current_version >= 0 ? data.current_version : ''}</div>
90-
<Muted>Highest completed versioned</Muted>
90+
<Muted>Highest completed version</Muted>
9191
</Card.Content>
9292
</Card.Root>
9393
<Card.Root>

src/Exceptionless.Web/Controllers/AdminController.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace Exceptionless.Web.Controllers;
2828
[ApiExplorerSettings(IgnoreApi = true)]
2929
public class AdminController : ExceptionlessApiController
3030
{
31+
private readonly ILogger _logger;
3132
private readonly ExceptionlessElasticConfiguration _configuration;
3233
private readonly IFileStorage _fileStorage;
3334
private readonly IMessagePublisher _messagePublisher;
@@ -58,8 +59,10 @@ public AdminController(
5859
BillingManager billingManager,
5960
BillingPlans plans,
6061
IMigrationStateRepository migrationStateRepository,
61-
TimeProvider timeProvider) : base(timeProvider)
62+
TimeProvider timeProvider,
63+
ILoggerFactory loggerFactory) : base(timeProvider)
6264
{
65+
_logger = loggerFactory.CreateLogger<AdminController>();
6366
_configuration = configuration;
6467
_fileStorage = fileStorage;
6568
_messagePublisher = messagePublisher;
@@ -407,8 +410,9 @@ public async Task<ActionResult<ElasticsearchSnapshotsResponse>> GetElasticsearch
407410

408411
return Ok(new ElasticsearchSnapshotsResponse(repositoryNames, snapshots));
409412
}
410-
catch
413+
catch (Exception ex)
411414
{
415+
_logger.LogError(ex, "Unable to retrieve snapshot information");
412416
return Problem(title: "Unable to retrieve snapshot information.");
413417
}
414418
}

tests/Exceptionless.Tests/Controllers/AdminControllerTests.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ public async Task GetStats_AsGlobalAdmin_BillingStatusBreakdownSumsToOrgCount()
364364

365365
// Assert
366366
Assert.NotNull(stats);
367-
var billingBuckets = stats.Organizations.Aggregations.Terms<string>("terms_billing_status")?.Buckets;
367+
var billingTerms = stats.Organizations.Aggregations.Terms<string>("terms_billing_status");
368+
Assert.NotNull(billingTerms);
369+
var billingBuckets = billingTerms.Buckets;
368370
Assert.NotNull(billingBuckets);
369371
long billingTotal = billingBuckets.Sum(b => b.Total ?? 0);
370372
Assert.Equal(stats.Organizations.Total, billingTotal);
@@ -381,7 +383,9 @@ public async Task GetStats_AsGlobalAdmin_StacksByStatusSumsToStackCount()
381383

382384
// Assert
383385
Assert.NotNull(stats);
384-
var statusBuckets = stats.Stacks.Aggregations.Terms<string>("terms_status")?.Buckets;
386+
var statusTerms = stats.Stacks.Aggregations.Terms<string>("terms_status");
387+
Assert.NotNull(statusTerms);
388+
var statusBuckets = statusTerms.Buckets;
385389
Assert.NotNull(statusBuckets);
386390
long statusTotal = statusBuckets.Sum(b => b.Total ?? 0);
387391
Assert.Equal(stats.Stacks.Total, statusTotal);
@@ -398,13 +402,17 @@ public async Task GetStats_AsGlobalAdmin_StacksByTypeStatusHasValidStructure()
398402

399403
// Assert
400404
Assert.NotNull(stats);
401-
var typeBuckets = stats.Stacks.Aggregations.Terms<string>("terms_type")?.Buckets;
405+
var typeTerms = stats.Stacks.Aggregations.Terms<string>("terms_type");
406+
Assert.NotNull(typeTerms);
407+
var typeBuckets = typeTerms.Buckets;
402408
Assert.NotNull(typeBuckets);
403409
foreach (var typeBucket in typeBuckets)
404410
{
405411
Assert.NotNull(typeBucket.Key);
406412
Assert.True(typeBucket.Total >= 0);
407-
var nestedStatusBuckets = typeBucket.Aggregations.Terms<string>("terms_status")?.Buckets;
413+
var nestedStatusTerms = typeBucket.Aggregations.Terms<string>("terms_status");
414+
Assert.NotNull(nestedStatusTerms);
415+
var nestedStatusBuckets = nestedStatusTerms.Buckets;
408416
Assert.NotNull(nestedStatusBuckets);
409417
long subTotal = nestedStatusBuckets.Sum(b => b.Total ?? 0);
410418
Assert.Equal(typeBucket.Total, subTotal);

0 commit comments

Comments
 (0)