feat: server management page with log channel editing only for admins
This commit is contained in:
12 files changed
+236
-84
No files matched your search
@@ -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' }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="notification-channel-row">
|
||||
<label for="notification-channel">Kanał logów</label>
|
||||
<select
|
||||
id="notification-channel"
|
||||
v-model="selectedNotification"
|
||||
class="premium-select"
|
||||
:disabled="!notificationChannels.length"
|
||||
@change="setNotificationChannel"
|
||||
>
|
||||
<option
|
||||
v-if="!notificationChannels.length"
|
||||
value=""
|
||||
>
|
||||
Brak dostępnych kanałów tekstowych
|
||||
</option>
|
||||
<option
|
||||
v-for="channel in notificationChannels"
|
||||
:key="channel.channel_id"
|
||||
:value="channel.channel_id"
|
||||
>
|
||||
# {{ channel.channel_name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="default-plays-row">
|
||||
<label for="default-plays">Domyślny licznik</label>
|
||||
<input
|
||||
@@ -160,25 +112,6 @@ async function saveDefaultPlays() {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.notification-channel-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.notification-channel-row label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 130px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.notification-channel-row .premium-select {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.default-plays-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in new issue
Block a user