fix: WinRM update panel no longer blocks SAC navigation (0.20.21)

This commit is contained in:
PTah
2026-06-21 11:07:28 +10:00
parent 8a451a0c49
commit 8adaf3bfd3
6 changed files with 134 additions and 37 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.20.20" APP_VERSION = "0.20.21"
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.20.20" assert APP_VERSION == "0.20.21"
assert APP_NAME == "Security Alert Center" assert APP_NAME == "Security Alert Center"
assert APP_VERSION_LABEL == "Security Alert Center v.0.20.20" assert APP_VERSION_LABEL == "Security Alert Center v.0.20.21"
+39
View File
@@ -8,6 +8,16 @@
</div> </div>
</div> </div>
<nav class="sac-sidebar-nav" aria-label="Основная навигация"> <nav class="sac-sidebar-nav" aria-label="Основная навигация">
<button
v-if="remoteJobRunning && !remoteJobPanelOpen"
type="button"
class="sac-nav-item sac-remote-job-badge"
title="Обновление агента выполняется на сервере SAC"
@click="showHostRemoteActionLog"
>
<span class="sac-nav-icon sac-remote-job-spinner" aria-hidden="true" />
<span class="sac-nav-label">Обновление</span>
</button>
<RouterLink <RouterLink
v-for="item in navItems" v-for="item in navItems"
:key="item.to" :key="item.to"
@@ -35,10 +45,17 @@ import { useRoute, useRouter } from "vue-router";
import { clearToken, isAdmin } from "../api"; import { clearToken, isAdmin } from "../api";
import SidebarSystemStats from "./SidebarSystemStats.vue"; import SidebarSystemStats from "./SidebarSystemStats.vue";
import { useSacVersion } from "../composables/useSacVersion"; import { useSacVersion } from "../composables/useSacVersion";
import {
hasActiveHostRemoteAction,
hostRemoteActionLog,
showHostRemoteActionLog,
} from "../composables/useHostRemoteAction";
const { appName, appVersion } = useSacVersion(); const { appName, appVersion } = useSacVersion();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const remoteJobRunning = computed(() => hasActiveHostRemoteAction());
const remoteJobPanelOpen = computed(() => hostRemoteActionLog.open);
const navItems = computed(() => { const navItems = computed(() => {
const items = [ const items = [
@@ -161,6 +178,28 @@ function logout() {
transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease; transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
} }
.sac-remote-job-badge {
color: #58a6ff;
border-left-color: #58a6ff;
background: rgba(88, 166, 255, 0.08);
}
.sac-remote-job-spinner {
display: inline-block;
width: 0.85rem;
height: 0.85rem;
border: 2px solid #3a4556;
border-top-color: #58a6ff;
border-radius: 50%;
animation: sac-remote-job-spin 0.8s linear infinite;
}
@keyframes sac-remote-job-spin {
to {
transform: rotate(360deg);
}
}
.sac-nav-item:hover { .sac-nav-item:hover {
background: #1e2d3d; background: #1e2d3d;
color: #fff; color: #fff;
+80 -32
View File
@@ -1,16 +1,31 @@
<template> <template>
<div v-if="open" class="modal-backdrop" @click.self="onBackdropClick"> <div v-if="open" class="host-action-log-dock" aria-live="polite">
<div class="modal-card host-action-log-modal" role="dialog" aria-modal="true"> <div class="host-action-log-panel" role="dialog" :aria-label="title">
<h3>{{ title }}</h3> <div class="host-action-log-header">
<h3>{{ title }}</h3>
<button
type="button"
class="host-action-log-icon-btn"
:title="loading ? 'Свернуть — обновление продолжится на сервере' : 'Закрыть'"
:aria-label="loading ? 'Свернуть' : 'Закрыть'"
@click="emit('close')"
>
×
</button>
</div>
<p v-if="loading" class="host-action-log-status"> <p v-if="loading" class="host-action-log-status">
<span class="host-action-log-spinner" aria-hidden="true" /> <span class="host-action-log-spinner" aria-hidden="true" />
Выполняется на удалённом хосте Это может занять несколько минут. Выполняется на удалённом хосте Можно перейти в другой раздел SAC.
</p> </p>
<p v-if="message" :class="messageClass">{{ message }}</p> <p v-if="message && !loading" :class="messageClass">{{ message }}</p>
<p v-else-if="message && loading" class="muted host-action-log-sub">{{ message }}</p>
<pre v-if="output" class="host-action-log-output">{{ output }}</pre> <pre v-if="output" class="host-action-log-output">{{ output }}</pre>
<div class="modal-actions"> <div class="host-action-log-actions">
<button type="button" class="secondary" :disabled="loading" @click="emit('close')"> <button v-if="loading" type="button" class="secondary" @click="emit('close')">
{{ loading ? "Выполняется" : "Закрыть" }} Свернуть
</button>
<button v-else type="button" class="secondary" @click="emit('close')">
Закрыть
</button> </button>
</div> </div>
</div> </div>
@@ -37,46 +52,79 @@ const messageClass = computed(() => {
if (props.loading || props.ok == null) return "muted"; if (props.loading || props.ok == null) return "muted";
return props.ok ? "success" : "error"; return props.ok ? "success" : "error";
}); });
function onBackdropClick() {
if (!props.loading) emit("close");
}
</script> </script>
<style scoped> <style scoped>
.modal-backdrop { .host-action-log-dock {
position: fixed; position: fixed;
inset: 0; right: 1rem;
background: rgba(0, 0, 0, 0.55); bottom: 1rem;
display: flex;
align-items: center;
justify-content: center;
z-index: 1000; z-index: 1000;
padding: 1rem; max-width: min(28rem, calc(100vw - 2rem));
pointer-events: none;
} }
.modal-card { .host-action-log-panel {
pointer-events: auto;
background: var(--card-bg, #1e2430); background: var(--card-bg, #1e2430);
border: 1px solid var(--border, #3a4556); border: 1px solid var(--border, #3a4556);
border-radius: 8px; border-radius: 8px;
max-width: 820px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
width: 100%; max-height: min(70vh, 28rem);
max-height: 85vh;
overflow: auto; overflow: auto;
padding: 1rem 1.25rem; padding: 0.85rem 1rem 1rem;
}
.host-action-log-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 0.5rem;
}
.host-action-log-header h3 {
margin: 0;
font-size: 1rem;
line-height: 1.3;
}
.host-action-log-icon-btn {
flex-shrink: 0;
width: 1.75rem;
height: 1.75rem;
padding: 0;
border: none;
border-radius: 4px;
background: transparent;
color: #9aa4b2;
font-size: 1.25rem;
line-height: 1;
cursor: pointer;
}
.host-action-log-icon-btn:hover {
background: rgba(255, 255, 255, 0.08);
color: #e6edf3;
} }
.host-action-log-status { .host-action-log-status {
display: flex; display: flex;
align-items: center; align-items: flex-start;
gap: 0.65rem; gap: 0.65rem;
margin: 0.75rem 0; margin: 0.65rem 0 0;
color: #9aa4b2; color: #9aa4b2;
font-size: 0.9rem;
}
.host-action-log-sub {
margin: 0.35rem 0 0;
font-size: 0.85rem;
} }
.host-action-log-spinner { .host-action-log-spinner {
width: 1rem; width: 1rem;
height: 1rem; height: 1rem;
margin-top: 0.15rem;
border: 2px solid #3a4556; border: 2px solid #3a4556;
border-top-color: #58a6ff; border-top-color: #58a6ff;
border-radius: 50%; border-radius: 50%;
@@ -91,18 +139,18 @@ function onBackdropClick() {
} }
.host-action-log-output { .host-action-log-output {
margin-top: 0.75rem; margin-top: 0.65rem;
max-height: 24rem; max-height: 12rem;
overflow: auto; overflow: auto;
padding: 0.75rem; padding: 0.65rem;
background: #0d1117; background: #0d1117;
border-radius: 6px; border-radius: 6px;
font-size: 0.85rem; font-size: 0.8rem;
white-space: pre-wrap; white-space: pre-wrap;
} }
.modal-actions { .host-action-log-actions {
margin-top: 1rem; margin-top: 0.75rem;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
gap: 0.5rem; gap: 0.5rem;
@@ -38,6 +38,7 @@ function finishModal(job: HostRemoteActionJobStatus) {
hostRemoteActionLog.loading = false; hostRemoteActionLog.loading = false;
hostRemoteActionLog.ok = job.ok ?? job.status === "success"; hostRemoteActionLog.ok = job.ok ?? job.status === "success";
applyJobToModal(job); applyJobToModal(job);
hostRemoteActionLog.open = true;
} }
async function pollRemoteJob(hostId: number): Promise<HostRemoteActionJobStatus> { async function pollRemoteJob(hostId: number): Promise<HostRemoteActionJobStatus> {
@@ -115,6 +116,15 @@ export async function runHostRemoteAction(
} }
export function closeHostRemoteActionLog() { export function closeHostRemoteActionLog() {
if (hostRemoteActionLog.loading) return;
hostRemoteActionLog.open = false; hostRemoteActionLog.open = false;
} }
export function showHostRemoteActionLog() {
if (hostRemoteActionLog.loading || hostRemoteActionLog.ok != null) {
hostRemoteActionLog.open = true;
}
}
export function hasActiveHostRemoteAction(): boolean {
return hostRemoteActionLog.loading;
}
+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.20.20"; export const APP_VERSION = "0.20.21";
export const APP_VERSION_LABEL = `${APP_NAME} v.${APP_VERSION}`; export const APP_VERSION_LABEL = `${APP_NAME} v.${APP_VERSION}`;