fix: keep host name in WinRM update log titles (0.5.17)

Do not overwrite UI log titles with generic backend job.title when several logs are open.
This commit is contained in:
PTah
2026-07-14 10:30:13 +10:00
parent 9883e6aab3
commit f40aa538b0
6 changed files with 28 additions and 12 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
| **security-alert-center** | Сервер SAC (Ubuntu 24.04) | | **security-alert-center** | Сервер SAC (Ubuntu 24.04) |
| [seaca](https://git.kalinamall.ru/PapaTramp/seaca) | Android-клиент | | [seaca](https://git.kalinamall.ru/PapaTramp/seaca) | Android-клиент |
**Версия:** `0.5.16` · **Деплой:** `sudo /opt/sac-deploy.sh` **Версия:** `0.5.17` · **Деплой:** `sudo /opt/sac-deploy.sh`
## Возможности ## Возможности
+1 -1
View File
@@ -13,7 +13,7 @@ Self-hosted hub for security events from Linux and Windows agents: ingest, corre
| **security-alert-center** | SAC server (Ubuntu 24.04) | | **security-alert-center** | SAC server (Ubuntu 24.04) |
| [seaca](https://git.kalinamall.ru/PapaTramp/seaca) | Android client | | [seaca](https://git.kalinamall.ru/PapaTramp/seaca) | Android client |
**Version:** `0.5.16` · **Deploy:** `sudo /opt/sac-deploy.sh` **Version:** `0.5.17` · **Deploy:** `sudo /opt/sac-deploy.sh`
## Features ## Features
+6 -4
View File
@@ -590,7 +590,8 @@ def update_host_agent_via_ssh(
detail="Linux SSH admin is not configured (host override or Settings → Linux)", detail="Linux SSH admin is not configured (host override or Settings → Linux)",
) )
title = "Обновление ssh-monitor (SSH)" host_label = (host.display_name or host.hostname or "").strip() or f"host#{host.id}"
title = f"Обновление ssh-monitor (SSH): {host_label}"
try: try:
start_host_remote_action( start_host_remote_action(
db, db,
@@ -650,12 +651,13 @@ def post_agent_update_fallback(
from app.services.winrm_connect import is_windows_host from app.services.winrm_connect import is_windows_host
product = (host.product or "").strip() product = (host.product or "").strip()
host_label = (host.display_name or host.hostname or "").strip() or f"host#{host.id}"
if product == PRODUCT_RDP or is_windows_host(host): if product == PRODUCT_RDP or is_windows_host(host):
title = "Обновление через WinRM" title = f"Обновление {host_label} через WinRM"
elif product == PRODUCT_SSH or is_linux_host(host): elif product == PRODUCT_SSH or is_linux_host(host):
title = "Fallback SSH (ssh-monitor)" title = f"Fallback SSH (ssh-monitor): {host_label}"
else: else:
title = "Обновление агента (fallback)" title = f"Обновление агента (fallback): {host_label}"
try: try:
start_host_remote_action( start_host_remote_action(
@@ -167,7 +167,15 @@ function startCountdown() {
function applyFinishedJob(job: HostRemoteActionJobStatus) { function applyFinishedJob(job: HostRemoteActionJobStatus) {
isLoading.value = false; isLoading.value = false;
ok.value = job.ok ?? job.status === "success"; ok.value = job.ok ?? job.status === "success";
if (job.title) localTitle.value = job.title; // Prefer props.title (hostname) over generic backend job.title.
let title = props.title || job.title || "";
const jobTitle = job.title || "";
if (title && jobTitle.includes(" — готово") && !title.includes(" — готово")) {
title = `${title} — готово`;
} else if (title && jobTitle.includes(" — ошибка") && !title.includes(" — ошибка")) {
title = `${title} — ошибка`;
}
localTitle.value = title;
if (job.message) localMessage.value = job.message; if (job.message) localMessage.value = job.message;
const out = (job.output || job.stdout || "").trim(); const out = (job.output || job.stdout || "").trim();
if (out) polledOutput.value = out; if (out) polledOutput.value = out;
@@ -86,9 +86,9 @@ function scheduleSuccessAutoClose(entryId: string) {
} }
function applyJobToEntry(entry: HostRemoteActionLogEntry, job: HostRemoteActionJobStatus) { function applyJobToEntry(entry: HostRemoteActionLogEntry, job: HostRemoteActionJobStatus) {
if (job.title) { // Keep the UI title set when the log opened (with hostname). Backend job titles
entry.title = job.title; // are generic ("Обновление через WinRM") and overwrite would strip the host name
} // when polling / when another log window opens.
if (job.message) { if (job.message) {
entry.message = job.message; entry.message = job.message;
} }
+8 -2
View File
@@ -713,8 +713,14 @@ async function runRequestAgentUpdate() {
async function runAgentFallback() { async function runAgentFallback() {
agentControlMessage.value = ""; agentControlMessage.value = "";
const title = isWindowsHost.value ? "Обновление через WinRM" : "Fallback SSH (ssh-monitor)"; if (!host.value) return;
const job = await runHostRemoteAction(hostId.value, title, "fallback", remoteActionLogPlaceholder(host.value, "fallback")); const title = remoteActionTitleForHost(host.value);
const job = await runHostRemoteAction(
hostId.value,
title,
"fallback",
remoteActionLogPlaceholder(host.value, "fallback"),
);
if (job) { if (job) {
agentControlOk.value = job.ok ?? false; agentControlOk.value = job.ok ?? false;
if (job.ok) { if (job.ok) {