diff --git a/client/src/pages/AdminPage.jsx b/client/src/pages/AdminPage.jsx index 8f4dd8f..19ef711 100644 --- a/client/src/pages/AdminPage.jsx +++ b/client/src/pages/AdminPage.jsx @@ -271,6 +271,9 @@ function MatchAdminCard({ m, run, busy, token, reload, setNotice }) { ); const hasNext = m.series.some((s) => s.number === m.currentMapNumber + 1); + const current = m.series.find((s) => s.number === m.currentMapNumber); + const configured = m.server?.status === 'configured'; + const paused = !!m.server?.paused; return (
@@ -283,6 +286,14 @@ function MatchAdminCard({ m, run, busy, token, reload, setNotice }) { {m.modeLabel}, {FORMAT_LABEL[m.format]} · {m.statusLabel} · {server.text} {m.format !== 'bo1' && <> · Serie {m.seriesScore.A}:{m.seriesScore.B}} + {m.status === 'live' && current && ( +
+ Map {current.number}: {current.name} + {current.score.A} : {current.score.B} + {current.live?.roundsPlayed != null && Runde {current.live.roundsPlayed + 1}} +
+ )} + {paused && Pausiert} @@ -291,8 +302,8 @@ function MatchAdminCard({ m, run, busy, token, reload, setNotice }) { Ansehen {m.status === 'lobby' && btn('Veto starten', { path: '/veto/start' }, 'btn-primary')} {(m.server?.status === 'configured') && btn('Aufwärmphase beenden', { path: '/server/warmup-end' })} - {(m.server?.status === 'configured') && btn('Pausieren', { path: '/server/pause', confirm: 'Match pausieren?' })} - {(m.server?.status === 'configured') && btn('Fortsetzen', { path: '/server/resume' })} + {configured && !paused && btn('Pausieren', { path: '/server/pause', confirm: 'Match pausieren?' }, 'btn-warn')} + {configured && paused && btn('Fortsetzen', { path: '/server/resume' }, 'btn-primary')} {(m.server?.status === 'configured') && hasNext && btn('Nächste Map', { path: '/series/next' })} {m.server && ['start_failed', 'failed', 'stopped', 'config_failed', 'ready'].includes(m.server.status) && !closed && btn('Server neu starten / wiederholen', { path: '/server/retry' })} diff --git a/client/src/styles.css b/client/src/styles.css index 3a4b89a..4ecdb61 100644 --- a/client/src/styles.css +++ b/client/src/styles.css @@ -529,3 +529,8 @@ input:focus, select:focus { border-color: var(--link); outline: none; } .turn-seconds { min-width: 3ch; text-align: right; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; } .turn-timer.is-low .turn-bar span { background: var(--error); } .turn-timer.is-low .turn-seconds { color: var(--error); font-weight: 600; } +.admin-live { display: flex; gap: 10px; align-items: baseline; margin-top: 4px; font-size: .9rem; } +.admin-live strong { font-variant-numeric: tabular-nums; } +.admin-badge { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; } +.admin-badge.is-paused { background: color-mix(in srgb, var(--pending) 22%, transparent); color: var(--pending); border: 1px solid var(--pending); } +.btn-warn { border-color: var(--pending); color: var(--pending); } diff --git a/server/src/db.js b/server/src/db.js index 228c46d..621a140 100644 --- a/server/src/db.js +++ b/server/src/db.js @@ -128,4 +128,6 @@ function migrate(db) { for (const [name, type] of add) { if (!seriesColumns.has(name)) db.exec(`ALTER TABLE series_maps ADD COLUMN ${name} ${type}`); } + const serverColumns = columns('servers'); + if (!serverColumns.has('paused')) db.exec('ALTER TABLE servers ADD COLUMN paused INTEGER NOT NULL DEFAULT 0'); } diff --git a/server/src/matchService.js b/server/src/matchService.js index 40b3d80..b767756 100644 --- a/server/src/matchService.js +++ b/server/src/matchService.js @@ -944,6 +944,7 @@ export class MatchService extends EventEmitter { status: row.status, message: row.message, playerCount: row.player_count, + paused: !!row.paused, attempts: row.attempts, updatedAt: row.updated_at, idleTimeoutMinutes: this.config.idleTimeoutMinutes, diff --git a/server/src/servers/serverManager.js b/server/src/servers/serverManager.js index c624ea0..7052bf7 100644 --- a/server/src/servers/serverManager.js +++ b/server/src/servers/serverManager.js @@ -308,7 +308,8 @@ export class ServerManager { if (!seriesMap) throw new HttpError(409, 'Das Veto ist noch nicht abgeschlossen', 'veto_pending'); const mapName = pool.maps.find((m) => m.id === seriesMap.map)?.name ?? seriesMap.map; - this.update(matchId, { status: 'configuring', message: `Lade Map ${seriesMap.number}: ${mapName}` }); + // Ein Mapwechsel beendet die Pause, CS2 lädt die Map neu + this.update(matchId, { status: 'configuring', paused: 0, message: `Lade Map ${seriesMap.number}: ${mapName}` }); this.service.log(matchId, 'server', `Konfiguration für Map ${seriesMap.number} (${mapName}) gestartet`); const plan = buildMapCommands({ @@ -418,8 +419,8 @@ export class ServerManager { } catch (err) { throw new HttpError(502, `Befehl konnte nicht gesendet werden: ${err.message}`, 'server_error'); } + this.update(viewer.matchId, { paused: paused ? 1 : 0 }); this.service.log(viewer.matchId, 'server', paused ? 'Match pausiert (Admin)' : 'Match fortgesetzt (Admin)'); - this.service.changed(viewer.matchId); } /** Demo-Modus: simuliert einen Matchverlauf, indem echte CS2-Logzeilen erzeugt und ausgewertet werden. */ @@ -463,7 +464,7 @@ export class ServerManager { const row = this.row(matchId); if (!row || row.status === 'stopped') return; if (row.handle) await this.safeStop(row); - this.update(matchId, { status: 'stopped', stopped_at: Date.now(), message: reason, player_count: null }); + this.update(matchId, { status: 'stopped', stopped_at: Date.now(), message: reason, player_count: null, paused: 0 }); this.service.log(matchId, 'server', `Server gestoppt: ${reason}`); }