From ddcce85ad5be328145aa51cfa301dc0837121d77 Mon Sep 17 00:00:00 2001 From: Marcin Macierzanka Date: Wed, 30 Sep 2026 20:11:22 +0200 Subject: [PATCH] feat: server management page with log channel editing only for admins --- frontend/src/components/AdminLayout.vue | 10 +- frontend/src/components/AdminServersPage.vue | 100 ++++++++++++++++++ frontend/src/components/VoiceChannelPanel.vue | 67 ------------ .../music/notification_channel_resolver.py | 8 +- .../storage/adapters/postgres/guild_config.py | 18 +++- .../migrations/0003_disable_log_channel.py | 18 ++++ .../adapters/postgres/migrations/__init__.py | 5 +- zyrarbot/storage/ports/guild_config.py | 4 + zyrarbot/ui/api/factory.py | 2 + zyrarbot/ui/api/routers/admin_router.py | 76 +++++++++++++ zyrarbot/ui/api/routers/voice_router.py | 7 +- zyrarbot/ui/bot/cogs/voice_cog.py | 5 +- 12 files changed, 236 insertions(+), 84 deletions(-) create mode 100644 frontend/src/components/AdminServersPage.vue create mode 100644 zyrarbot/storage/adapters/postgres/migrations/0003_disable_log_channel.py create mode 100644 zyrarbot/ui/api/routers/admin_router.py diff --git a/frontend/src/components/AdminLayout.vue b/frontend/src/components/AdminLayout.vue index efecf2d..7ea9381 100644 --- a/frontend/src/components/AdminLayout.vue +++ b/frontend/src/components/AdminLayout.vue @@ -1,11 +1,14 @@ + + + + diff --git a/frontend/src/components/VoiceChannelPanel.vue b/frontend/src/components/VoiceChannelPanel.vue index 66b9ceb..3a645bc 100644 --- a/frontend/src/components/VoiceChannelPanel.vue +++ b/frontend/src/components/VoiceChannelPanel.vue @@ -9,13 +9,10 @@ const props = defineProps<{ status: BotStatus | null }>() const { notify, run } = useToasts() const selected = ref('') -const selectedNotification = ref('') const defaultPlays = ref(5) const channels = computed(() => props.status?.voice_channels ?? []) const active = computed(() => props.status?.active_voice_channel ?? null) -const notificationChannels = computed(() => props.status?.text_channels ?? []) -const activeNotificationId = computed(() => props.status?.active_text_channel_id ?? null) // Wybór podąża za realnym połączeniem, a bez niego domyślnie wskazuje pierwszy kanał. watch( @@ -38,18 +35,6 @@ watch( { immediate: true }, ) -watch( - [activeNotificationId, notificationChannels], - ([activeChannel, available]) => { - if (activeChannel) { - selectedNotification.value = activeChannel - } else if (!available.some((channel) => channel.channel_id === selectedNotification.value)) { - selectedNotification.value = available[0]?.channel_id ?? '' - } - }, - { immediate: true }, -) - async function toggle() { if (active.value) { await run(() => api.disconnect(), '', 'Błąd rozłączania') @@ -62,15 +47,6 @@ async function toggle() { await run(() => api.connect(selected.value), '', 'Nie udało się połączyć') } -async function setNotificationChannel() { - if (!selectedNotification.value) return - await run( - () => api.setNotificationChannel(selectedNotification.value), - 'Ustawiono kanał logów', - 'Nie udało się ustawić kanału logów', - ) -} - async function saveDefaultPlays() { await run( () => api.setDefaultPlays(defaultPlays.value), @@ -114,30 +90,6 @@ async function saveDefaultPlays() { {{ active ? 'Odłącz' : 'Połącz' }} -
- - -