refactor(settings): group sidebar nav items into labeled sections

The settings sidebar grew to 13 entries — flat scroll made related
settings (e.g. model + parser + storage) hard to find. Group them by
intent (basic / AI / data / workspace / system) with section titles
above each cluster, mirroring how popular SaaS settings pages are
organised. Behaviour and routing unchanged.
This commit is contained in:
wizardchen
2026-05-15 12:12:21 +08:00
committed by lyingbug
parent 0e1482bc4c
commit b0b7cfa351
5 changed files with 127 additions and 73 deletions
+7
View File
@@ -635,6 +635,13 @@ export default {
systemSettings: 'System Settings', systemSettings: 'System Settings',
tenantInfo: 'Tenant Info', tenantInfo: 'Tenant Info',
apiInfo: 'API Info', apiInfo: 'API Info',
navGroups: {
basic: 'Basic',
ai: 'AI Capabilities',
data: 'Data & Engines',
workspace: 'Workspace & Access',
system: 'System Info',
},
weknoraCloud: { weknoraCloud: {
title: 'WeKnora Cloud', title: 'WeKnora Cloud',
description: 'Configure WeKnora Cloud APPID and APPSECRET credentials. Credentials are used for model services and document parsing engine.', description: 'Configure WeKnora Cloud APPID and APPSECRET credentials. Credentials are used for model services and document parsing engine.',
+7
View File
@@ -511,6 +511,13 @@ export default {
systemSettings: "시스템 설정", systemSettings: "시스템 설정",
tenantInfo: "테넌트 정보", tenantInfo: "테넌트 정보",
apiInfo: "API 정보", apiInfo: "API 정보",
navGroups: {
basic: "기본",
ai: "AI 기능",
data: "데이터 및 엔진",
workspace: "공간 및 권한",
system: "시스템 정보",
},
weknoraCloud: { weknoraCloud: {
title: 'WeKnora Cloud', title: 'WeKnora Cloud',
description: 'WeKnora Cloud APPID 및 APPSECRET 자격 증명을 설정합니다. 자격 증명은 모델 서비스와 문서 파싱 엔진에 사용됩니다.', description: 'WeKnora Cloud APPID 및 APPSECRET 자격 증명을 설정합니다. 자격 증명은 모델 서비스와 문서 파싱 엔진에 사용됩니다.',
+7
View File
@@ -620,6 +620,13 @@ export default {
systemSettings: 'Настройки системы', systemSettings: 'Настройки системы',
tenantInfo: 'Информация о арендаторе', tenantInfo: 'Информация о арендаторе',
apiInfo: 'Информация API', apiInfo: 'Информация API',
navGroups: {
basic: 'Основное',
ai: 'AI-возможности',
data: 'Данные и движки',
workspace: 'Пространство и доступ',
system: 'Сведения о системе',
},
weknoraCloud: { weknoraCloud: {
title: 'WeKnora Cloud', title: 'WeKnora Cloud',
description: 'Настройте учётные данные APPID и APPSECRET для WeKnora Cloud. Данные используются для модельных сервисов и движка парсинга документов.', description: 'Настройте учётные данные APPID и APPSECRET для WeKnora Cloud. Данные используются для модельных сервисов и движка парсинга документов.',
+7
View File
@@ -508,6 +508,13 @@ export default {
systemSettings: "系统设置", systemSettings: "系统设置",
tenantInfo: "租户信息", tenantInfo: "租户信息",
apiInfo: "API信息", apiInfo: "API信息",
navGroups: {
basic: "基础",
ai: "AI 能力",
data: "数据与引擎",
workspace: "空间与权限",
system: "系统信息",
},
weknoraCloud: { weknoraCloud: {
title: "WeKnora Cloud", title: "WeKnora Cloud",
description: "配置 WeKnora Cloud 的 APPID 和 APPSECRET 凭证。凭证用于模型服务和文档解析引擎。", description: "配置 WeKnora Cloud 的 APPID 和 APPSECRET 凭证。凭证用于模型服务和文档解析引擎。",
+35 -9
View File
@@ -17,7 +17,9 @@
<h2 class="sidebar-title">{{ $t('general.settings') }}</h2> <h2 class="sidebar-title">{{ $t('general.settings') }}</h2>
</div> </div>
<div class="settings-nav"> <div class="settings-nav">
<template v-for="(item, index) in navItems" :key="index"> <template v-for="group in navGroups" :key="group.key">
<div class="nav-group-title">{{ group.label }}</div>
<template v-for="item in group.items" :key="item.key">
<div <div
:class="['nav-item', { :class="['nav-item', {
'active': currentSection === item.key, 'active': currentSection === item.key,
@@ -81,6 +83,7 @@
</div> </div>
</Transition> </Transition>
</template> </template>
</template>
</div> </div>
</div> </div>
@@ -196,17 +199,20 @@ const currentSection = ref<string>('general')
const currentSubSection = ref<string>('') const currentSubSection = ref<string>('')
const expandedMenus = ref<string[]>([]) const expandedMenus = ref<string[]>([])
const navItems = computed(() => {
// Optional `children` keeps the existing template's submenu plumbing
// happy (it iterates `item.children`); none of the current tabs use
// it, but staying compatible avoids introducing a new typing-only
// diff scattered across the template.
type NavItem = { type NavItem = {
key: string key: string
icon: string icon: string
label: string label: string
children?: Array<{ key: string; label: string }> children?: Array<{ key: string; label: string }>
} }
type NavGroup = {
key: string
label: string
items: NavItem[]
}
const navItems = computed(() => {
const items: NavItem[] = [ const items: NavItem[] = [
{ key: 'general', icon: 'setting', label: t('general.title') }, { key: 'general', icon: 'setting', label: t('general.title') },
{ key: 'ollama', icon: 'server', label: 'Ollama' }, { key: 'ollama', icon: 'server', label: 'Ollama' },
@@ -232,6 +238,18 @@ const navItems = computed(() => {
return items return items
}) })
const navGroups = computed<NavGroup[]>(() => {
const itemMap = new Map(navItems.value.map((item) => [item.key, item]))
const pickItems = (keys: string[]) => keys.map((key) => itemMap.get(key)).filter(Boolean) as NavItem[]
return [
{ key: 'basic', label: t('settings.navGroups.basic'), items: pickItems(['general']) },
{ key: 'ai', label: t('settings.navGroups.ai'), items: pickItems(['models', 'ollama', 'weknoracloud', 'websearch', 'mcp']) },
{ key: 'data', label: t('settings.navGroups.data'), items: pickItems(['vectorstore', 'parser', 'storage']) },
{ key: 'workspace', label: t('settings.navGroups.workspace'), items: pickItems(['tenant', 'members']) },
{ key: 'system', label: t('settings.navGroups.system'), items: pickItems(['chathistory', 'system', 'api']) },
].filter((group) => group.items.length > 0)
})
// 导航项点击处理 // 导航项点击处理
const handleNavClick = (item: any) => { const handleNavClick = (item: any) => {
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
@@ -421,15 +439,23 @@ onUnmounted(() => {
} }
.settings-nav { .settings-nav {
padding: 16px 8px; padding: 12px 8px 16px;
flex: 1; flex: 1;
} }
.nav-group-title {
padding: 12px 16px 6px;
color: var(--td-text-color-placeholder);
font-size: 12px;
font-weight: 600;
letter-spacing: 0.02em;
}
.nav-item { .nav-item {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 10px 16px; padding: 8px 16px;
margin-bottom: 4px; margin-bottom: 2px;
border-radius: 6px; border-radius: 6px;
cursor: pointer; cursor: pointer;
color: var(--td-text-color-secondary); color: var(--td-text-color-secondary);