v1.9.41: fix Grafana/Prometheus tabs — pass server dict to clients
- GrafanaTab/PrometheusTab: use store.get_server(alias) to get server dict instead of passing (alias, store) to client constructors - Fix PrometheusTab: targets() and alerts() method names + parse response - Fix GrafanaTab: build dashboard URL from client.base_url Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -140,7 +140,10 @@ class GrafanaTab(ctk.CTkFrame):
|
||||
|
||||
def _get_client(self) -> GrafanaClient:
|
||||
if self._client is None:
|
||||
self._client = GrafanaClient(self._current_alias, self.store)
|
||||
server = self.store.get_server(self._current_alias)
|
||||
if not server:
|
||||
raise ValueError(f"Server '{self._current_alias}' not found")
|
||||
self._client = GrafanaClient(server)
|
||||
return self._client
|
||||
|
||||
# ── Table population ──
|
||||
@@ -194,10 +197,9 @@ class GrafanaTab(ctk.CTkFrame):
|
||||
if url:
|
||||
try:
|
||||
client = self._get_client()
|
||||
full_url = client.get_dashboard_url(url)
|
||||
full_url = f"{client.base_url}{url}"
|
||||
webbrowser.open(full_url)
|
||||
except Exception:
|
||||
# Fallback: just open relative URL
|
||||
webbrowser.open(url)
|
||||
break
|
||||
|
||||
|
||||
@@ -189,8 +189,10 @@ class PrometheusTab(ctk.CTkFrame):
|
||||
try:
|
||||
client = self._get_client()
|
||||
|
||||
targets = client.get_targets()
|
||||
alerts = client.get_alerts()
|
||||
targets_resp = client.targets()
|
||||
targets = targets_resp.get("data", {}).get("activeTargets", [])
|
||||
alerts_resp = client.alerts()
|
||||
alerts = alerts_resp.get("data", {}).get("alerts", [])
|
||||
|
||||
self.after(0, lambda: self._populate_targets(targets))
|
||||
self.after(0, lambda: self._populate_alerts(alerts))
|
||||
@@ -210,7 +212,10 @@ class PrometheusTab(ctk.CTkFrame):
|
||||
|
||||
def _get_client(self) -> PrometheusClient:
|
||||
if self._client is None:
|
||||
self._client = PrometheusClient(self._current_alias, self.store)
|
||||
server = self.store.get_server(self._current_alias)
|
||||
if not server:
|
||||
raise ValueError(f"Server '{self._current_alias}' not found")
|
||||
self._client = PrometheusClient(server)
|
||||
return self._client
|
||||
|
||||
# ── Table population ──
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
"""Version info for ServerManager."""
|
||||
|
||||
__version__ = "1.9.40"
|
||||
__version__ = "1.9.41"
|
||||
__app_name__ = "ServerManager"
|
||||
__author__ = "aibot777"
|
||||
__description__ = "Desktop GUI for managing remote servers"
|
||||
|
||||
Reference in New Issue
Block a user