Skip to content

feat(admin-panel): dashboard with server statistics on the start page - #1246

Merged
sven-n merged 3 commits into
masterfrom
claude/admin-dashboard-mockup-iyw0fv
Oct 18, 2026
Merged

sven-n merged 3 commits into
masterfrom
claude/admin-dashboard-mockup-iyw0fv

Conversation

@sven-n

@sven-n sven-n commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

What

The start page of the admin panel showed only a welcome text. It now shows a card-styled dashboard (only after login, as every page; _Imports.razor already applies [Authorize]):

  • Statistic cards: players online (and capacity of the running game servers), servers running (highlights the ones which aren't), accounts (new in the last 7 days, banned; bots and templates excluded), guilds (alliances, characters).
  • Players online in the last 24 hours: an SVG chart, sampled every 5 minutes.
  • Servers: every server with its load and state, updated live via PropertyChanged.
  • Quick actions: the global message form and links to frequently used pages.
  • Administrators only: castle siege state, system info (uptime, memory, version, database reachable), available configuration updates.

How

  • IPlayerContext.GetAccountStatisticsAsync and IGuildServerContext.GetGuildStatisticsAsync (EF Core and in-memory) count on the database instead of loading the entities.
  • OnlinePlayerHistory is a hosted singleton which samples the IServerProvider. The GameContext PlayerCount meter was considered, but metrics are only observable in the process which records them; in the distributed deployment the admin panel runs in its own process, while IServerProvider provides the counts in both deployments. The history is kept in memory (starts over on restart). Sampling exceptions are logged, so they can't stop the host.
  • The global message form of the servers page was extracted into GlobalMessageForm, so the dashboard reuses it instead of duplicating it.
  • New texts are in Resources.resx, with German and Simplified Chinese translations.
  • The admin panel overview page of the documentation describes the dashboard.

Fix: thread-safe creation of in-memory repositories

Running the demo mode showed that InMemoryRepositoryProvider creates repositories on first access without synchronization. The castle siege plugins of the three demo game servers did that concurrently at startup (An item with the same key has already been added. Key: ...CastleSiegeGuildRegistration), which also corrupted the repository dictionary, so later lookups failed (the guild count of the dashboard showed "Not available", the castle siege card was missing). Repositories are now created under a lock, and BaseRepositoryProvider.Repositories is a ConcurrentDictionary, so lookups are safe while one is added. InMemoryRepositoryProviderTest reproduces the failure without the fix. Only the in-memory persistence (demo mode, tests) registers repositories on demand; the EF Core providers register theirs during initialization.

Testing

  • dotnet build src/MUnique.OpenMU.sln -p:ci=true: 0 errors.
  • dotnet test with -p:ci=true:
    • MUnique.OpenMU.Web.Tests: 278 passed, including 15 new tests in Dashboard/ (statistics queries on the in-memory persistence, sampling window, chart geometry, server statistics, and a bUnit test that viewers don't see the administrator cards).
    • MUnique.OpenMU.Tests: 1893 passed.
    • MUnique.OpenMU.Persistence.Initialization.Tests: 643 passed, 7 skipped.
    • LoggingConfigurationPageTests.DoesNotSaveInvalidJson failed once in a full run and passed on rerun; it is unrelated to this change.
  • Ran the all-in-one server with -demo -autostart and looked at the dashboard in a browser at desktop and phone width, including the chart after the second sample.

Noticed, not changed here

  • At phone width the navigation menu of the panel doesn't collapse, so the content gets very narrow (affects all pages).
  • In the demo mode, CrywolfPlugIn logs Collection was modified; enumeration operation may not execute. at startup.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XowA25b3pgLghrNZSZRwTi

…t page

The start page now shows card-styled statistics instead of only a welcome
text: players online and capacity, running servers, accounts (new and
banned), guilds and alliances, a chart of the players online in the last
24 hours, the server list with their load, and quick actions (global
message and links). Administrators additionally see the castle siege
state, system information and the available configuration updates.

The online history is sampled every 5 minutes from the IServerProvider,
because the PlayerCount metric is only observable in-process, while the
admin panel can run in its own process in the distributed deployment.

The global message form of the servers page was extracted into a
component, so that the dashboard can reuse it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XowA25b3pgLghrNZSZRwTi
…ow screens

Also don't show a separator before the runtime when the assembly has no
informational version (local builds).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XowA25b3pgLghrNZSZRwTi
The in-memory repository provider creates repositories on first access,
without synchronization. In the demo mode, the castle siege plugins of
the game servers did that concurrently at startup, which failed with
"An item with the same key has already been added" or corrupted the
dictionary of the repositories, so that later lookups failed, e.g. the
guild statistics of the dashboard.

The repositories are now created under a lock, and the dictionary is a
concurrent one, so that lookups are safe while a repository is added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XowA25b3pgLghrNZSZRwTi
@sven-n
sven-n merged commit 2fadb27 into master Oct 18, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants