fix(central-ui): Sites page re-check no longer holds the deploy controls; pluralise; clear stale caption on error
The forced refresh after a successful Deploy Artifacts ran inside the try, so the Bulk-actions toggle and every per-site Deploy item stayed disabled for a whole fleet evaluation after the success toast; it now runs after the finally, behind a re-render, with the Re-check spinner showing it in flight. Also: pluralise the instance line's noun, drop a stale "as of" caption when a re-check faults, skip the fleet evaluation when the site load itself failed, and render the badge tooltip through UtcDateTime so the UTC label is honest. Claude-Session: https://claude.ai/code/session_01Y5ef34iUUMjmwnMpL9xgmB
This commit is contained in:
@@ -179,6 +179,27 @@ public class SitesPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InstanceLine_PluralisesTheSingleInstanceCase()
|
||||
{
|
||||
RegisterServices();
|
||||
_siteRepo.GetAllSitesAsync().Returns(Sites(1, 2));
|
||||
_siteRepo.GetAllDataConnectionsAsync().Returns(new List<DataConnection>());
|
||||
_pendingUpdates.GetAsync(Arg.Any<bool>(), Arg.Any<CancellationToken>())
|
||||
.Returns(_ => Task.FromResult(Snapshot(
|
||||
Pending(1, ArtifactDeploymentState.Current, deployed: 1, stale: 1),
|
||||
Pending(2, ArtifactDeploymentState.Current, deployed: 1))));
|
||||
|
||||
var cut = Render<SitesPage>();
|
||||
|
||||
cut.WaitForAssertion(() =>
|
||||
{
|
||||
Assert.Contains("1 of 1 instance out of date", cut.Markup);
|
||||
Assert.Contains("All 1 instance current", cut.Markup);
|
||||
Assert.DoesNotContain("1 instances", cut.Markup);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Recheck_ForcesRefresh()
|
||||
{
|
||||
@@ -193,6 +214,46 @@ public class SitesPageTests : BunitContext
|
||||
_pendingUpdates.Received().GetAsync(true, Arg.Any<CancellationToken>()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SiteLoadFailure_SkipsTheFleetEvaluation()
|
||||
{
|
||||
RegisterServices();
|
||||
_siteRepo.GetAllSitesAsync()
|
||||
.Returns<Task<IReadOnlyList<Site>>>(_ => throw new InvalidOperationException("db down"));
|
||||
|
||||
var cut = Render<SitesPage>();
|
||||
|
||||
cut.WaitForAssertion(() => Assert.Contains("Failed to load sites", cut.Markup));
|
||||
// No cards to badge, so the whole-fleet flatten must not run at all.
|
||||
_pendingUpdates.DidNotReceive().GetAsync(Arg.Any<bool>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FailedRecheck_ClearsTheStaleAsOfCaption()
|
||||
{
|
||||
RegisterServices();
|
||||
_siteRepo.GetAllSitesAsync().Returns(Sites(1));
|
||||
_siteRepo.GetAllDataConnectionsAsync().Returns(new List<DataConnection>());
|
||||
_pendingUpdates.GetAsync(Arg.Any<bool>(), Arg.Any<CancellationToken>())
|
||||
.Returns(_ => Task.FromResult(Snapshot(Pending(1, ArtifactDeploymentState.Current))));
|
||||
|
||||
var cut = Render<SitesPage>();
|
||||
cut.WaitForAssertion(() => Assert.Contains("Updates as of", cut.Markup));
|
||||
|
||||
// The re-check now faults: the error wins, so the caption from the earlier good
|
||||
// evaluation must not stand next to "unavailable" badges.
|
||||
_pendingUpdates.GetAsync(Arg.Any<bool>(), Arg.Any<CancellationToken>())
|
||||
.Returns<Task<PendingUpdatesSnapshot>>(_ => throw new InvalidOperationException("evaluator down"));
|
||||
cut.Find("button[aria-label=\"Re-check pending updates\"]").Click();
|
||||
|
||||
cut.WaitForAssertion(() =>
|
||||
{
|
||||
Assert.DoesNotContain("Updates as of", cut.Markup);
|
||||
Assert.Contains("Artifacts: unavailable", cut.Markup);
|
||||
Assert.Contains("Site1", cut.Markup);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CacheFault_ShowsUnavailable_AndSitesStillRender()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user