Skip to content

Commit 616930f

Browse files
committed
refactor(frontend): 将备份和数据管理页面合并为设置页的标签页
将独立的 /admin/backup 和 /admin/data-management 页面整合到设置页, 作为「备份」和「Sora 存储」标签页,减少侧边栏条目,集中管理配置。 - 移除 BackupView 和 DataManagementView 的 AppLayout 包装 - 在 SettingsView 中以子组件形式嵌入,使用 v-show 切换标签 - 删除独立路由和侧边栏菜单入口 - 备份/数据标签页下隐藏主保存按钮(各自有独立保存) - 优化标签栏样式适配7个标签,PC端支持细滚动条 - 清理未使用的图标组件和 i18n 键
1 parent b9c31fa commit 616930f

7 files changed

Lines changed: 55 additions & 91 deletions

File tree

frontend/src/components/layout/AppSidebar.vue

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -357,51 +357,6 @@ const ServerIcon = {
357357
)
358358
}
359359
360-
const DatabaseIcon = {
361-
render: () =>
362-
h(
363-
'svg',
364-
{ fill: 'none', viewBox: '0 0 24 24', stroke: 'currentColor', 'stroke-width': '1.5' },
365-
[
366-
h('path', {
367-
'stroke-linecap': 'round',
368-
'stroke-linejoin': 'round',
369-
d: 'M3.75 5.25C3.75 4.007 7.443 3 12 3s8.25 1.007 8.25 2.25S16.557 7.5 12 7.5 3.75 6.493 3.75 5.25z'
370-
}),
371-
h('path', {
372-
'stroke-linecap': 'round',
373-
'stroke-linejoin': 'round',
374-
d: 'M3.75 5.25v4.5C3.75 10.993 7.443 12 12 12s8.25-1.007 8.25-2.25v-4.5'
375-
}),
376-
h('path', {
377-
'stroke-linecap': 'round',
378-
'stroke-linejoin': 'round',
379-
d: 'M3.75 9.75v4.5c0 1.243 3.693 2.25 8.25 2.25s8.25-1.007 8.25-2.25v-4.5'
380-
}),
381-
h('path', {
382-
'stroke-linecap': 'round',
383-
'stroke-linejoin': 'round',
384-
d: 'M3.75 14.25v4.5C3.75 19.993 7.443 21 12 21s8.25-1.007 8.25-2.25v-4.5'
385-
})
386-
]
387-
)
388-
}
389-
390-
const CloudArrowUpIcon = {
391-
render: () =>
392-
h(
393-
'svg',
394-
{ fill: 'none', viewBox: '0 0 24 24', stroke: 'currentColor', 'stroke-width': '1.5' },
395-
[
396-
h('path', {
397-
'stroke-linecap': 'round',
398-
'stroke-linejoin': 'round',
399-
d: 'M12 16.5V9.75m0 0l3 3m-3-3l-3 3M6.75 19.5a4.5 4.5 0 01-1.41-8.775 5.25 5.25 0 0110.233-2.33 3 3 0 013.758 3.848A3.752 3.752 0 0118 19.5H6.75z'
400-
})
401-
]
402-
)
403-
}
404-
405360
const BellIcon = {
406361
render: () =>
407362
h(
@@ -626,8 +581,6 @@ const adminNavItems = computed((): NavItem[] => {
626581
if (authStore.isSimpleMode) {
627582
const filtered = baseItems.filter(item => !item.hideInSimpleMode)
628583
filtered.push({ path: '/keys', label: t('nav.apiKeys'), icon: KeyIcon })
629-
filtered.push({ path: '/admin/backup', label: t('nav.backup'), icon: CloudArrowUpIcon })
630-
filtered.push({ path: '/admin/data-management', label: t('nav.dataManagement'), icon: DatabaseIcon })
631584
filtered.push({ path: '/admin/settings', label: t('nav.settings'), icon: CogIcon })
632585
// Add admin custom menu items after settings
633586
for (const cm of customMenuItemsForAdmin.value) {
@@ -636,8 +589,6 @@ const adminNavItems = computed((): NavItem[] => {
636589
return filtered
637590
}
638591
639-
baseItems.push({ path: '/admin/backup', label: t('nav.backup'), icon: CloudArrowUpIcon })
640-
baseItems.push({ path: '/admin/data-management', label: t('nav.dataManagement'), icon: DatabaseIcon })
641592
baseItems.push({ path: '/admin/settings', label: t('nav.settings'), icon: CogIcon })
642593
// Add admin custom menu items after settings
643594
for (const cm of customMenuItemsForAdmin.value) {

frontend/src/i18n/locales/en.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,6 @@ export default {
340340
redeemCodes: 'Redeem Codes',
341341
ops: 'Ops',
342342
promoCodes: 'Promo Codes',
343-
backup: 'DB Backup',
344-
dataManagement: 'Data Management',
345343
settings: 'Settings',
346344
myAccount: 'My Account',
347345
lightMode: 'Light Mode',
@@ -3938,6 +3936,8 @@ export default {
39383936
users: 'Users',
39393937
gateway: 'Gateway',
39403938
email: 'Email',
3939+
backup: 'Backup',
3940+
data: 'Sora Storage',
39413941
},
39423942
emailTabDisabledTitle: 'Email Verification Not Enabled',
39433943
emailTabDisabledHint: 'Enable email verification in the Security tab to configure SMTP settings.',

frontend/src/i18n/locales/zh.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,6 @@ export default {
340340
redeemCodes: '兑换码',
341341
ops: '运维监控',
342342
promoCodes: '优惠码',
343-
backup: '数据库备份',
344-
dataManagement: '数据管理',
345343
settings: '系统设置',
346344
myAccount: '我的账户',
347345
lightMode: '浅色模式',
@@ -4112,6 +4110,8 @@ export default {
41124110
users: '用户默认值',
41134111
gateway: '网关服务',
41144112
email: '邮件设置',
4113+
backup: '数据备份',
4114+
data: 'Sora 存储',
41154115
},
41164116
emailTabDisabledTitle: '邮箱验证未启用',
41174117
emailTabDisabledHint: '请在「安全与认证」选项卡中启用邮箱验证后,再配置 SMTP 设置。',

frontend/src/router/index.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -350,30 +350,6 @@ const routes: RouteRecordRaw[] = [
350350
descriptionKey: 'admin.promo.description'
351351
}
352352
},
353-
{
354-
path: '/admin/backup',
355-
name: 'AdminBackup',
356-
component: () => import('@/views/admin/BackupView.vue'),
357-
meta: {
358-
requiresAuth: true,
359-
requiresAdmin: true,
360-
title: 'Database Backup',
361-
titleKey: 'admin.backup.title',
362-
descriptionKey: 'admin.backup.description'
363-
}
364-
},
365-
{
366-
path: '/admin/data-management',
367-
name: 'AdminDataManagement',
368-
component: () => import('@/views/admin/DataManagementView.vue'),
369-
meta: {
370-
requiresAuth: true,
371-
requiresAdmin: true,
372-
title: 'Data Management',
373-
titleKey: 'admin.dataManagement.title',
374-
descriptionKey: 'admin.dataManagement.description'
375-
}
376-
},
377353
{
378354
path: '/admin/settings',
379355
name: 'AdminSettings',

frontend/src/views/admin/BackupView.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<template>
2-
<AppLayout>
32
<div class="space-y-6">
43
<!-- S3 Storage Config -->
54
<div class="card p-6">
@@ -275,13 +274,11 @@
275274
</div>
276275
</transition>
277276
</teleport>
278-
</AppLayout>
279277
</template>
280278

281279
<script setup lang="ts">
282280
import { computed, onMounted, ref } from 'vue'
283281
import { useI18n } from 'vue-i18n'
284-
import AppLayout from '@/components/layout/AppLayout.vue'
285282
import { adminAPI } from '@/api'
286283
import { useAppStore } from '@/stores'
287284
import type { BackupS3Config, BackupScheduleConfig, BackupRecord } from '@/api/admin/backup'

frontend/src/views/admin/DataManagementView.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<template>
2-
<AppLayout>
32
<div class="space-y-6">
43
<div class="card p-6">
54
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
@@ -183,13 +182,11 @@
183182
</div>
184183
</Transition>
185184
</Teleport>
186-
</AppLayout>
187185
</template>
188186

189187
<script setup lang="ts">
190188
import { onMounted, ref } from 'vue'
191189
import { useI18n } from 'vue-i18n'
192-
import AppLayout from '@/components/layout/AppLayout.vue'
193190
import type { SoraS3Profile } from '@/api/admin/settings'
194191
import { adminAPI } from '@/api'
195192
import { useAppStore } from '@/stores'

frontend/src/views/admin/SettingsView.vue

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<!-- Settings Form -->
1010
<form v-else @submit.prevent="saveSettings" class="space-y-6">
1111
<!-- Tab Navigation -->
12-
<div class="sticky top-0 z-10 overflow-x-auto scrollbar-hide">
12+
<div class="sticky top-0 z-10 overflow-x-auto settings-tabs-scroll">
1313
<nav class="settings-tabs">
1414
<button
1515
v-for="tab in settingsTabs"
@@ -1649,8 +1649,18 @@
16491649
</div>
16501650
</div><!-- /Tab: Email -->
16511651

1652+
<!-- Tab: Backup -->
1653+
<div v-show="activeTab === 'backup'">
1654+
<BackupSettings />
1655+
</div>
1656+
1657+
<!-- Tab: Data Management -->
1658+
<div v-show="activeTab === 'data'">
1659+
<DataManagementSettings />
1660+
</div>
1661+
16521662
<!-- Save Button -->
1653-
<div class="flex justify-end">
1663+
<div v-show="activeTab !== 'backup' && activeTab !== 'data'" class="flex justify-end">
16541664
<button type="submit" :disabled="saving" class="btn btn-primary">
16551665
<svg v-if="saving" class="h-4 w-4 animate-spin" fill="none" viewBox="0 0 24 24">
16561666
<circle
@@ -1692,6 +1702,8 @@ import GroupBadge from '@/components/common/GroupBadge.vue'
16921702
import GroupOptionItem from '@/components/common/GroupOptionItem.vue'
16931703
import Toggle from '@/components/common/Toggle.vue'
16941704
import ImageUpload from '@/components/common/ImageUpload.vue'
1705+
import BackupSettings from '@/views/admin/BackupView.vue'
1706+
import DataManagementSettings from '@/views/admin/DataManagementView.vue'
16951707
import { useClipboard } from '@/composables/useClipboard'
16961708
import { useAppStore } from '@/stores'
16971709
import { useAdminSettingsStore } from '@/stores/adminSettings'
@@ -1706,14 +1718,16 @@ const { t } = useI18n()
17061718
const appStore = useAppStore()
17071719
const adminSettingsStore = useAdminSettingsStore()
17081720
1709-
type SettingsTab = 'general' | 'security' | 'users' | 'gateway' | 'email'
1721+
type SettingsTab = 'general' | 'security' | 'users' | 'gateway' | 'email' | 'backup' | 'data'
17101722
const activeTab = ref<SettingsTab>('general')
17111723
const settingsTabs = [
17121724
{ key: 'general' as SettingsTab, icon: 'home' as const },
17131725
{ key: 'security' as SettingsTab, icon: 'shield' as const },
17141726
{ key: 'users' as SettingsTab, icon: 'user' as const },
17151727
{ key: 'gateway' as SettingsTab, icon: 'server' as const },
17161728
{ key: 'email' as SettingsTab, icon: 'mail' as const },
1729+
{ key: 'backup' as SettingsTab, icon: 'database' as const },
1730+
{ key: 'data' as SettingsTab, icon: 'cube' as const },
17171731
]
17181732
const { copyToClipboard } = useClipboard()
17191733
@@ -2378,9 +2392,38 @@ onMounted(() => {
23782392
}
23792393
23802394
/* ============ Settings Tab Navigation ============ */
2395+
2396+
/* Scroll container: thin scrollbar on PC, auto-hide on mobile */
2397+
.settings-tabs-scroll {
2398+
scrollbar-width: thin;
2399+
scrollbar-color: transparent transparent;
2400+
}
2401+
.settings-tabs-scroll:hover {
2402+
scrollbar-color: rgb(0 0 0 / 0.15) transparent;
2403+
}
2404+
:root.dark .settings-tabs-scroll:hover {
2405+
scrollbar-color: rgb(255 255 255 / 0.2) transparent;
2406+
}
2407+
.settings-tabs-scroll::-webkit-scrollbar {
2408+
height: 3px;
2409+
}
2410+
.settings-tabs-scroll::-webkit-scrollbar-track {
2411+
background: transparent;
2412+
}
2413+
.settings-tabs-scroll::-webkit-scrollbar-thumb {
2414+
background: transparent;
2415+
border-radius: 3px;
2416+
}
2417+
.settings-tabs-scroll:hover::-webkit-scrollbar-thumb {
2418+
background: rgb(0 0 0 / 0.15);
2419+
}
2420+
:root.dark .settings-tabs-scroll:hover::-webkit-scrollbar-thumb {
2421+
background: rgb(255 255 255 / 0.2);
2422+
}
2423+
23812424
.settings-tabs {
2382-
@apply inline-flex min-w-full gap-1 rounded-2xl
2383-
border border-gray-100 bg-white/80 p-1.5 backdrop-blur-sm
2425+
@apply inline-flex min-w-full gap-0.5 rounded-2xl
2426+
border border-gray-100 bg-white/80 p-1 backdrop-blur-sm
23842427
dark:border-dark-700/50 dark:bg-dark-800/80;
23852428
box-shadow: 0 1px 3px rgb(0 0 0 / 0.04), 0 1px 2px rgb(0 0 0 / 0.02);
23862429
}
@@ -2392,8 +2435,8 @@ onMounted(() => {
23922435
}
23932436
23942437
.settings-tab {
2395-
@apply relative flex flex-1 items-center justify-center gap-2
2396-
whitespace-nowrap rounded-xl px-4 py-2.5
2438+
@apply relative flex flex-1 items-center justify-center gap-1.5
2439+
whitespace-nowrap rounded-xl px-2.5 py-2
23972440
text-sm font-medium
23982441
text-gray-500 dark:text-dark-400
23992442
transition-all duration-200 ease-out;
@@ -2420,7 +2463,7 @@ onMounted(() => {
24202463
}
24212464
24222465
.settings-tab-icon {
2423-
@apply flex h-7 w-7 items-center justify-center rounded-lg
2466+
@apply flex h-6 w-6 items-center justify-center rounded-lg
24242467
transition-all duration-200;
24252468
}
24262469

0 commit comments

Comments
 (0)