🚧 业务重命名.

This commit is contained in:
lijiahang
2024-02-05 17:07:38 +08:00
parent 6507119c68
commit 11b28e6a63
10 changed files with 180 additions and 70 deletions

View File

@@ -1,7 +1,7 @@
// 亮色主题配色常量 // 亮色主题配色常量
body { body {
--color-bg-header: #232323; --color-bg-header: #232323;
--color-bg-sidebar: #EBECED; --color-bg-sidebar: #E3E3E3;
--color-bg-panel: var(--color-bg-sidebar); --color-bg-panel: var(--color-bg-sidebar);
--color-bg-content: #FEFEFE; --color-bg-content: #FEFEFE;
--color-sidebar-icon: #737070; --color-sidebar-icon: #737070;

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="terminal-setting-container"> <div class="terminal-setting-container recommend-container">
<div class="terminal-setting-wrapper"> <div class="terminal-setting-wrapper">
<!-- 组合容器 --> <!-- 组合容器 -->
<div class="combined-container"> <div class="combined-container">
@@ -12,7 +12,7 @@
<component :is="handler.icon" /> <component :is="handler.icon" />
</div> </div>
<!-- 内容 --> <!-- 内容 -->
<div class="combined-handler-text"> <div class="combined-handler-text" :title="handler.title">
{{ handler.title }} {{ handler.title }}
</div> </div>
</div> </div>
@@ -141,9 +141,13 @@
@icon-size: @handler-height; @icon-size: @handler-height;
@actions-width: 80px; @actions-width: 80px;
.recommend-container {
overflow: hidden;
}
.combined-container { .combined-container {
padding: 12px; padding: 12px;
margin: 64px auto; margin: 64px auto 0 auto;
width: @container-width; width: @container-width;
height: @container-height; height: @container-height;
display: flex; display: flex;
@@ -193,17 +197,16 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 16px; font-size: 18px;
} }
&-text { &-text {
height: 100%; height: 100%;
width: calc(100% - @icon-size - 12px); width: calc(100% - @icon-size - 12px);
display: flex;
align-items: center;
font-size: 12px; font-size: 12px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis;
} }
&-actions { &-actions {

View File

@@ -8,7 +8,9 @@
content-class="terminal-tooltip-content" content-class="terminal-tooltip-content"
:auto-fix-position="false" :auto-fix-position="false"
:content="action.content"> :content="action.content">
<div class="terminal-sidebar-icon-wrapper" v-if="action.visible !== false"> <div v-if="action.visible !== false"
class="terminal-sidebar-icon-wrapper"
:class="[wrapperClass]">
<div class="terminal-sidebar-icon" <div class="terminal-sidebar-icon"
:class="[ :class="[
iconClass, iconClass,
@@ -36,6 +38,7 @@
defineProps({ defineProps({
actions: Array as PropType<Array<SidebarAction>>, actions: Array as PropType<Array<SidebarAction>>,
position: String, position: String,
wrapperClass: String,
iconClass: String, iconClass: String,
}); });

View File

@@ -28,8 +28,10 @@
{{ tab.title }} {{ tab.title }}
</span> </span>
</template> </template>
<!-- 终端 --> <!-- ssh -->
<terminal-view :tab="tab" /> <ssh-view v-if="tab.type === PanelSessionType.SSH.type" :tab="tab" />
<!-- sftp -->
<sftp-view v-if="tab.type === PanelSessionType.SFTP.type" :tab="tab" />
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
@@ -46,7 +48,8 @@
import { watch } from 'vue'; import { watch } from 'vue';
import { useTerminalStore } from '@/store'; import { useTerminalStore } from '@/store';
import { PanelSessionType } from '../../types/terminal.const'; import { PanelSessionType } from '../../types/terminal.const';
import TerminalView from '../xterm/terminal-view.vue'; import SshView from '../ssh/ssh-view.vue';
import SftpView from '../sftp/sftp-view.vue';
const props = defineProps<{ const props = defineProps<{
index: number, index: number,

View File

@@ -1,7 +1,8 @@
<template> <template>
<a-modal v-model:visible="visible" <a-modal v-model:visible="visible"
title-align="start" title-align="start"
:top="128" :top="136"
:width="520"
:align-center="false" :align-center="false"
:draggable="true" :draggable="true"
:unmount-on-close="true" :unmount-on-close="true"
@@ -20,20 +21,50 @@
<a-list class="host-list" <a-list class="host-list"
max-height="50vh" max-height="50vh"
:hoverable="true" :hoverable="true"
:split="false"
:bordered="false" :bordered="false"
:data="hostList"> :data="hostList">
<template #item="{ item }"> <template #item="{ item }">
<a-list-item class="host-item-wrapper" @click="clickHost(item)"> <a-list-item class="host-item-wrapper">
<div class="host-item"> <div class="host-item">
<!-- 图标 --> <!-- 左侧 -->
<span class="host-item-icon"> <div class="host-item-left">
<icon-desktop /> <!-- 图标 -->
</span> <span class="host-item-icon">
<!-- 名称 --> <icon-desktop />
<span class="host-item-name"> </span>
{{ `${item.alias || item.name} (${item.address})` }} <!-- 名称 -->
</span> <span class="host-item-name"
:title="`${item.alias || item.name} (${item.address})`">
{{ `${item.alias || item.name} (${item.address})` }}
</span>
</div>
<!-- 操作 -->
<div class="host-item-actions">
<!-- 打开 SSH -->
<a-tooltip position="top"
:mini="true"
:auto-fix-position="false"
content-class="terminal-tooltip-content"
arrow-class="terminal-tooltip-content"
content="打开 SSH">
<span class="click-icon-wrapper"
@click="clickHost(item, PanelSessionType.SSH)">
<icon-thunderbolt />
</span>
</a-tooltip>
<!-- 打开 SFTP -->
<a-tooltip position="top"
:mini="true"
:auto-fix-position="false"
content-class="terminal-tooltip-content"
arrow-class="terminal-tooltip-content"
content="打开 SFTP">
<span class="click-icon-wrapper"
@click="clickHost(item, PanelSessionType.SFTP)">
<icon-folder />
</span>
</a-tooltip>
</div>
</div> </div>
</a-list-item> </a-list-item>
</template> </template>
@@ -49,6 +80,7 @@
</script> </script>
<script lang="ts" setup> <script lang="ts" setup>
import type { PanelSessionTab } from '../../types/terminal.type';
import type { HostQueryResponse } from '@/api/asset/host'; import type { HostQueryResponse } from '@/api/asset/host';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useTerminalStore } from '@/store'; import { useTerminalStore } from '@/store';
@@ -97,14 +129,19 @@
defineExpose({ open }); defineExpose({ open });
// 打开终端 // 打开终端
const clickHost = (item: HostQueryResponse) => { const clickHost = (item: HostQueryResponse, tab: PanelSessionTab) => {
openSession(item, PanelSessionType.SSH, panelIndex.value); openSession(item, tab, panelIndex.value);
setVisible(false); setVisible(false);
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@modal-width: 520px;
@item-height: 54px;
@item-padding-y: 4px;
@item-padding-x: 12px;
.host-list-wrapper { .host-list-wrapper {
padding: 12px; padding: 12px;
} }
@@ -130,26 +167,66 @@
} }
.host-item-wrapper { .host-item-wrapper {
padding: 12px 16px !important; padding: @item-padding-y @item-padding-x !important;
border-radius: 4px; height: @item-height;
display: flex;
align-items: center;
&:hover { &:hover {
background: var(--color-fill-2); background: var(--color-fill-2);
border-radius: 4px;
.host-item-left {
width: @modal-width - 126px;
}
.host-item-actions {
display: flex;
}
} }
} }
.host-item { .host-item {
display: flex; display: flex;
align-items: center; align-items: center;
cursor: pointer; justify-content: space-between;
height: @item-height - @item-padding-y * 2;
&-left {
width: @modal-width - 48px;
display: flex;
align-items: center;
}
&-icon { &-icon {
font-size: 20px; font-size: 20px;
margin-right: 12px; margin-right: 12px;
} }
&-text { &-name {
font-size: 14px; font-size: 14px;
overflow: hidden;
white-space: pre;
text-overflow: ellipsis;
}
&-actions {
display: none;
height: 100%;
align-items: center;
justify-content: flex-end;
.click-icon-wrapper {
font-size: 22px;
padding: 4px;
border-radius: 4px;
margin: 0 4px;
&:hover {
background: var(--color-neutral-4);
}
}
} }
} }
</style> </style>

View File

@@ -0,0 +1,24 @@
<template>
<div>
{{ tab }}
</div>
</template>
<script lang="ts">
export default {
name: 'sftpView'
};
</script>
<script lang="ts" setup>
import { TerminalTabItem } from '../../types/terminal.type';
const props = defineProps<{
tab: TerminalTabItem
}>();
</script>
<style lang="less" scoped>
</style>

View File

@@ -26,7 +26,7 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: 'terminalContextMenu' name: 'sshContextMenu'
}; };
</script> </script>

View File

@@ -53,7 +53,7 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: 'terminalSearchModal' name: 'sshSearchModal'
}; };
</script> </script>

View File

@@ -1,9 +1,9 @@
<template> <template>
<div class="terminal-container"> <div class="ssh-container">
<!-- 头部 --> <!-- 头部 -->
<div class="terminal-header"> <div class="ssh-header">
<!-- 左侧操作 --> <!-- 左侧操作 -->
<div class="terminal-header-left"> <div class="ssh-header-left">
<!-- 主机地址 --> <!-- 主机地址 -->
<span class="address-wrapper"> <span class="address-wrapper">
{{ tab.address }} {{ tab.address }}
@@ -13,7 +13,7 @@
</span> </span>
</div> </div>
<!-- 右侧操作 --> <!-- 右侧操作 -->
<div class="terminal-header-right"> <div class="ssh-header-right">
<!-- 命令输入框 --> <!-- 命令输入框 -->
<a-textarea class="command-input mr8" <a-textarea class="command-input mr8"
v-if="preference.actionBarSetting.commandInput !== false" v-if="preference.actionBarSetting.commandInput !== false"
@@ -23,7 +23,9 @@
allow-clear allow-clear
@keyup="writeCommandInput" /> @keyup="writeCommandInput" />
<!-- 操作按钮 --> <!-- 操作按钮 -->
<icon-actions class="terminal-header-right-action-bar" <icon-actions class="ssh-header-right-action-bar"
wrapper-class="ssh-header-icon-wrapper"
icon-class="ssh-header-icon"
:actions="rightActions" :actions="rightActions"
position="bottom" /> position="bottom" />
<!-- 连接状态 --> <!-- 连接状态 -->
@@ -34,19 +36,19 @@
</div> </div>
</div> </div>
<!-- 终端右键菜单 --> <!-- 终端右键菜单 -->
<terminal-context-menu :session="session" <ssh-context-menu :session="session"
@click="doTerminalHandle"> @click="doTerminalHandle">
<!-- 终端容器 --> <!-- 终端容器 -->
<div class="terminal-wrapper" <div class="ssh-wrapper"
:style="{ background: preference.theme.schema.background }"> :style="{ background: preference.theme.schema.background }">
<!-- 终端实例 --> <!-- 终端实例 -->
<div class="terminal-inst" ref="terminalRef" /> <div class="ssh-inst" ref="terminalRef" />
<!-- 搜索模态框 --> <!-- 搜索模态框 -->
<terminal-search-modal ref="searchModal" <ssh-search-modal ref="searchModal"
@find="findWords" @find="findWords"
@close="focus" /> @close="focus" />
</div> </div>
</terminal-context-menu> </ssh-context-menu>
<!-- 命令编辑器 --> <!-- 命令编辑器 -->
<shell-editor-modal ref="editorModal" <shell-editor-modal ref="editorModal"
:closable="false" :closable="false"
@@ -60,7 +62,7 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: 'terminalView' name: 'sshView'
}; };
</script> </script>
@@ -72,8 +74,8 @@
import { ActionBarItems, connectStatusKey } from '../../types/terminal.const'; import { ActionBarItems, connectStatusKey } from '../../types/terminal.const';
import IconActions from '../layout/icon-actions.vue'; import IconActions from '../layout/icon-actions.vue';
import ShellEditorModal from '@/components/view/shell-editor/shell-editor-modal.vue'; import ShellEditorModal from '@/components/view/shell-editor/shell-editor-modal.vue';
import TerminalSearchModal from './terminal-search-modal.vue'; import SshSearchModal from './ssh-search-modal.vue';
import TerminalContextMenu from './terminal-context-menu.vue'; import SshContextMenu from './ssh-context-menu.vue';
const props = defineProps<{ const props = defineProps<{
tab: TerminalTabItem tab: TerminalTabItem
@@ -89,9 +91,6 @@
const terminalRef = ref(); const terminalRef = ref();
const session = ref<ITerminalSession>(); const session = ref<ITerminalSession>();
// TODO
// sftp
// //
const writeCommandInput = async (e: KeyboardEvent) => { const writeCommandInput = async (e: KeyboardEvent) => {
const value = commandInput.value; const value = commandInput.value;
@@ -154,18 +153,18 @@
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@terminal-header-height: 36px; @ssh-header-height: 36px;
.terminal-container { .ssh-container {
width: 100%; width: 100%;
height: calc(100vh - var(--header-height) - var(--panel-nav-height)); height: calc(100vh - var(--header-height) - var(--panel-nav-height));
position: relative; position: relative;
} }
.terminal-header { .ssh-header {
width: 100%; width: 100%;
height: @terminal-header-height; height: @ssh-header-height;
padding: 0 6px; padding: 0 8px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@@ -214,12 +213,13 @@
&-right-action-bar { &-right-action-bar {
display: flex; display: flex;
:deep(.terminal-sidebar-icon-wrapper) { :deep(.ssh-header-icon-wrapper) {
width: 30px; width: 28px;
height: 30px; height: 28px;
margin: 0 2px;
} }
:deep(.terminal-sidebar-icon) { :deep(.ssh-header-icon) {
width: 28px; width: 28px;
height: 28px; height: 28px;
font-size: 20px; font-size: 20px;
@@ -236,13 +236,13 @@
} }
} }
.terminal-wrapper { .ssh-wrapper {
width: 100%; width: 100%;
height: calc(100% - @terminal-header-height); height: calc(100% - @ssh-header-height);
position: relative; position: relative;
padding: 6px 0 0 6px; padding: 6px 0 0 6px;
.terminal-inst { .ssh-inst {
width: 100%; width: 100%;
height: 100%; height: 100%;

View File

@@ -186,23 +186,23 @@ export const TerminalShortcutItems: Array<ShortcutKeyItem> = [
}, { }, {
item: TerminalShortcutKeys.OPEN_NEW_CONNECT_MODAL, item: TerminalShortcutKeys.OPEN_NEW_CONNECT_MODAL,
content: '打开新建连接弹框', content: '打开新建连接弹框',
type: TerminalShortcutType.PANEL type: TerminalShortcutType.SESSION
}, { }, {
item: TerminalShortcutKeys.COPY_SESSION, item: TerminalShortcutKeys.COPY_SESSION,
content: '复制终端', content: '复制会话',
type: TerminalShortcutType.PANEL type: TerminalShortcutType.SESSION
}, { }, {
item: TerminalShortcutKeys.CLOSE_SESSION, item: TerminalShortcutKeys.CLOSE_SESSION,
content: '关闭终端', content: '关闭会话',
type: TerminalShortcutType.PANEL type: TerminalShortcutType.SESSION
}, { }, {
item: TerminalShortcutKeys.CHANGE_TO_PREV_SESSION, item: TerminalShortcutKeys.CHANGE_TO_PREV_SESSION,
content: '切换至前一个终端', content: '切换至前一个会话',
type: TerminalShortcutType.PANEL type: TerminalShortcutType.SESSION
}, { }, {
item: TerminalShortcutKeys.CHANGE_TO_NEXT_SESSION, item: TerminalShortcutKeys.CHANGE_TO_NEXT_SESSION,
content: '切换至后一个终端', content: '切换至后一个会话',
type: TerminalShortcutType.PANEL type: TerminalShortcutType.SESSION
}, { }, {
item: 'copy', item: 'copy',
content: '复制', content: '复制',