Files
security-alert-center/frontend/src/utils/hostsLiveUpdate.ts
T
PapaTramp f411d8f070 feat: git-based agent version reference and unified outdated badge (0.20.0)
SAC reads latest RDP/ssh-monitor versions from configured git repos for outdated detection, update targets, and settings test-git.
2026-06-20 16:25:53 +10:00

31 lines
1.2 KiB
TypeScript

import type { HostDetail, HostSummary } from "../api";
import { isAgentVersionNewer } from "./agentVersion";
/** Обновляет поля строки списка хостов из GET /hosts/{id} (без перезагрузки таблицы). */
export function patchHostSummaryFromDetail(target: HostSummary, detail: HostDetail): void {
target.display_name = detail.display_name;
target.os_version = detail.os_version;
target.product_version = detail.product_version;
target.ipv4 = detail.ipv4;
target.last_seen_at = detail.last_seen_at;
target.event_count = detail.event_count;
target.last_heartbeat_at = detail.last_heartbeat_at;
target.last_daily_report_at = detail.last_daily_report_at;
target.last_inventory_at = detail.last_inventory_at;
target.agent_status = detail.agent_status;
if (detail.version_status) {
target.version_status = detail.version_status;
}
}
export function bumpLatestAgentVersion(
latest: Record<string, string> | undefined,
product: string,
version: string | null | undefined,
): void {
if (!latest || !version) return;
if (isAgentVersionNewer(version, latest[product])) {
latest[product] = version;
}
}