fix(dashboard): Config page header shows the switched profile's config.yaml path (#44374)
The Config page read config_path from /api/status, which is machine-global and always reports the profile the dashboard process was started under. After switching profiles with the global switcher, the header kept showing the old profile's path (e.g. /root/.hermes/profiles/worker_1/config.yaml) even though reads/writes correctly targeted the new profile. Fix: /api/config/raw now returns the resolved path alongside the YAML (resolved inside _profile_scope, so it follows ?profile=). ConfigPage prefers that scoped path and only falls back to /api/status for old servers. ProfileKeyedRoutes already remounts the page on switch, so the header refreshes immediately.
This commit is contained in:
@@ -92,6 +92,16 @@ class TestProfileScopedConfig:
|
||||
resp = client.get("/api/config/raw")
|
||||
assert "Io/Volcano" not in resp.json()["yaml"]
|
||||
|
||||
def test_config_raw_path_reflects_requested_profile(self, client, isolated_profiles):
|
||||
"""The Config page header shows /api/config/raw's ``path`` — it must
|
||||
point at the SWITCHED profile's config.yaml, not the dashboard's own
|
||||
(the stale-path bug reported after the profile unification launch)."""
|
||||
resp = client.get("/api/config/raw", params={"profile": "worker_beta"})
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["path"] == str(isolated_profiles["worker_beta"] / "config.yaml")
|
||||
resp = client.get("/api/config/raw")
|
||||
assert resp.json()["path"] == str(isolated_profiles["default"] / "config.yaml")
|
||||
|
||||
def test_unknown_profile_404(self, client, isolated_profiles):
|
||||
resp = client.get("/api/config", params={"profile": "ghost"})
|
||||
assert resp.status_code == 404
|
||||
|
||||
Reference in New Issue
Block a user