Implemented container helper status checked. Started implementing container helper ui. Improved update modal

This commit is contained in:
2026-01-25 22:51:51 +01:00
parent e2f344ab4e
commit 4e96905fb2
7 changed files with 152 additions and 37 deletions

View File

@@ -13,6 +13,23 @@ public class ContainerHelperService
HttpClientFactory = httpClientFactory;
}
public async Task<bool> CheckConnectionAsync()
{
var client = HttpClientFactory.CreateClient("ContainerHelper");
try
{
var response = await client.GetAsync("api/ping");
response.EnsureSuccessStatusCode();
return true;
}
catch (Exception)
{
return false;
}
}
public async IAsyncEnumerable<RebuildEvent> RebuildAsync()
{
var options = new JsonSerializerOptions()
@@ -29,6 +46,7 @@ public class ContainerHelperService
if (!response.IsSuccessStatusCode)
{
var responseText = await response.Content.ReadAsStringAsync();
yield return new RebuildEvent()
{
Type = RebuildEventType.Failed,
@@ -56,6 +74,11 @@ public class ContainerHelperService
var deserializedData = JsonSerializer.Deserialize<RebuildEvent>(data, options);
yield return deserializedData;
// Exit if service will go down for a clean exit
if(deserializedData is {Type: RebuildEventType.Step, Data: "ServiceDown"})
yield break;
} while (true);
yield return new RebuildEvent()