This is an automated email from the ASF dual-hosted git repository. songjian pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel-web.git
The following commit(s) were added to refs/heads/main by this push: new c1c0f862 [Feat][UI] Adjust menu structure. (#25) c1c0f862 is described below commit c1c0f862bb5bb4b61a7c1b43781c92ba166c193c Author: tungl <1778651...@qq.com> AuthorDate: Mon Feb 20 21:36:40 2023 +0800 [Feat][UI] Adjust menu structure. (#25) --- .../src/layouts/dashboard/header/index.tsx | 6 +-- .../src/layouts/dashboard/header/menu/use-menu.ts | 4 ++ .../src/layouts/dashboard/header/setting/index.tsx | 51 --------------------- .../header/setting/use-setting-dropdown.ts | 52 ---------------------- 4 files changed, 5 insertions(+), 108 deletions(-) diff --git a/seatunnel-ui/src/layouts/dashboard/header/index.tsx b/seatunnel-ui/src/layouts/dashboard/header/index.tsx index f732f542..2d326586 100644 --- a/seatunnel-ui/src/layouts/dashboard/header/index.tsx +++ b/seatunnel-ui/src/layouts/dashboard/header/index.tsx @@ -19,7 +19,6 @@ import { defineComponent } from 'vue' import { NSpace } from 'naive-ui' import Logo from './logo' import Menu from './menu' -import Setting from './setting' import User from './user' const Header = defineComponent({ @@ -31,10 +30,7 @@ const Header = defineComponent({ <Logo /> <Menu /> </NSpace> - <NSpace> - <Setting /> - <User /> - </NSpace> + <User /> </NSpace> ) } diff --git a/seatunnel-ui/src/layouts/dashboard/header/menu/use-menu.ts b/seatunnel-ui/src/layouts/dashboard/header/menu/use-menu.ts index f3dae99d..aa599ad6 100644 --- a/seatunnel-ui/src/layouts/dashboard/header/menu/use-menu.ts +++ b/seatunnel-ui/src/layouts/dashboard/header/menu/use-menu.ts @@ -34,6 +34,10 @@ export function useMenu() { { label: () => h(NEllipsis, null, { default: () => t('menu.tasks') }), key: 'tasks' + }, + { + label: () => h(NEllipsis, null, { default: () => t('menu.user_manage') }), + key: 'user-manage' } ] diff --git a/seatunnel-ui/src/layouts/dashboard/header/setting/index.tsx b/seatunnel-ui/src/layouts/dashboard/header/setting/index.tsx deleted file mode 100644 index 291740da..00000000 --- a/seatunnel-ui/src/layouts/dashboard/header/setting/index.tsx +++ /dev/null @@ -1,51 +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. - */ - -import { defineComponent, toRefs } from 'vue' -import { NIcon, NSpace, NDropdown } from 'naive-ui' -import { SettingOutlined } from '@vicons/antd' -import { useSettingDropdown } from './use-setting-dropdown' - -const Setting = defineComponent({ - setup() { - const { state, handleSelect } = useSettingDropdown() - - return { ...toRefs(state), handleSelect } - }, - render() { - return ( - <NSpace - align='center' - justify='center' - class='h-16 w-12' - style={{ cursor: 'pointer' }} - > - <NDropdown - trigger='click' - options={this.dropdownOptions} - onSelect={this.handleSelect} - > - <NIcon size='20'> - <SettingOutlined /> - </NIcon> - </NDropdown> - </NSpace> - ) - } -}) - -export default Setting diff --git a/seatunnel-ui/src/layouts/dashboard/header/setting/use-setting-dropdown.ts b/seatunnel-ui/src/layouts/dashboard/header/setting/use-setting-dropdown.ts deleted file mode 100644 index 157f04c5..00000000 --- a/seatunnel-ui/src/layouts/dashboard/header/setting/use-setting-dropdown.ts +++ /dev/null @@ -1,52 +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. - */ - -import { useI18n } from 'vue-i18n' -import { reactive, h } from 'vue' -import { useRouter } from 'vue-router' -import type { Router } from 'vue-router' - -export function useSettingDropdown() { - const { t } = useI18n() - const router: Router = useRouter() - - const dropdownOptions = [ - { - key: 'header', - type: 'render', - render: () => - h('h3', { class: ['py-1.5', 'px-3', 'font-medium'] }, t('menu.manage')) - }, - { - key: 'header-divider', - type: 'divider' - }, - { key: 'user-manage', label: t('menu.user_manage') } - ] - - const state = reactive({ - dropdownOptions - }) - - const handleSelect = (key: string) => { - if (key === 'user-manage') { - router.push({ path: '/user-manage' }) - } - } - - return { state, handleSelect } -}