mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 20:55:44 +00:00
Distinguish unlisted games from missing saves
This commit is contained in:
@@ -714,7 +714,8 @@ type GamesPageData struct {
|
||||
type GameDetailPageData struct {
|
||||
Title string
|
||||
Game GameInfo
|
||||
IsOrphaned bool
|
||||
IsUnlisted bool
|
||||
CanImport bool
|
||||
BuildInfo BuildInfo
|
||||
}
|
||||
|
||||
@@ -883,6 +884,8 @@ func handleGameDetailPage(w http.ResponseWriter, r *http.Request, gameIDHex stri
|
||||
}
|
||||
|
||||
var game *GameInfo
|
||||
isUnlisted := false
|
||||
canImport := false
|
||||
for i := range games {
|
||||
if games[i].GameIDInt == gameID {
|
||||
game = &games[i]
|
||||
@@ -909,17 +912,24 @@ func handleGameDetailPage(w http.ResponseWriter, r *http.Request, gameIDHex stri
|
||||
return
|
||||
}
|
||||
|
||||
isUnlisted = true
|
||||
canImport = !existsResp.ExistsInMemory && existsResp.ExistsOnDisk
|
||||
runStatus := "Running (not listed)"
|
||||
if canImport {
|
||||
runStatus = "Persisted save (not listed)"
|
||||
}
|
||||
game = &GameInfo{
|
||||
GameID: gameIDHex,
|
||||
GameIDInt: gameID,
|
||||
RunStatus: "Persisted save (not indexed)",
|
||||
RunStatus: runStatus,
|
||||
}
|
||||
}
|
||||
|
||||
data := GameDetailPageData{
|
||||
Title: fmt.Sprintf("Game %s", gameIDHex),
|
||||
Game: *game,
|
||||
IsOrphaned: game.RunStatus == "Persisted save (not indexed)",
|
||||
IsUnlisted: isUnlisted,
|
||||
CanImport: canImport,
|
||||
BuildInfo: getBuildInfo(),
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
{{.Game.RunStatus}}
|
||||
</span>
|
||||
<a href="/games/{{.Game.GameID}}/download" class="btn-secondary" style="margin-left: 1rem;">Download Save</a>
|
||||
{{if .IsOrphaned}}
|
||||
{{if .CanImport}}
|
||||
<button class="btn-primary"
|
||||
style="margin-left: 0.5rem;"
|
||||
hx-post="/games/{{.Game.GameID}}/import"
|
||||
@@ -23,14 +23,20 @@
|
||||
<button class="btn-danger" style="margin-left: 0.5rem;" onclick="showDeleteGameModal()">Delete Game</button>
|
||||
</div>
|
||||
|
||||
{{if .IsOrphaned}}
|
||||
{{if .IsUnlisted}}
|
||||
<div class="alert warning">
|
||||
This game still has persisted history but is missing from the running-games index.
|
||||
This game still exists but is missing from the game list currently served by Eagle.
|
||||
{{if .CanImport}}
|
||||
Use the raw action history below to rewind past the corrupt action, then click <strong>Import and Continue</strong>.
|
||||
The imported game initially has no assigned human players; assign your faction after import.
|
||||
{{else}}
|
||||
Its in-memory controller is still running, so normal history and rewind remain available below.
|
||||
{{end}}
|
||||
</div>
|
||||
{{if .CanImport}}
|
||||
<div id="import-result"></div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
<div id="delete-result"></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user