chages in profiles

This commit is contained in:
Mateusz Gruszczyński
2026-05-28 09:01:14 +02:00
parent a611113d2a
commit 1651075f40
4 changed files with 27 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import annotations from __future__ import annotations
from .client import * from .client import *
from .. import poller_control
import shlex import shlex
def scgi_diagnostics(profile: dict) -> dict: def scgi_diagnostics(profile: dict) -> dict:
@@ -64,7 +65,12 @@ def scgi_diagnostics(profile: dict) -> dict:
def profile_diagnostics(profile: dict) -> dict: def profile_diagnostics(profile: dict) -> dict:
"""Lightweight per-profile diagnostics for save/test UI.""" """Lightweight per-profile diagnostics for save/test UI."""
started = time.perf_counter() started = time.perf_counter()
result = {"profile_id": profile.get("id"), "ok": False, "checks": {}} profile_id = profile.get("id")
try:
slow_threshold_ms = float(poller_control.get_settings(int(profile_id)).get("slow_response_threshold_ms") or poller_control.DEFAULTS["slow_response_threshold_ms"])
except Exception:
slow_threshold_ms = float(poller_control.DEFAULTS["slow_response_threshold_ms"])
result = {"profile_id": profile_id, "ok": False, "checks": {}, "slow_threshold_ms": slow_threshold_ms}
try: try:
c = client_for(profile) c = client_for(profile)
version = str(c.call("system.client_version") or "") version = str(c.call("system.client_version") or "")
@@ -96,7 +102,7 @@ def profile_diagnostics(profile: dict) -> dict:
free_disk[base] = {"error": str(exc)} free_disk[base] = {"error": str(exc)}
result.update({ result.update({
"ok": True, "ok": True,
"status": "online", "status": "normal",
"version": version, "version": version,
"library_version": library, "library_version": library,
"base_paths": paths, "base_paths": paths,
@@ -106,7 +112,8 @@ def profile_diagnostics(profile: dict) -> dict:
}) })
except Exception as exc: except Exception as exc:
result.update({"ok": False, "status": "error", "error": str(exc), "response_time_ms": round((time.perf_counter() - started) * 1000, 2)}) result.update({"ok": False, "status": "error", "error": str(exc), "response_time_ms": round((time.perf_counter() - started) * 1000, 2)})
if result.get("ok") and result.get("response_time_ms", 0) > 1500: # Note: Profile diagnostics uses the same slow-response threshold as Tools -> Poller for this profile.
if result.get("ok") and result.get("response_time_ms", 0) > slow_threshold_ms:
result["status"] = "slow" result["status"] = "slow"
return result return result

File diff suppressed because one or more lines are too long

View File

@@ -738,23 +738,6 @@ body.resizing-details {
.profile-actions { .profile-actions {
justify-content: flex-end; justify-content: flex-end;
} }
.profile-status-badge.badge {
display: inline-flex;
align-items: center;
justify-content: center;
width: auto;
min-width: 0;
min-height: 1rem;
max-width: max-content;
padding: 0.1rem 0.32rem;
border-radius: 999px;
font-size: 0.58rem;
line-height: 1;
letter-spacing: 0.01em;
text-transform: uppercase;
white-space: nowrap;
vertical-align: middle;
}
.profile-form-grid { .profile-form-grid {
display: grid; display: grid;
grid-template-columns: minmax(150px, 1.1fr) minmax(260px, 2.1fr) minmax( grid-template-columns: minmax(150px, 1.1fr) minmax(260px, 2.1fr) minmax(
@@ -3579,9 +3562,21 @@ body.mobile-mode .mobile-filter-bar {
display: none; display: none;
} }
.profile-diagnostics-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:.5rem;} .profile-diagnostics-grid {
.profile-diagnostics-card{border:1px solid var(--bs-border-color);border-radius:.5rem;padding:.5rem;background:var(--bs-body-bg);} display: grid;
.profile-diagnostics-card small{display:block;color:var(--bs-secondary-color);} grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 0.5rem;
}
.profile-diagnostics-card {
border: 1px solid var(--bs-border-color);
border-radius: 0.5rem;
padding: 0.5rem;
background: var(--bs-body-bg);
}
.profile-diagnostics-card small {
display: block;
color: var(--bs-secondary-color);
}
.labels-manager { .labels-manager {
display: grid; display: grid;

File diff suppressed because one or more lines are too long