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:
chrome-storm-c442
2026-03-06 10:08:59 -05:00
parent d49fa9ce90
commit 6a2db542c3
4 changed files with 14 additions and 7 deletions

View File

@@ -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