fix: Wire automation toggles, browse uMod, and error feedback across admin views
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
- ServerView: automation toggles (crash recovery, auto-update, force wipe eligible) now call updateConfig() on click with toast success/error; all catch blocks get toast feedback instead of silent swallow - PluginsView: Browse uMod tab wired to /plugins/search backend endpoint with debounced search, results table, and Install button that calls installPlugin(); shows install state and marks already-installed plugins - WipesView: dry-run results now displayed in a collapsible panel (would_delete / would_preserve lists + estimated duration); schedule enable/disable toggle wired to PUT /wipes/schedules/:id with loading state and toast feedback - AnalyticsView: catch blocks now show toast errors instead of console.log; Player Retention placeholder replaced with intentional placeholder cards - TeamView, ChatLogView, PlayersView, NotificationsView, MapsView: all empty catch blocks and '// API not wired yet' comments replaced with toast.error() calls; Notifications save now shows success toast Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useServerStore } from '@/stores/server'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useToastStore } from '@/stores/toast'
|
||||
import {
|
||||
Server,
|
||||
Wifi,
|
||||
@@ -23,6 +24,7 @@ import { useWebSocket } from '@/composables/useWebSocket'
|
||||
|
||||
const server = useServerStore()
|
||||
const auth = useAuthStore()
|
||||
const toast = useToastStore()
|
||||
|
||||
const editMode = ref(false)
|
||||
const saving = ref(false)
|
||||
@@ -107,7 +109,7 @@ async function startDeploy() {
|
||||
await server.deployServer(deployForm.value)
|
||||
showDeployForm.value = false
|
||||
} catch {
|
||||
// Error handled in store
|
||||
toast.error('Failed to start deployment')
|
||||
} finally {
|
||||
deployLoading.value = false
|
||||
}
|
||||
@@ -162,8 +164,9 @@ async function saveConfig() {
|
||||
try {
|
||||
await server.updateConfig(form.value)
|
||||
editMode.value = false
|
||||
toast.success('Server configuration saved')
|
||||
} catch {
|
||||
// Handle error
|
||||
toast.error('Failed to save server configuration')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
@@ -176,13 +179,25 @@ async function serverAction(action: 'start' | 'stop' | 'restart') {
|
||||
else if (action === 'stop') await server.stopServer()
|
||||
else await server.restartServer()
|
||||
await server.fetchServer()
|
||||
toast.success(`Server ${action} command sent`)
|
||||
} catch {
|
||||
// Handle error
|
||||
toast.error(`Failed to ${action} server`)
|
||||
} finally {
|
||||
actionLoading.value = null
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleAutomation(field: 'crash_recovery_enabled' | 'auto_update_on_force_wipe' | 'force_wipe_eligible') {
|
||||
if (!server.config) return
|
||||
const newValue = !server.config[field]
|
||||
try {
|
||||
await server.updateConfig({ [field]: newValue })
|
||||
toast.success('Automation setting saved')
|
||||
} catch {
|
||||
toast.error('Failed to save automation setting')
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await server.fetchServer()
|
||||
loadFormFromConfig()
|
||||
@@ -631,45 +646,51 @@ onMounted(async () => {
|
||||
<p class="text-sm text-neutral-200">Auto-Restart</p>
|
||||
<p class="text-xs text-neutral-500">Restart on crash detection</p>
|
||||
</div>
|
||||
<div
|
||||
class="w-9 h-5 rounded-full transition-colors cursor-pointer"
|
||||
<button
|
||||
@click="toggleAutomation('crash_recovery_enabled')"
|
||||
:disabled="!server.config"
|
||||
class="w-9 h-5 rounded-full transition-colors cursor-pointer disabled:opacity-40"
|
||||
:class="server.config?.crash_recovery_enabled ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||
>
|
||||
<div
|
||||
class="w-4 h-4 bg-white rounded-full shadow transition-transform mt-0.5"
|
||||
:class="server.config?.crash_recovery_enabled ? 'translate-x-4.5' : 'translate-x-0.5'"
|
||||
/>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-sm text-neutral-200">Auto-Update on Force Wipe</p>
|
||||
<p class="text-xs text-neutral-500">Update when Facepunch pushes</p>
|
||||
</div>
|
||||
<div
|
||||
class="w-9 h-5 rounded-full transition-colors cursor-pointer"
|
||||
<button
|
||||
@click="toggleAutomation('auto_update_on_force_wipe')"
|
||||
:disabled="!server.config"
|
||||
class="w-9 h-5 rounded-full transition-colors cursor-pointer disabled:opacity-40"
|
||||
:class="server.config?.auto_update_on_force_wipe ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||
>
|
||||
<div
|
||||
class="w-4 h-4 bg-white rounded-full shadow transition-transform mt-0.5"
|
||||
:class="server.config?.auto_update_on_force_wipe ? 'translate-x-4.5' : 'translate-x-0.5'"
|
||||
/>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-sm text-neutral-200">Force Wipe Eligible</p>
|
||||
<p class="text-xs text-neutral-500">Server participates in force wipes</p>
|
||||
</div>
|
||||
<div
|
||||
class="w-9 h-5 rounded-full transition-colors cursor-pointer"
|
||||
<button
|
||||
@click="toggleAutomation('force_wipe_eligible')"
|
||||
:disabled="!server.config"
|
||||
class="w-9 h-5 rounded-full transition-colors cursor-pointer disabled:opacity-40"
|
||||
:class="server.config?.force_wipe_eligible ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||
>
|
||||
<div
|
||||
class="w-4 h-4 bg-white rounded-full shadow transition-transform mt-0.5"
|
||||
:class="server.config?.force_wipe_eligible ? 'translate-x-4.5' : 'translate-x-0.5'"
|
||||
/>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user