feat: Windows admin in Settings UI and WinRM host test (0.10.1)

Store domain admin in ui_settings (DB overrides env); qwinsta/logoff use effective config.
Host card: POST /hosts/{id}/actions/winrm-test via pywinrm.
This commit is contained in:
2026-06-20 00:01:17 +10:00
parent df4c93d243
commit 154ba3efc2
16 changed files with 602 additions and 14 deletions
+38
View File
@@ -47,6 +47,17 @@
<dd>{{ host.event_count ?? 0 }}</dd>
</div>
</dl>
<div v-if="isWindowsHost" class="host-actions">
<button
type="button"
class="secondary"
:disabled="testingWinRm"
@click="runWinRmTest"
>
{{ testingWinRm ? "Проверка…" : "Проверить WinRM (admin)" }}
</button>
<p v-if="winRmTestMessage" :class="winRmTestOk ? 'success' : 'error'">{{ winRmTestMessage }}</p>
</div>
</div>
<section v-if="inventory" class="host-inventory card">
@@ -165,6 +176,7 @@ import {
apiFetch,
fetchHost,
fetchRecentEvents,
testHostWinRm,
type EventListResponse,
type HostDetail,
} from "../api";
@@ -180,6 +192,9 @@ const error = ref("");
const eventsError = ref("");
const eventsPage = ref(1);
const eventsPageSize = 50;
const testingWinRm = ref(false);
const winRmTestMessage = ref("");
const winRmTestOk = ref(false);
let refreshingLive = false;
useSacLiveEventStream(() => {
@@ -188,6 +203,13 @@ useSacLiveEventStream(() => {
const hostId = computed(() => parseInt(props.id, 10));
const isWindowsHost = computed(() => {
const h = host.value;
if (!h) return false;
if ((h.os_family || "").toLowerCase() === "windows") return true;
return h.product === "rdp-login-monitor";
});
const inventory = computed(() => host.value?.inventory ?? null);
const windowsFields = computed(() => {
@@ -266,6 +288,7 @@ function agentLabel(status: string) {
async function loadHost() {
loading.value = true;
error.value = "";
winRmTestMessage.value = "";
try {
host.value = await fetchHost(hostId.value);
} catch (e) {
@@ -275,6 +298,21 @@ async function loadHost() {
}
}
async function runWinRmTest() {
testingWinRm.value = true;
winRmTestMessage.value = "";
try {
const result = await testHostWinRm(hostId.value);
winRmTestOk.value = result.ok;
winRmTestMessage.value = result.message;
} catch (e) {
winRmTestOk.value = false;
winRmTestMessage.value = e instanceof Error ? e.message : "Ошибка проверки WinRM";
} finally {
testingWinRm.value = false;
}
}
async function refreshFromLatestEvent() {
if (refreshingLive) return;
refreshingLive = true;