fix: hide SSH/WinRM test feedback after 30s (0.12.1)

WinRM success message now auto-hides like SSH; both use 30 second timeout instead of 60.
This commit is contained in:
PTah
2026-06-20 15:57:15 +10:00
parent cd2f27792d
commit d820d941c1
4 changed files with 35 additions and 7 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
"""Единый источник версии SAC (API, health, логи, OpenAPI).""" """Единый источник версии SAC (API, health, логи, OpenAPI)."""
APP_NAME = "Security Alert Center" APP_NAME = "Security Alert Center"
APP_VERSION = "0.12.0" APP_VERSION = "0.12.1"
APP_VERSION_LABEL = f"{APP_NAME} v.{APP_VERSION}" APP_VERSION_LABEL = f"{APP_NAME} v.{APP_VERSION}"
+2 -2
View File
@@ -4,6 +4,6 @@ from app.version import APP_NAME, APP_VERSION, APP_VERSION_LABEL
def test_version_constants(): def test_version_constants():
assert APP_VERSION == "0.12.0" assert APP_VERSION == "0.12.1"
assert APP_NAME == "Security Alert Center" assert APP_NAME == "Security Alert Center"
assert APP_VERSION_LABEL == "Security Alert Center v.0.12.0" assert APP_VERSION_LABEL == "Security Alert Center v.0.12.1"
+1 -1
View File
@@ -1,4 +1,4 @@
/** Fallback до загрузки /health; при релизе держите в sync с backend/app/version.py */ /** Fallback до загрузки /health; при релизе держите в sync с backend/app/version.py */
export const APP_NAME = "Security Alert Center"; export const APP_NAME = "Security Alert Center";
export const APP_VERSION = "0.12.0"; export const APP_VERSION = "0.12.1";
export const APP_VERSION_LABEL = `${APP_NAME} v.${APP_VERSION}`; export const APP_VERSION_LABEL = `${APP_NAME} v.${APP_VERSION}`;
+31 -3
View File
@@ -72,7 +72,7 @@
> >
{{ testingWinRm ? "Проверка…" : "Проверить WinRM (admin)" }} {{ testingWinRm ? "Проверка…" : "Проверить WinRM (admin)" }}
</button> </button>
<p v-if="winRmTestMessage" :class="winRmTestOk ? 'success' : 'error'">{{ winRmTestMessage }}</p> <p v-if="showWinRmTestFeedback && winRmTestMessage" :class="winRmTestOk ? 'success' : 'error'">{{ winRmTestMessage }}</p>
<div class="host-actions-row"> <div class="host-actions-row">
<button <button
type="button" type="button"
@@ -297,7 +297,7 @@ import {
} from "../api"; } from "../api";
import { emitHostPatch } from "../utils/hostPatchBus"; import { emitHostPatch } from "../utils/hostPatchBus";
const SSH_TEST_FEEDBACK_MS = 60_000; const HOST_ACTION_FEEDBACK_MS = 30_000;
const props = defineProps<{ id: string }>(); const props = defineProps<{ id: string }>();
const route = useRoute(); const route = useRoute();
@@ -313,6 +313,7 @@ const eventsPageSize = 50;
const testingWinRm = ref(false); const testingWinRm = ref(false);
const winRmTestMessage = ref(""); const winRmTestMessage = ref("");
const winRmTestOk = ref(false); const winRmTestOk = ref(false);
const showWinRmTestFeedback = ref(false);
const testingSsh = ref(false); const testingSsh = ref(false);
const updatingAgent = ref(false); const updatingAgent = ref(false);
const showSshTestFeedback = ref(false); const showSshTestFeedback = ref(false);
@@ -334,6 +335,7 @@ const configForm = reactive({
getInventory: true, getInventory: true,
}); });
let sshTestHideTimer: ReturnType<typeof setTimeout> | null = null; let sshTestHideTimer: ReturnType<typeof setTimeout> | null = null;
let winRmTestHideTimer: ReturnType<typeof setTimeout> | null = null;
let sshProbeSeq = 0; let sshProbeSeq = 0;
let refreshingLive = false; let refreshingLive = false;
@@ -480,6 +482,13 @@ function applySshAdminStatus(result: { ok: boolean; ssh_admin_ok?: boolean | nul
}; };
} }
function clearWinRmTestFeedbackTimer() {
if (winRmTestHideTimer != null) {
clearTimeout(winRmTestHideTimer);
winRmTestHideTimer = null;
}
}
function scheduleSshTestFeedbackHide() { function scheduleSshTestFeedbackHide() {
clearSshTestFeedbackTimer(); clearSshTestFeedbackTimer();
sshTestHideTimer = setTimeout(() => { sshTestHideTimer = setTimeout(() => {
@@ -487,7 +496,16 @@ function scheduleSshTestFeedbackHide() {
sshTestOutput.value = ""; sshTestOutput.value = "";
showSshTestFeedback.value = false; showSshTestFeedback.value = false;
sshTestHideTimer = null; sshTestHideTimer = null;
}, SSH_TEST_FEEDBACK_MS); }, HOST_ACTION_FEEDBACK_MS);
}
function scheduleWinRmTestFeedbackHide() {
clearWinRmTestFeedbackTimer();
winRmTestHideTimer = setTimeout(() => {
winRmTestMessage.value = "";
showWinRmTestFeedback.value = false;
winRmTestHideTimer = null;
}, HOST_ACTION_FEEDBACK_MS);
} }
async function runSshTest(options: { silent?: boolean } = {}) { async function runSshTest(options: { silent?: boolean } = {}) {
@@ -544,14 +562,21 @@ async function probeSshOnOpen() {
async function runWinRmTest() { async function runWinRmTest() {
testingWinRm.value = true; testingWinRm.value = true;
clearWinRmTestFeedbackTimer();
winRmTestMessage.value = ""; winRmTestMessage.value = "";
showWinRmTestFeedback.value = false;
try { try {
const result = await testHostWinRm(hostId.value); const result = await testHostWinRm(hostId.value);
winRmTestOk.value = result.ok; winRmTestOk.value = result.ok;
winRmTestMessage.value = result.message; winRmTestMessage.value = result.message;
showWinRmTestFeedback.value = true;
if (result.ok) {
scheduleWinRmTestFeedbackHide();
}
} catch (e) { } catch (e) {
winRmTestOk.value = false; winRmTestOk.value = false;
winRmTestMessage.value = e instanceof Error ? e.message : "Ошибка проверки WinRM"; winRmTestMessage.value = e instanceof Error ? e.message : "Ошибка проверки WinRM";
showWinRmTestFeedback.value = true;
} finally { } finally {
testingWinRm.value = false; testingWinRm.value = false;
} }
@@ -646,6 +671,8 @@ async function loadHost() {
loading.value = true; loading.value = true;
error.value = ""; error.value = "";
winRmTestMessage.value = ""; winRmTestMessage.value = "";
clearWinRmTestFeedbackTimer();
showWinRmTestFeedback.value = false;
sshProbeSeq += 1; sshProbeSeq += 1;
clearSshTestFeedbackTimer(); clearSshTestFeedbackTimer();
showSshTestFeedback.value = false; showSshTestFeedback.value = false;
@@ -738,6 +765,7 @@ onMounted(async () => {
onUnmounted(() => { onUnmounted(() => {
clearSshTestFeedbackTimer(); clearSshTestFeedbackTimer();
clearWinRmTestFeedbackTimer();
}); });
watch( watch(