@@ -4,10 +4,13 @@ import { useRoute } from 'vue-router'
44import { useI18n } from ' vue-i18n'
55import { toast } from ' vue-sonner'
66import { useEventBus } from ' @/composables/useEventBus'
7- import GlobalSettingsSidebarNav , { type GlobalSettingGroup } from ' @/components/settings /GlobalSettingsSidebarNav.vue'
7+ import GlobalSettingsSidebarNav , { type GlobalSettingGroup , type Setting } from ' @/components/globalSettings /GlobalSettingsSidebarNav.vue'
88import DashboardLayout from ' @/components/DashboardLayout.vue'
99import { getEnv } from ' @/utils/env'
10-
10+ import { Button } from ' @/components/ui/button'
11+ import { Input } from ' @/components/ui/input'
12+ import { Switch } from ' @/components/ui/switch'
13+ import { Label } from ' @/components/ui/label'
1114import {
1215 Card ,
1316 CardContent ,
@@ -24,7 +27,6 @@ const settingGroups = ref<GlobalSettingGroup[]>([])
2427const isLoading = ref (true )
2528const error = ref <string | null >(null )
2629
27-
2830const apiUrl = getEnv (' VITE_DEPLOYSTACK_BACKEND_URL' ) || ' ' // Fallback to empty string if not set
2931
3032// Placeholder for the actual API call
@@ -69,7 +71,7 @@ onMounted(async () => {
6971})
7072
7173const currentGroupId = computed (() => {
72- const groupId = route .params .groupId as string | undefined ;
74+ const groupId = route .params .type as string | undefined ;
7375 return groupId ;
7476})
7577
@@ -123,13 +125,6 @@ function handleConnectionTested(result: { success: boolean; message: string }) {
123125 // Connection test results are handled by individual components
124126}
125127
126- // For editable form
127- import { type Setting } from ' @/components/settings/GlobalSettingsSidebarNav.vue' // Import Setting interface
128- import { Button } from ' @/components/ui/button'
129- import { Input } from ' @/components/ui/input'
130- import { Switch } from ' @/components/ui/switch'
131- import { Label } from ' @/components/ui/label'
132-
133128// Reactive form values
134129const formValues = ref <Record <string , string | number | boolean >>({})
135130
@@ -161,8 +156,6 @@ function createInitialValues(settings: Setting[]) {
161156 return values
162157}
163158
164-
165-
166159// Watch for group changes and set form values
167160watch (() => selectedGroup .value , (newGroup ) => {
168161 if (newGroup ?.settings ) {
@@ -222,8 +215,6 @@ async function handleSubmit(event: Event) {
222215 throw new Error (errorData .error || errorData .message || ` ${t (' globalSettings.errors.saveSettings' )}: ${response .statusText } (status: ${response .status }) ` )
223216 }
224217
225-
226-
227218 const result = await response .json ()
228219
229220 if (! result .success ) {
@@ -265,13 +256,11 @@ async function handleSubmit(event: Event) {
265256 console .error (' Failed to save settings:' , err )
266257 }
267258}
268-
269259 </script >
270260
271261<template >
272262 <DashboardLayout :title =" t('globalSettings.title')" >
273263 <div class =" hidden space-y-6 pb-16 md:block" >
274-
275264 <div class =" flex flex-col space-y-8 lg:flex-row lg:space-x-12 lg:space-y-0" >
276265 <aside class =" lg:w-1/5" >
277266 <GlobalSettingsSidebarNav :groups =" settingGroups" />
@@ -281,7 +270,6 @@ async function handleSubmit(event: Event) {
281270 <div v-if =" isLoading" class =" text-muted-foreground" >{{ t('globalSettings.loading') }}</div >
282271 <div v-else-if =" error" class =" text-red-500" >{{ t('globalSettings.errors.loadSettings') }}: {{ error }}</div >
283272
284-
285273 <div v-else-if =" selectedGroup" class =" space-y-6" >
286274 <!-- Custom Component -->
287275 <component
@@ -355,7 +343,6 @@ async function handleSubmit(event: Event) {
355343 </Card >
356344 </div >
357345
358-
359346 <div v-else-if =" !currentGroupId && settingGroups.length > 0" >
360347 <p class =" text-muted-foreground" >{{ t('globalSettings.form.selectCategory') }}</p >
361348 </div >
0 commit comments