feat(frontend): terminate session button on Overview recent events (0.20.33)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-22 15:44:49 +10:00
parent 5e26834e16
commit fe818e9946
4 changed files with 32 additions and 4 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/** Fallback до загрузки /health; при релизе держите в sync с backend/app/version.py */
export const APP_NAME = "Security Alert Center";
export const APP_VERSION = "0.20.32";
export const APP_VERSION = "0.20.33";
export const APP_VERSION_LABEL = `${APP_NAME} v.${APP_VERSION}`;
+28
View File
@@ -297,6 +297,15 @@
>
qwinsta
</button>
<button
v-if="eventSupportsSessionTerminate(e)"
type="button"
class="secondary dash-qwinsta-btn"
:disabled="sessionTerminateLoadingId === e.id"
@click="runSessionTerminate(e)"
>
{{ sessionTerminateLoadingId === e.id ? "…" : "Завершить" }}
</button>
</td>
@@ -333,6 +342,7 @@ import { onMounted, onUnmounted, ref } from "vue";
import {
apiFetch,
getToken,
postEventTerminateSession,
type DashboardSummary,
type EventSummary,
} from "../api";
@@ -342,9 +352,11 @@ import { useRdgQwinsta } from "../composables/useRdgQwinsta";
import { useSacVersion } from "../composables/useSacVersion";
import { formatServerName } from "../utils/hostDisplay";
import { hasRdgFlapUi, rdgFlapQwinstaEventId } from "../utils/rdgFlap";
import { eventSupportsSessionTerminate } from "../utils/sessionActions";
const { appName, appVersion } = useSacVersion();
const { qwinstaLoadingId, qwinstaModal, closeQwinstaModal, runQwinsta, runLogoff } = useRdgQwinsta();
const sessionTerminateLoadingId = ref<number | null>(null);
const data = ref<DashboardSummary | null>(null);
@@ -366,6 +378,22 @@ function formatDt(iso: string) {
}
async function runSessionTerminate(event: EventSummary) {
const label = event.actor_user || event.title;
if (!window.confirm(`Завершить сессию пользователя ${label}?`)) return;
sessionTerminateLoadingId.value = event.id;
try {
const res = await postEventTerminateSession(event.id);
if (!res.ok) {
window.alert(res.message);
}
} catch (e) {
window.alert(e instanceof Error ? e.message : "Ошибка завершения сессии");
} finally {
sessionTerminateLoadingId.value = null;
}
}
function syncLastKnownFromRecent() {