feature/db-check #21
@@ -59,7 +59,8 @@ namespace Watcher.Controllers
|
|||||||
Containers = await _context.Containers
|
Containers = await _context.Containers
|
||||||
.OrderBy(s => s.Name)
|
.OrderBy(s => s.Name)
|
||||||
.ToListAsync(),
|
.ToListAsync(),
|
||||||
NetworkStatus = _DashboardStore.NetworkStatus
|
NetworkStatus = _DashboardStore.NetworkStatus,
|
||||||
|
DatabaseStatus = _DashboardStore.DatabaseStatus
|
||||||
};
|
};
|
||||||
//ViewBag.NetworkConnection = _NetworkCheckStore.NetworkStatus;
|
//ViewBag.NetworkConnection = _NetworkCheckStore.NetworkStatus;
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
@@ -92,7 +93,8 @@ namespace Watcher.Controllers
|
|||||||
Containers = await _context.Containers
|
Containers = await _context.Containers
|
||||||
.OrderBy(s => s.Name)
|
.OrderBy(s => s.Name)
|
||||||
.ToListAsync(),
|
.ToListAsync(),
|
||||||
NetworkStatus = _DashboardStore.NetworkStatus
|
NetworkStatus = _DashboardStore.NetworkStatus,
|
||||||
|
DatabaseStatus = _DashboardStore.DatabaseStatus
|
||||||
};
|
};
|
||||||
|
|
||||||
return PartialView("_DashboardStats", model);
|
return PartialView("_DashboardStats", model);
|
||||||
|
@@ -16,7 +16,7 @@ public class DatabaseCheck : BackgroundService
|
|||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1800));
|
var timer = new PeriodicTimer(TimeSpan.FromSeconds(30));
|
||||||
|
|
||||||
while (await timer.WaitForNextTickAsync(stoppingToken))
|
while (await timer.WaitForNextTickAsync(stoppingToken))
|
||||||
{
|
{
|
||||||
|
@@ -15,6 +15,7 @@ namespace Watcher.ViewModels
|
|||||||
public List<Container> Containers { get; set; } = new();
|
public List<Container> Containers { get; set; } = new();
|
||||||
|
|
||||||
public String? NetworkStatus { get; set; } = "?";
|
public String? NetworkStatus { get; set; } = "?";
|
||||||
|
public String? DatabaseStatus { get; set; } = "?";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -81,10 +81,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (!Model.DatabaseStatus.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
@if (Model.DatabaseStatus == "$ok")
|
||||||
|
{
|
||||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||||
<span>Datenbank</span>
|
<span>Datenbank</span>
|
||||||
<span class="badge bg-success">OK</span>
|
<span class="badge bg-success">OK</span>
|
||||||
</div>
|
</div>
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||||
|
<span>Datenbank</span>
|
||||||
|
<span class="badge bg-danger">Big Problem</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||||
|
<span>Datenbank</span>
|
||||||
|
|
||||||
|
<span class="badge bg-primary">Missing Data</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
<div class="progress mb-3" style="height: 6px;">
|
<div class="progress mb-3" style="height: 6px;">
|
||||||
<div class="progress-bar bg-success w-100"></div>
|
<div class="progress-bar bg-success w-100"></div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user