-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathapp.vue
More file actions
116 lines (102 loc) · 3.29 KB
/
app.vue
File metadata and controls
116 lines (102 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<template>
<div class="min-h-screen bg-background text-foreground">
<!-- Backend Initializing Screen - Show when backend is not ready (as overlay) -->
<!-- NEVER show on /setup page or during initial setup process -->
<BackendInitializing
v-if="shouldShowBackendInitializing"
@ready="handleBackendReady"
/>
<!-- Main content - Always render to satisfy Nuxt's static analysis -->
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<!-- Notification system -->
<NotificationSystem />
</div>
</template>
<script setup lang="ts">
// Global head configuration
useHead({
title: 'Darth Vadarr - SeerrBridge Dashboard',
meta: [
{ name: 'description', content: 'Monitor and manage your SeerrBridge service with ease' }
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: '/vadarr-icon.svg' },
{ rel: 'alternate icon', type: 'image/x-icon', href: '/vadarr-icon.ico' }
]
})
// Initialize color mode
const colorMode = useColorMode()
// Backend readiness check
const { isBackendReady, isChecking: isCheckingBackend, startChecking, stopChecking } = useBackendReady()
// Setup status tracking
const setupNeeded = ref(false)
const route = useRoute()
// Check if we should show the backend initializing screen
// NEVER show it on /setup page or when setup is needed
const shouldShowBackendInitializing = computed(() => {
// Never show on setup page
if (route.path === '/setup') {
return false
}
// Never show when setup is needed
if (setupNeeded.value) {
return false
}
// Only show if backend is not ready and we're checking
return !isBackendReady.value && isCheckingBackend.value
})
const handleBackendReady = () => {
// Backend is ready - update state to hide loading screen
isBackendReady.value = true
isCheckingBackend.value = false
}
// Check setup status
const checkSetupStatus = async () => {
try {
const response = await $fetch('/api/setup-status')
setupNeeded.value = response?.data?.needsSetup ?? false
} catch (error) {
// On error, assume setup is needed to be safe
console.error('Error checking setup status:', error)
setupNeeded.value = true
}
}
// Watch route changes to handle setup page navigation
watch(() => route.path, (newPath) => {
if (newPath === '/setup') {
// On setup page - stop checking backend and mark as ready
stopChecking()
isBackendReady.value = true
isCheckingBackend.value = false
setupNeeded.value = true
} else {
// Not on setup page - check setup status and start backend checking if needed
checkSetupStatus().then(() => {
if (!setupNeeded.value) {
// Setup is complete, start checking backend
startChecking()
} else {
// Setup needed - don't check backend
isBackendReady.value = true
isCheckingBackend.value = false
}
})
}
}, { immediate: true })
// Start checking backend status on app mount
onMounted(async () => {
// Check setup status first
await checkSetupStatus()
// Only check backend if we're not on setup page and setup is complete
if (route.path !== '/setup' && !setupNeeded.value) {
startChecking()
} else {
// On setup page or setup needed - don't check backend
stopChecking()
isBackendReady.value = true
isCheckingBackend.value = false
}
})
</script>