Skip to content

Commit 6739b9f

Browse files
author
Lasim
committed
feat(frontend): restructure account settings components and add GitHub App and SMTP settings
1 parent 67dc10f commit 6739b9f

File tree

13 files changed

+73
-26
lines changed

13 files changed

+73
-26
lines changed

services/frontend/src/components/settings/AccountSidebarNav.vue renamed to services/frontend/src/components/account/AccountSidebarNav.vue

File renamed without changes.

services/frontend/src/components/settings/GitHubAppSettings.vue renamed to services/frontend/src/components/globalSettings/GitHubAppSettings.vue

File renamed without changes.

services/frontend/src/components/settings/GlobalSettingsSidebarNav.vue renamed to services/frontend/src/components/globalSettings/GlobalSettingsSidebarNav.vue

File renamed without changes.

services/frontend/src/components/settings/SmtpSettings.vue renamed to services/frontend/src/components/globalSettings/SmtpSettings.vue

File renamed without changes.
File renamed without changes.

services/frontend/src/composables/useSettingsComponentRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Component } from 'vue'
2-
import type { GlobalSettingGroup, Setting } from '@/components/settings/GlobalSettingsSidebarNav.vue'
2+
import type { GlobalSettingGroup, Setting } from '@/components/globalSettings/GlobalSettingsSidebarNav.vue'
33

44
export interface SettingsComponentProps {
55
group: GlobalSettingGroup

services/frontend/src/composables/useSettingsForm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ref, computed, watch } from 'vue'
2-
import type { Setting } from '@/components/settings/GlobalSettingsSidebarNav.vue'
2+
import type { Setting } from '@/components/globalSettings/GlobalSettingsSidebarNav.vue'
33
import { getEnv } from '@/utils/env'
44

55
export interface FormValues {

services/frontend/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { PluginManager } from './plugin-system/plugin-manager'
1212
import { loadPlugins } from './plugins'
1313
import ExtensionPoint from './components/ExtensionPoint.vue'
1414
import type { EventBusEvents } from './composables/useEventBus'
15-
import { registerSettingsComponents } from './components/settings'
15+
import { registerSettingsComponents } from './components/globalSettings'
1616

1717
const app = createApp(App)
1818
const pinia = createPinia()

services/frontend/src/router/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,13 @@ const routes = [
150150
children: [
151151
{
152152
path: 'settings',
153-
redirect: '/admin/settings/global'
153+
name: 'AdminSettingsIndex',
154+
component: () => import('../views/admin/settings/index.vue'),
154155
},
155156
{
156-
path: 'settings/:groupId',
157+
path: 'settings/:type',
157158
name: 'AdminSettings',
158-
component: () => import('../views/admin/GlobalSettings.vue'),
159+
component: () => import('../views/admin/settings/[type].vue'),
159160
},
160161
{
161162
path: 'users',

services/frontend/src/views/admin/GlobalSettings.vue renamed to services/frontend/src/views/admin/settings/[type].vue

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import { useRoute } from 'vue-router'
44
import { useI18n } from 'vue-i18n'
55
import { toast } from 'vue-sonner'
66
import { 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'
88
import DashboardLayout from '@/components/DashboardLayout.vue'
99
import { 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'
1114
import {
1215
Card,
1316
CardContent,
@@ -24,7 +27,6 @@ const settingGroups = ref<GlobalSettingGroup[]>([])
2427
const isLoading = ref(true)
2528
const error = ref<string | null>(null)
2629
27-
2830
const 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
7173
const 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
134129
const 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
167160
watch(() => 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

Comments
 (0)