feat(frontend): terminate session button on Overview recent events (0.20.33)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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.32"
|
APP_VERSION = "0.20.33"
|
||||||
APP_VERSION_LABEL = f"{APP_NAME} v.{APP_VERSION}"
|
APP_VERSION_LABEL = f"{APP_NAME} v.{APP_VERSION}"
|
||||||
|
|||||||
@@ -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.32"
|
assert APP_VERSION == "0.20.33"
|
||||||
assert APP_NAME == "Security Alert Center"
|
assert APP_NAME == "Security Alert Center"
|
||||||
assert APP_VERSION_LABEL == "Security Alert Center v.0.20.32"
|
assert APP_VERSION_LABEL == "Security Alert Center v.0.20.33"
|
||||||
|
|||||||
@@ -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.32";
|
export const APP_VERSION = "0.20.33";
|
||||||
export const APP_VERSION_LABEL = `${APP_NAME} v.${APP_VERSION}`;
|
export const APP_VERSION_LABEL = `${APP_NAME} v.${APP_VERSION}`;
|
||||||
|
|||||||
@@ -297,6 +297,15 @@
|
|||||||
>
|
>
|
||||||
qwinsta
|
qwinsta
|
||||||
</button>
|
</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>
|
</td>
|
||||||
|
|
||||||
@@ -333,6 +342,7 @@ import { onMounted, onUnmounted, ref } from "vue";
|
|||||||
import {
|
import {
|
||||||
apiFetch,
|
apiFetch,
|
||||||
getToken,
|
getToken,
|
||||||
|
postEventTerminateSession,
|
||||||
type DashboardSummary,
|
type DashboardSummary,
|
||||||
type EventSummary,
|
type EventSummary,
|
||||||
} from "../api";
|
} from "../api";
|
||||||
@@ -342,9 +352,11 @@ import { useRdgQwinsta } from "../composables/useRdgQwinsta";
|
|||||||
import { useSacVersion } from "../composables/useSacVersion";
|
import { useSacVersion } from "../composables/useSacVersion";
|
||||||
import { formatServerName } from "../utils/hostDisplay";
|
import { formatServerName } from "../utils/hostDisplay";
|
||||||
import { hasRdgFlapUi, rdgFlapQwinstaEventId } from "../utils/rdgFlap";
|
import { hasRdgFlapUi, rdgFlapQwinstaEventId } from "../utils/rdgFlap";
|
||||||
|
import { eventSupportsSessionTerminate } from "../utils/sessionActions";
|
||||||
|
|
||||||
const { appName, appVersion } = useSacVersion();
|
const { appName, appVersion } = useSacVersion();
|
||||||
const { qwinstaLoadingId, qwinstaModal, closeQwinstaModal, runQwinsta, runLogoff } = useRdgQwinsta();
|
const { qwinstaLoadingId, qwinstaModal, closeQwinstaModal, runQwinsta, runLogoff } = useRdgQwinsta();
|
||||||
|
const sessionTerminateLoadingId = ref<number | null>(null);
|
||||||
|
|
||||||
const data = ref<DashboardSummary | 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() {
|
function syncLastKnownFromRecent() {
|
||||||
|
|||||||
Reference in New Issue
Block a user