[Feature][UI] Revamped interface settings options in the top navigation bar. (#12530)
This commit is contained in:
parent
3030419ee1
commit
cb70e89ded
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.container {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
height: 64px;
|
|
||||||
border-bottom: 1px solid var(--n-border-color);
|
|
||||||
|
|
||||||
.nav {
|
|
||||||
margin-left: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -17,8 +17,9 @@
|
||||||
|
|
||||||
import { defineComponent, PropType, ref, watch } from 'vue'
|
import { defineComponent, PropType, ref, watch } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import styles from './index.module.scss'
|
import { SettingOutlined } from '@vicons/antd'
|
||||||
import { NMenu } from 'naive-ui'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { NMenu, NSpace, NButton, NIcon } from 'naive-ui'
|
||||||
import Logo from '../logo'
|
import Logo from '../logo'
|
||||||
import Locales from '../locales'
|
import Locales from '../locales'
|
||||||
import Timezone from '../timezone'
|
import Timezone from '../timezone'
|
||||||
|
|
@ -48,13 +49,17 @@ const Navbar = defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const { t } = useI18n()
|
||||||
const menuKey = ref(route.meta.activeMenu as string)
|
const menuKey = ref(route.meta.activeMenu as string)
|
||||||
|
|
||||||
const handleMenuClick = (key: string) => {
|
const handleMenuClick = (key: string) => {
|
||||||
router.push({ path: `/${key}` })
|
router.push({ path: `/${key}` })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleUISettingClick = () => {
|
||||||
|
router.push({ path: '/ui-setting' })
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => route.path,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -62,27 +67,37 @@ const Navbar = defineComponent({
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return { handleMenuClick, menuKey }
|
return { handleMenuClick, handleUISettingClick, menuKey, t }
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div class={styles.container}>
|
<NSpace style='height: 65px' justify='space-between' align='center'>
|
||||||
<Logo />
|
<NSpace align='center'>
|
||||||
<div class={styles.nav}>
|
<NSpace>
|
||||||
<NMenu
|
<Logo />
|
||||||
value={this.menuKey}
|
<NMenu
|
||||||
mode='horizontal'
|
value={this.menuKey}
|
||||||
options={this.headerMenuOptions}
|
mode='horizontal'
|
||||||
onUpdateValue={this.handleMenuClick}
|
options={this.headerMenuOptions}
|
||||||
/>
|
onUpdateValue={this.handleMenuClick}
|
||||||
</div>
|
/>
|
||||||
<div class={styles.settings}>
|
</NSpace>
|
||||||
|
</NSpace>
|
||||||
|
<NSpace align='center'>
|
||||||
|
<NButton quaternary onClick={this.handleUISettingClick}>
|
||||||
|
{{
|
||||||
|
icon: () => <NIcon size='16'>
|
||||||
|
<SettingOutlined />
|
||||||
|
</NIcon>,
|
||||||
|
default: this.t('menu.ui_setting')
|
||||||
|
}}
|
||||||
|
</NButton>
|
||||||
<Theme />
|
<Theme />
|
||||||
<Locales localesOptions={this.localesOptions} />
|
<Locales localesOptions={this.localesOptions} />
|
||||||
<Timezone timezoneOptions={this.timezoneOptions} />
|
<Timezone timezoneOptions={this.timezoneOptions} />
|
||||||
<User userDropdownOptions={this.userDropdownOptions} />
|
<User userDropdownOptions={this.userDropdownOptions} />
|
||||||
</div>
|
</NSpace>
|
||||||
</div>
|
</NSpace>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -314,15 +314,7 @@ export function useDataList() {
|
||||||
icon: renderIcon(SafetyOutlined)
|
icon: renderIcon(SafetyOutlined)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
// add UI setting to the banner
|
|
||||||
{
|
|
||||||
label: () =>
|
|
||||||
h(NEllipsis, null, { default: () => t('menu.ui_setting') }),
|
|
||||||
key: 'ui-setting',
|
|
||||||
icon: renderIcon(SettingOutlined),
|
|
||||||
children: []
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,5 +57,5 @@ export default {
|
||||||
data_quality: 'Data Quality',
|
data_quality: 'Data Quality',
|
||||||
task_result: 'Task Result',
|
task_result: 'Task Result',
|
||||||
rule: 'Rule management',
|
rule: 'Rule management',
|
||||||
ui_setting: 'Setting',
|
ui_setting: 'UI Setting',
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue