@@ -40,7 +40,9 @@ public class BanFileMonitorsController(
4040 /// each server is protected and in sync with the central ban file.
4141 /// </summary>
4242 [ HttpGet ]
43- public async Task < IActionResult > Index ( CancellationToken cancellationToken = default )
43+ public async Task < IActionResult > Index (
44+ [ FromQuery ] bool showAll = false ,
45+ CancellationToken cancellationToken = default )
4446 {
4547 return await ExecuteWithErrorHandlingAsync ( async ( ) =>
4648 {
@@ -64,7 +66,23 @@ public async Task<IActionResult> Index(CancellationToken cancellationToken = def
6466 return RedirectToAction ( "Display" , "Errors" , new { id = 500 } ) ;
6567 }
6668
67- var monitors = monitorsResponse . Result . Data . Items . ToList ( ) ;
69+ var allMonitors = monitorsResponse . Result . Data . Items . ToList ( ) ;
70+
71+ // Active monitors are the ones the agent will actually run a check loop for.
72+ // Anything else (sync disabled or agent disabled) clutters the dashboard with
73+ // stale data and is hidden by default; admins can opt in via ?showAll=true to
74+ // diagnose misconfigurations.
75+ static bool IsActive ( XtremeIdiots . Portal . Repository . Abstractions . Models . V1 . BanFileMonitors . BanFileMonitorDto m )
76+ {
77+ return m . GameServer is not null
78+ && m . GameServer . BanFileSyncEnabled
79+ && m . GameServer . AgentEnabled ;
80+ }
81+
82+ var hiddenCount = showAll ? 0 : allMonitors . Count ( m => ! IsActive ( m ) ) ;
83+ var monitors = showAll
84+ ? ( IReadOnlyList < XtremeIdiots . Portal . Repository . Abstractions . Models . V1 . BanFileMonitors . BanFileMonitorDto > ) allMonitors
85+ : allMonitors . Where ( IsActive ) . ToList ( ) ;
6886
6987 var liveStatusResponse = await liveStatusTask . ConfigureAwait ( false ) ;
7088 var liveStatusLookup = liveStatusResponse . IsSuccess && liveStatusResponse . Result ? . Data ? . Items is not null
@@ -81,7 +99,9 @@ public async Task<IActionResult> Index(CancellationToken cancellationToken = def
8199 ? activeBanCountsResponse . Result . Data . Items . ToDictionary ( c => c . GameType )
82100 : [ ] ;
83101
84- // Build per-game-type roll-up cards for game types the user can see.
102+ // Per-game-type cards reflect the full ban-counts view (DB has the same active
103+ // bans regardless of which servers happen to be enabled), but the visible
104+ // game-type set follows the currently-displayed monitors.
85105 var visibleGameTypes = monitors
86106 . Where ( m => m . GameServer is not null )
87107 . Select ( m => m . GameServer . GameType )
@@ -105,7 +125,9 @@ public async Task<IActionResult> Index(CancellationToken cancellationToken = def
105125 Monitors = monitors ,
106126 LiveStatusLookup = liveStatusLookup ,
107127 ServerConfigs = serverConfigs ,
108- GameTypeCards = gameTypeCards
128+ GameTypeCards = gameTypeCards ,
129+ ShowingAll = showAll ,
130+ HiddenInactiveCount = hiddenCount
109131 } ;
110132
111133 return View ( viewModel ) ;
0 commit comments