Besserer Status

This commit is contained in:
2026-07-24 13:21:52 +02:00
parent 66e437df60
commit 8cba6ea925
2 changed files with 8 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ using BeWo.Service.ServiceContracts.Enhanced;
using BeWo.Service.Status;
using BS.Shared;
using BS.Shared.DataContracts;
using DevExpress.Xpo.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -40,7 +41,7 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
foreach (var service in statusServices)
result.Services.Add(service.DoHealthCheckup());
var allHealthy = result.DatabaseOk.IsOk && result.Services.All(x => x.IsOk);
var allHealthy = result.DatabaseOk.IsOk && result.Services.All(x => x is object && x.IsOk);
if (!allHealthy)
{
WebOperationContext.Current.OutgoingResponse.StatusCode =

View File

@@ -14,6 +14,7 @@ namespace BeWo.Service.Status
private static readonly log4net.ILog log = LoggerUtils.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly string joinChar = Environment.NewLine;
private readonly string errorChar = "•";
protected string Name { get; set; }
@@ -83,7 +84,7 @@ namespace BeWo.Service.Status
{
Name = Name,
IsOk = errors.Count == 0,
Message = errors.Count == 0 ? "OK" : string.Join(joinChar, errors)
Message = errors.Count == 0 ? "OK" : string.Join(joinChar, errors.Select(x => x.StartsWith(errorChar) ? x : $"{errorChar} {x}"))
};
}
@@ -91,7 +92,7 @@ namespace BeWo.Service.Status
{
var missing = RequiredWebConfigs
.Where(x => string.IsNullOrWhiteSpace(MergedConfig.GetSetting(x)))
.Select(x => $"'{x}' wurde nicht korrekt konfiguriert");
.Select(x => $"{errorChar} '{x}' wurde nicht korrekt konfiguriert");
return string.Join(joinChar, missing);
}
@@ -100,7 +101,7 @@ namespace BeWo.Service.Status
{
var missing = RequiredWebSecretConfigs
.Where(x => string.IsNullOrWhiteSpace(MergedConfig.GetSecretSetting(x)))
.Select(x => $"'{x}' wurde nicht korrekt konfiguriert");
.Select(x => $"{errorChar} '{x}' wurde nicht korrekt konfiguriert");
return string.Join(joinChar, missing);
}
@@ -109,7 +110,7 @@ namespace BeWo.Service.Status
{
var missing = RequiredDBScripts
.Where(x => !DAOFactory.ScriptDAO.IsScriptExecuted(x))
.Select(x => $"Script '{x}' wurde nicht ausgeführt");
.Select(x => $"{errorChar} Script '{x}' wurde nicht ausgeführt");
return string.Join(joinChar, missing);
}
@@ -118,7 +119,7 @@ namespace BeWo.Service.Status
{
var missing = RequiredConfigs
.Where(x => !File.Exists(ConfigReader.GetConfigPath(x)))
.Select(x => $"SpecialConfig.{x} wurde nicht korrekt konfiguriert");
.Select(x => $"{errorChar} SpecialConfig.{x} wurde nicht korrekt konfiguriert");
return string.Join(joinChar, missing);
}