Fix account dashboard sync rendering
This commit is contained in:
+37
-12
@@ -1055,8 +1055,16 @@ def local_syncer_save_summary(account_id):
|
|||||||
applied_dir = root / "state" / "applied"
|
applied_dir = root / "state" / "applied"
|
||||||
|
|
||||||
paths = {
|
paths = {
|
||||||
"us": applied_dir / f"psopeeps_us.site.{account}.json",
|
"us": [
|
||||||
"eu": applied_dir / f"psopeeps_eu.site.{account}.json",
|
applied_dir / f"psopeeps_us.us-live.site.{account}.json",
|
||||||
|
applied_dir / f"psopeeps_us.us-test.site.{account}.json",
|
||||||
|
applied_dir / f"psopeeps_us.us-hardcore.site.{account}.json",
|
||||||
|
],
|
||||||
|
"eu": [
|
||||||
|
applied_dir / f"psopeeps_eu.eu-live.site.{account}.json",
|
||||||
|
applied_dir / f"psopeeps_eu.eu-test.site.{account}.json",
|
||||||
|
applied_dir / f"psopeeps_eu.eu-hardcore.site.{account}.json",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
def parse_time(value):
|
def parse_time(value):
|
||||||
@@ -1079,19 +1087,36 @@ def local_syncer_save_summary(account_id):
|
|||||||
"manifest_sha256": None,
|
"manifest_sha256": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
if path.exists():
|
states = []
|
||||||
|
errors = []
|
||||||
|
|
||||||
|
for path in paths[region]:
|
||||||
|
if not path.exists():
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
data = json.loads(path.read_text())
|
data = json.loads(path.read_text())
|
||||||
info.update({
|
data["_path"] = str(path)
|
||||||
"status": "seen",
|
states.append(data)
|
||||||
"label": "Seen",
|
|
||||||
"style": "warn",
|
|
||||||
"host": data.get("host"),
|
|
||||||
"applied_at": data.get("applied_at"),
|
|
||||||
"manifest_sha256": data.get("manifest_sha256"),
|
|
||||||
})
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
info["error"] = str(e)
|
errors.append(f"{path.name}: {e}")
|
||||||
|
|
||||||
|
if states:
|
||||||
|
latest_state = max(states, key=lambda x: str(x.get("applied_at") or ""))
|
||||||
|
hashes = {x.get("manifest_sha256") for x in states if x.get("manifest_sha256")}
|
||||||
|
info.update({
|
||||||
|
"status": "seen",
|
||||||
|
"label": "Seen",
|
||||||
|
"style": "warn",
|
||||||
|
"host": latest_state.get("host"),
|
||||||
|
"applied_at": latest_state.get("applied_at"),
|
||||||
|
"manifest_sha256": latest_state.get("manifest_sha256"),
|
||||||
|
"targets_seen": len(states),
|
||||||
|
"targets_expected": len(paths[region]),
|
||||||
|
"all_targets_same_hash": len(hashes) == 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
if errors:
|
||||||
|
info["errors"] = errors
|
||||||
|
|
||||||
regions[region] = info
|
regions[region] = info
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -573,9 +573,9 @@
|
|||||||
const title = document.querySelector("#account-title");
|
const title = document.querySelector("#account-title");
|
||||||
if (title) title.textContent = user.username;
|
if (title) title.textContent = user.username;
|
||||||
|
|
||||||
renderAccountEmail(accountData);
|
// Account dashboard cards are server-rendered and have dedicated account JS.
|
||||||
updateAccountStatusBadges(accountData);
|
// Do not let the generic app bootstrap rewrite BB/status cards into stale layouts.
|
||||||
renderBBCard(accountData);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function boot() {
|
async function boot() {
|
||||||
|
|||||||
Reference in New Issue
Block a user