This commit is contained in:
2026-10-11 14:59:59 +07:00
parent f668eb66bc
commit 5980a5385e
6 changed files with 123 additions and 33 deletions
+6 -2
View File
@@ -136,7 +136,7 @@ const canViewState = computed(
)
const isStateOnly = computed(() => canViewState.value && !canManageGame.value)
useDeviceContext(() => (canManageGame.value ? { organizerGameID: Number(gameId) } : {}))
const { devices, serverTime, isLoading, hasError, summary, reload } = useGameState(
const { devices, wifi, serverTime, isLoading, hasError, summary, reload } = useGameState(
() => Number(route.params.id),
() => canViewState.value && activeTab.value === 'state',
)
@@ -178,7 +178,10 @@ watch(
)
const canExport = computed(
() => uiStore.environment === 'prod' && authStore.hasAnyRole(['admin', 'organizer', 'developer']),
() =>
Number(game.value.ID) > 0 &&
uiStore.environment === 'prod' &&
authStore.hasAnyRole(['admin', 'organizer', 'developer']),
)
const isStartingExport = ref(false)
const isDownloadingPackage = ref(false)
@@ -1360,6 +1363,7 @@ useSimplePolling(() => {
>
<GameStatePanel
:devices="devices"
:wifi="wifi"
:server-time="serverTime"
:is-loading="isLoading"
:has-error="hasError"
+31 -1
View File
@@ -1,12 +1,13 @@
<script setup lang="ts">
import { NAlert, NButton, NCollapse, NCollapseItem, NFlex, NSpin, NTag } from 'naive-ui'
import type { VenueDevice } from '@/api/generated/crabs/evening_detective_server'
import type { VenueDevice, VenueWiFi } from '@/api/generated/crabs/evening_detective_server'
import UiBlock from '@/components/UiBlock.vue'
import { formatGameDateTime } from '@/utils/datetime'
defineProps<{
devices: VenueDevice[]
wifi?: VenueWiFi
serverTime?: string
isLoading: boolean
hasError: boolean
@@ -37,6 +38,35 @@ const kinds: Record<string, string> = {
<p v-else-if="!hasError && !serverTime && !isLoading">Загружаем состояние…</p>
<p v-else-if="serverTime && !devices.length">Устройства этой игры пока не зарегистрированы</p>
</UiBlock>
<UiBlock>
<h3>Wi-Fi площадки</h3>
<p>
Все Wi-Fi-клиенты Cudy, независимо от выбранной игры. MAC устройства и UUID браузера
различаются.
</p>
<p v-if="!wifi?.enabled">Сбор данных Cudy не настроен</p>
<template v-else>
<n-alert
v-if="wifi.hasError"
type="warning"
role="alert"
title="Не удалось обновить данные Cudy"
/>
<n-tag v-if="wifi.stale" type="warning">Данные устарели</n-tag>
<p v-if="wifi.collectedAt">
Последний снимок Cudy: {{ formatGameDateTime(wifi.collectedAt) }}
</p>
<template v-if="wifi.collectedAt">
<p>Wi-Fi-клиентов: {{ wifi.clients?.length || 0 }}</p>
<p v-if="!wifi.clients?.length">Wi-Fi-клиенты пока не подключены</p>
<div v-for="client in wifi.clients" :key="client.MAC" class="connection device-details">
<strong>{{ client.MAC }}</strong>
<p>IP: {{ client.IP || '—' }} · {{ client.band }}</p>
<p>Сигнал: {{ client.signal === undefined ? 'Нет данных' : `${client.signal} dBm` }}</p>
</div>
</template>
</template>
</UiBlock>
<UiBlock v-for="device in devices" :key="device.ID">
<div class="device-details">
<strong>{{ device.ID }}</strong>