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:
@@ -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.',
|
||||||
|
|||||||
@@ -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 자격 증명을 설정합니다. 자격 증명은 모델 서비스와 문서 파싱 엔진에 사용됩니다.',
|
||||||
|
|||||||
@@ -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. Данные используются для модельных сервисов и движка парсинга документов.',
|
||||||
|
|||||||
@@ -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 凭证。凭证用于模型服务和文档解析引擎。",
|
||||||
|
|||||||
@@ -17,69 +17,72 @@
|
|||||||
<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
|
<div class="nav-group-title">{{ group.label }}</div>
|
||||||
:class="['nav-item', {
|
<template v-for="item in group.items" :key="item.key">
|
||||||
'active': currentSection === item.key,
|
|
||||||
'has-submenu': item.children && item.children.length > 0,
|
|
||||||
'expanded': expandedMenus.includes(item.key)
|
|
||||||
}]"
|
|
||||||
@click="handleNavClick(item)"
|
|
||||||
>
|
|
||||||
<!-- 网络搜索使用自定义 SVG 图标 -->
|
|
||||||
<svg
|
|
||||||
v-if="item.key === 'websearch'"
|
|
||||||
width="18"
|
|
||||||
height="18"
|
|
||||||
viewBox="0 0 18 18"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="nav-icon"
|
|
||||||
>
|
|
||||||
<circle cx="9" cy="9" r="7" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
|
||||||
<path d="M 9 2 A 3.5 7 0 0 0 9 16" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
|
||||||
<path d="M 9 2 A 3.5 7 0 0 1 9 16" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
|
||||||
<line x1="2.94" y1="5.5" x2="15.06" y2="5.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
||||||
<line x1="2.94" y1="12.5" x2="15.06" y2="12.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
||||||
</svg>
|
|
||||||
<!-- WeKnora Cloud 使用自定义 W 图标 -->
|
|
||||||
<svg
|
|
||||||
v-else-if="item.key === 'weknoracloud'"
|
|
||||||
width="18"
|
|
||||||
height="18"
|
|
||||||
viewBox="0 0 18 18"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="nav-icon"
|
|
||||||
>
|
|
||||||
<rect x="1.5" y="1.5" width="15" height="15" rx="3.5" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
|
||||||
<path d="M4.5 5.5L6.5 12.5L9 7.5L11.5 12.5L13.5 5.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
|
|
||||||
</svg>
|
|
||||||
<t-icon v-else :name="item.icon" class="nav-icon" />
|
|
||||||
<span class="nav-label">{{ item.label }}</span>
|
|
||||||
<t-icon
|
|
||||||
v-if="item.children && item.children.length > 0"
|
|
||||||
:name="expandedMenus.includes(item.key) ? 'chevron-down' : 'chevron-right'"
|
|
||||||
class="expand-icon"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 子菜单 -->
|
|
||||||
<Transition name="submenu">
|
|
||||||
<div
|
<div
|
||||||
v-if="item.children && expandedMenus.includes(item.key)"
|
:class="['nav-item', {
|
||||||
class="submenu"
|
'active': currentSection === item.key,
|
||||||
|
'has-submenu': item.children && item.children.length > 0,
|
||||||
|
'expanded': expandedMenus.includes(item.key)
|
||||||
|
}]"
|
||||||
|
@click="handleNavClick(item)"
|
||||||
>
|
>
|
||||||
<div
|
<!-- 网络搜索使用自定义 SVG 图标 -->
|
||||||
v-for="(child, childIndex) in item.children"
|
<svg
|
||||||
:key="childIndex"
|
v-if="item.key === 'websearch'"
|
||||||
:class="['submenu-item', { 'active': currentSubSection === child.key }]"
|
width="18"
|
||||||
@click.stop="handleSubMenuClick(item.key, child.key)"
|
height="18"
|
||||||
|
viewBox="0 0 18 18"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="nav-icon"
|
||||||
>
|
>
|
||||||
<span class="submenu-label">{{ child.label }}</span>
|
<circle cx="9" cy="9" r="7" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
||||||
</div>
|
<path d="M 9 2 A 3.5 7 0 0 0 9 16" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
||||||
|
<path d="M 9 2 A 3.5 7 0 0 1 9 16" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
||||||
|
<line x1="2.94" y1="5.5" x2="15.06" y2="5.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
||||||
|
<line x1="2.94" y1="12.5" x2="15.06" y2="12.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
||||||
|
</svg>
|
||||||
|
<!-- WeKnora Cloud 使用自定义 W 图标 -->
|
||||||
|
<svg
|
||||||
|
v-else-if="item.key === 'weknoracloud'"
|
||||||
|
width="18"
|
||||||
|
height="18"
|
||||||
|
viewBox="0 0 18 18"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="nav-icon"
|
||||||
|
>
|
||||||
|
<rect x="1.5" y="1.5" width="15" height="15" rx="3.5" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
||||||
|
<path d="M4.5 5.5L6.5 12.5L9 7.5L11.5 12.5L13.5 5.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
|
||||||
|
</svg>
|
||||||
|
<t-icon v-else :name="item.icon" class="nav-icon" />
|
||||||
|
<span class="nav-label">{{ item.label }}</span>
|
||||||
|
<t-icon
|
||||||
|
v-if="item.children && item.children.length > 0"
|
||||||
|
:name="expandedMenus.includes(item.key) ? 'chevron-down' : 'chevron-right'"
|
||||||
|
class="expand-icon"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Transition>
|
|
||||||
|
<!-- 子菜单 -->
|
||||||
|
<Transition name="submenu">
|
||||||
|
<div
|
||||||
|
v-if="item.children && expandedMenus.includes(item.key)"
|
||||||
|
class="submenu"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-for="(child, childIndex) in item.children"
|
||||||
|
:key="childIndex"
|
||||||
|
:class="['submenu-item', { 'active': currentSubSection === child.key }]"
|
||||||
|
@click.stop="handleSubMenuClick(item.key, child.key)"
|
||||||
|
>
|
||||||
|
<span class="submenu-label">{{ child.label }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -196,23 +199,26 @@ const currentSection = ref<string>('general')
|
|||||||
const currentSubSection = ref<string>('')
|
const currentSubSection = ref<string>('')
|
||||||
const expandedMenus = ref<string[]>([])
|
const expandedMenus = ref<string[]>([])
|
||||||
|
|
||||||
|
type NavItem = {
|
||||||
|
key: string
|
||||||
|
icon: string
|
||||||
|
label: string
|
||||||
|
children?: Array<{ key: string; label: string }>
|
||||||
|
}
|
||||||
|
|
||||||
|
type NavGroup = {
|
||||||
|
key: string
|
||||||
|
label: string
|
||||||
|
items: NavItem[]
|
||||||
|
}
|
||||||
|
|
||||||
const navItems = computed(() => {
|
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 = {
|
|
||||||
key: string
|
|
||||||
icon: string
|
|
||||||
label: string
|
|
||||||
children?: Array<{ key: string; label: string }>
|
|
||||||
}
|
|
||||||
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' },
|
||||||
{ key: 'weknoracloud', icon: '', label: 'WeKnora Cloud' },
|
{ key: 'weknoracloud', icon: '', label: 'WeKnora Cloud' },
|
||||||
{ key: 'models', icon: 'control-platform', label: t('settings.modelManagement') },
|
{ key: 'models', icon: 'control-platform', label: t('settings.modelManagement') },
|
||||||
{ key: 'websearch', icon: 'search', label: t('settings.webSearchConfig') },
|
{ key: 'websearch', icon: 'search', label: t('settings.webSearchConfig') },
|
||||||
{ key: 'chathistory', icon: 'chat', label: t('chatHistorySettings.title') },
|
{ key: 'chathistory', icon: 'chat', label: t('chatHistorySettings.title') },
|
||||||
{ key: 'vectorstore', icon: 'data-base', label: t('settings.vectorStoreEngine') },
|
{ key: 'vectorstore', icon: 'data-base', label: t('settings.vectorStoreEngine') },
|
||||||
{ key: 'parser', icon: 'file-search', label: t('settings.parserEngine') },
|
{ key: 'parser', icon: 'file-search', label: t('settings.parserEngine') },
|
||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user