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:
2026-06-20 15:57:15 +10:00
parent cd2f27792d
commit d820d941c1
4 changed files with 35 additions and 7 deletions
+31 -3
View File
@@ -72,7 +72,7 @@
>
{{ testingWinRm ? "Проверка…" : "Проверить WinRM (admin)" }}
</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">
<button
type="button"
@@ -297,7 +297,7 @@ import {
} from "../api";
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 route = useRoute();
@@ -313,6 +313,7 @@ const eventsPageSize = 50;
const testingWinRm = ref(false);
const winRmTestMessage = ref("");
const winRmTestOk = ref(false);
const showWinRmTestFeedback = ref(false);
const testingSsh = ref(false);
const updatingAgent = ref(false);
const showSshTestFeedback = ref(false);
@@ -334,6 +335,7 @@ const configForm = reactive({
getInventory: true,
});
let sshTestHideTimer: ReturnType<typeof setTimeout> | null = null;
let winRmTestHideTimer: ReturnType<typeof setTimeout> | null = null;
let sshProbeSeq = 0;
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() {
clearSshTestFeedbackTimer();
sshTestHideTimer = setTimeout(() => {
@@ -487,7 +496,16 @@ function scheduleSshTestFeedbackHide() {
sshTestOutput.value = "";
showSshTestFeedback.value = false;
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 } = {}) {
@@ -544,14 +562,21 @@ async function probeSshOnOpen() {
async function runWinRmTest() {
testingWinRm.value = true;
clearWinRmTestFeedbackTimer();
winRmTestMessage.value = "";
showWinRmTestFeedback.value = false;
try {
const result = await testHostWinRm(hostId.value);
winRmTestOk.value = result.ok;
winRmTestMessage.value = result.message;
showWinRmTestFeedback.value = true;
if (result.ok) {
scheduleWinRmTestFeedbackHide();
}
} catch (e) {
winRmTestOk.value = false;
winRmTestMessage.value = e instanceof Error ? e.message : "Ошибка проверки WinRM";
showWinRmTestFeedback.value = true;
} finally {
testingWinRm.value = false;
}
@@ -646,6 +671,8 @@ async function loadHost() {
loading.value = true;
error.value = "";
winRmTestMessage.value = "";
clearWinRmTestFeedbackTimer();
showWinRmTestFeedback.value = false;
sshProbeSeq += 1;
clearSshTestFeedbackTimer();
showSshTestFeedback.value = false;
@@ -738,6 +765,7 @@ onMounted(async () => {
onUnmounted(() => {
clearSshTestFeedbackTimer();
clearWinRmTestFeedbackTimer();
});
watch(