diff --git a/frontend/src/components/app-layout/header/components/Breadcrumb.vue b/frontend/src/components/app-layout/header/components/Breadcrumb.vue index b35370b13..1708e96af 100644 --- a/frontend/src/components/app-layout/header/components/Breadcrumb.vue +++ b/frontend/src/components/app-layout/header/components/Breadcrumb.vue @@ -3,7 +3,7 @@ {{ $t('menu.home') }} - {{ item.meta?.title }} + {{ $t(item.meta?.title as string) }} diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index c3e64debc..04ed32873 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -13,18 +13,20 @@ export default { }, table: { name: 'Name', + group: 'Group', createdAt: 'Creation Time', + date: 'Date', updatedAt: 'Update Time', operate: 'Operations', - message: 'message', + message: 'Message', + description: 'Description', }, msg: { delete: 'This operation cannot be rolled back. Do you want to continue', - title: 'Delete', + deleteTitle: 'Delete', deleteSuccess: 'Delete Success', loginSuccess: 'Login Success', requestTimeout: 'The request timed out, please try again later', - deleteTitle: 'Delete', operationSuccess: 'Successful operation', infoTitle: 'Hint', sureLogOut: 'Are you sure you want to log out?', @@ -103,6 +105,7 @@ export default { quickCommand: 'quick command', groupDeleteHelper: 'After the group is removed, all connections in the group will be migrated to the default group. Confirm the information', + quickCmd: 'Quick command', addHost: 'Add Host', localhost: 'Localhost', name: 'Name', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 1cb875d2d..3ca0593b8 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -67,7 +67,6 @@ export default { terminal: '终端管理', operations: '操作记录', }, - home: { welcome: '欢迎使用', }, diff --git a/frontend/src/routers/modules/terminal.ts b/frontend/src/routers/modules/terminal.ts index 3042d10ba..525aed243 100644 --- a/frontend/src/routers/modules/terminal.ts +++ b/frontend/src/routers/modules/terminal.ts @@ -1,5 +1,4 @@ import { Layout } from '@/routers/constant'; -import i18n from '@/lang'; const terminalRouter = { sort: 2, @@ -7,7 +6,7 @@ const terminalRouter = { component: Layout, redirect: '/terminal', meta: { - title: i18n.global.t('menu.terminal'), + title: 'menu.terminal', icon: 'monitor', }, children: [ @@ -18,32 +17,8 @@ const terminalRouter = { meta: { requiresAuth: true, key: 'Terminal', - title: i18n.global.t('terminal.conn'), - icon: 'connection', - activeMenu: '/terminals', - }, - }, - { - path: '/terminals/host', - name: 'Host', - component: () => import('@/views/terminal/host/index.vue'), - meta: { - requiresAuth: true, - key: 'Host', - title: i18n.global.t('terminal.hostList'), - icon: 'platform', - activeMenu: '/terminals', - }, - }, - { - path: '/terminals/command', - name: 'Command', - component: () => import('@/views/terminal/command/index.vue'), - meta: { - requiresAuth: true, - key: 'Command', - title: i18n.global.t('terminal.quickCmd'), - icon: 'reading', + title: 'terminal.conn', + icon: 'Connection', activeMenu: '/terminals', }, }, diff --git a/frontend/src/views/terminal/command/index.vue b/frontend/src/views/terminal/command/index.vue index 28e50b10a..cef095287 100644 --- a/frontend/src/views/terminal/command/index.vue +++ b/frontend/src/views/terminal/command/index.vue @@ -1,5 +1,5 @@ - + {{ $t('commons.button.create') }} @@ -38,7 +38,7 @@ import ComplexTable from '@/components/complex-table/index.vue'; import { Command } from '@/api/interface/command'; import { addCommand, editCommand, deleteCommand, getCommandPage } from '@/api/modules/command'; -import { onMounted, reactive, ref } from '@vue/runtime-core'; +import { reactive, ref } from '@vue/runtime-core'; import { useDeleteData } from '@/hooks/use-delete-data'; import type { ElForm } from 'element-plus'; import { Rules } from '@/global/form-rues'; @@ -143,7 +143,10 @@ const search = async () => { paginationConfig.total = res.data.total; }; -onMounted(() => { +function onInit() { search(); +} +defineExpose({ + onInit, }); diff --git a/frontend/src/views/terminal/host/index.vue b/frontend/src/views/terminal/host/index.vue index f7cf52320..94bd04f7e 100644 --- a/frontend/src/views/terminal/host/index.vue +++ b/frontend/src/views/terminal/host/index.vue @@ -1,5 +1,5 @@ - + @@ -129,7 +129,7 @@ diff --git a/frontend/src/views/terminal/index.vue b/frontend/src/views/terminal/index.vue index aecb23343..01ffa78cf 100644 --- a/frontend/src/views/terminal/index.vue +++ b/frontend/src/views/terminal/index.vue @@ -1,110 +1,135 @@ - - + + - - - - - - - - {{ item.title }} - + + + - - - + - - - - - + + + + + + + + + {{ item.title }} + - - + + + + + + + + + + + + + + + + + + New ssh + New tab + + + + + + + + + {{ node.label }} + + + + + + + + + + + + - + - - - - New ssh - New tab - - - - - - - - - {{ node.label }} - - - - - + + + + + + + + + + + + - - - - @@ -154,16 +179,22 @@ import { Rules } from '@/global/form-rues'; import { testConn, getHostTree, addHost } from '@/api/modules/host'; import { getCommandList } from '@/api/modules/command'; import i18n from '@/lang'; -import type { ElForm } from 'element-plus'; +import { ElForm } from 'element-plus'; import { Host } from '@/api/interface/host'; import { ElMessage } from 'element-plus'; import Terminal from '@/views/terminal/terminal/index.vue'; +import HostTab from '@/views/terminal/host/index.vue'; +import CommandTab from '@/views/terminal/command/index.vue'; import type Node from 'element-plus/es/components/tree/src/model/node'; import { ElTree } from 'element-plus'; import screenfull from 'screenfull'; let timer: NodeJS.Timer | null = null; +const routeTab = ref('terminal'); +const hostTabRef = ref(); +const commandTabRef = ref(); + const terminalValue = ref(); const terminalTabs = ref([]) as any; let tabIndex = 0; @@ -219,6 +250,18 @@ function toggleFullscreen() { screenfull.toggle(); } } +const handleClick = (tab: any) => { + if (tab.paneName === 'host') { + if (ctx) { + ctx.refs[`hostTabRef`] && ctx.refs[`hostTabRef`].onInit(); + } + } + if (tab.paneName === 'command') { + if (ctx) { + ctx.refs[`commandTabRef`] && ctx.refs[`commandTabRef`].onInit(); + } + } +}; const handleTabsRemove = (targetName: string, action: 'remove' | 'add') => { if (action !== 'remove') { @@ -417,7 +460,7 @@ onBeforeMount(() => { .fullScreen { position: absolute; right: 50px; - top: 85px; + top: 6px; font-weight: 600; font-size: 14px; }