feat: 代码片段列表.
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
&.pass {
|
&.pass {
|
||||||
background-color: rgb(var(--green-6));
|
background-color: rgb(var(--green-6));
|
||||||
}
|
}
|
||||||
|
|
||||||
&.error {
|
&.error {
|
||||||
background-color: rgb(var(--red-6));
|
background-color: rgb(var(--red-6));
|
||||||
}
|
}
|
||||||
@@ -135,13 +136,6 @@
|
|||||||
|
|
||||||
// 抽屉
|
// 抽屉
|
||||||
.arco-drawer {
|
.arco-drawer {
|
||||||
&-header {
|
|
||||||
border-bottom: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-footer {
|
|
||||||
border-top: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-body {
|
&-body {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|||||||
@@ -280,11 +280,6 @@ body[terminal-theme='dark'] .arco-modal-container {
|
|||||||
background: var(--color-sidebar-tooltip-bg);
|
background: var(--color-sidebar-tooltip-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tooltip 箭头
|
|
||||||
.terminal-tooltip-arrow {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 终端右键菜单
|
// 终端右键菜单
|
||||||
.terminal-context-menu {
|
.terminal-context-menu {
|
||||||
.arco-dropdown-option {
|
.arco-dropdown-option {
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
:key="index"
|
:key="index"
|
||||||
:position="position as any"
|
:position="position as any"
|
||||||
:mini="true"
|
:mini="true"
|
||||||
|
:show-arrow="false"
|
||||||
content-class="terminal-tooltip-content"
|
content-class="terminal-tooltip-content"
|
||||||
arrow-class="terminal-tooltip-arrow"
|
:auto-fix-position="false"
|
||||||
:content="action.content">
|
:content="action.content">
|
||||||
<div class="terminal-sidebar-icon-wrapper" v-if="action.visible !== false">
|
<div class="terminal-sidebar-icon-wrapper" v-if="action.visible !== false">
|
||||||
<div class="terminal-sidebar-icon"
|
<div class="terminal-sidebar-icon"
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
<icon-actions class="bottom-actions"
|
<icon-actions class="bottom-actions"
|
||||||
:actions="bottomActions"
|
:actions="bottomActions"
|
||||||
position="left" />
|
position="left" />
|
||||||
|
<!-- 代码片段 -->
|
||||||
|
<snippet-drawer ref="snippetRef" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -21,32 +23,23 @@
|
|||||||
import type { SidebarAction } from '../../types/terminal.type';
|
import type { SidebarAction } from '../../types/terminal.type';
|
||||||
import { useTerminalStore } from '@/store';
|
import { useTerminalStore } from '@/store';
|
||||||
import { TerminalTabType } from '../../types/terminal.const';
|
import { TerminalTabType } from '../../types/terminal.const';
|
||||||
import IconActions from './icon-actions.vue';
|
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import IconActions from './icon-actions.vue';
|
||||||
|
import SnippetDrawer from '../snippet/snippet-drawer.vue';
|
||||||
|
|
||||||
const emits = defineEmits(['openSnippet', 'openSftp', 'openTransfer']);
|
const emits = defineEmits(['openSftp', 'openTransfer']);
|
||||||
|
|
||||||
const { tabManager, sessionManager } = useTerminalStore();
|
const { tabManager, sessionManager } = useTerminalStore();
|
||||||
|
|
||||||
// 终端截屏
|
const snippetRef = ref();
|
||||||
const screenshot = () => {
|
|
||||||
const tab = tabManager.getCurrentTab();
|
|
||||||
if (!tab || tab.type !== TerminalTabType.TERMINAL) {
|
|
||||||
Message.warning('请切换到终端标签页');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 获取处理器并截图
|
|
||||||
sessionManager.getSession(tab.key)
|
|
||||||
?.handler
|
|
||||||
?.screenshot();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 顶部操作
|
// 顶部操作
|
||||||
const topActions = [
|
const topActions = [
|
||||||
{
|
{
|
||||||
icon: 'icon-code-block',
|
icon: 'icon-code',
|
||||||
content: '打开命令片段',
|
content: '打开命令片段',
|
||||||
click: () => emits('openSnippet')
|
click: () => snippetRef.value.open()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'icon-folder',
|
icon: 'icon-folder',
|
||||||
@@ -68,10 +61,23 @@
|
|||||||
{
|
{
|
||||||
icon: 'icon-camera',
|
icon: 'icon-camera',
|
||||||
content: '截图',
|
content: '截图',
|
||||||
click: screenshot
|
click: () => screenshot()
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 终端截屏
|
||||||
|
const screenshot = () => {
|
||||||
|
const tab = tabManager.getCurrentTab();
|
||||||
|
if (!tab || tab.type !== TerminalTabType.TERMINAL) {
|
||||||
|
Message.warning('请切换到终端标签页');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取处理器并截图
|
||||||
|
sessionManager.getSession(tab.key)
|
||||||
|
?.handler
|
||||||
|
?.screenshot();
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
<!-- 修改别名 -->
|
<!-- 修改别名 -->
|
||||||
<a-tooltip position="top"
|
<a-tooltip position="top"
|
||||||
:mini="true"
|
:mini="true"
|
||||||
|
:auto-fix-position="false"
|
||||||
content-class="terminal-tooltip-content"
|
content-class="terminal-tooltip-content"
|
||||||
arrow-class="terminal-tooltip-content"
|
arrow-class="terminal-tooltip-content"
|
||||||
content="修改别名">
|
content="修改别名">
|
||||||
@@ -82,6 +83,7 @@
|
|||||||
<!-- ip -->
|
<!-- ip -->
|
||||||
<a-tooltip position="top"
|
<a-tooltip position="top"
|
||||||
:mini="true"
|
:mini="true"
|
||||||
|
:auto-fix-position="false"
|
||||||
content-class="terminal-tooltip-content"
|
content-class="terminal-tooltip-content"
|
||||||
arrow-class="terminal-tooltip-content"
|
arrow-class="terminal-tooltip-content"
|
||||||
:content="item.address">
|
:content="item.address">
|
||||||
@@ -112,6 +114,7 @@
|
|||||||
<!-- 连接主机 -->
|
<!-- 连接主机 -->
|
||||||
<a-tooltip position="top"
|
<a-tooltip position="top"
|
||||||
:mini="true"
|
:mini="true"
|
||||||
|
:auto-fix-position="false"
|
||||||
content-class="terminal-tooltip-content"
|
content-class="terminal-tooltip-content"
|
||||||
arrow-class="terminal-tooltip-content"
|
arrow-class="terminal-tooltip-content"
|
||||||
content="连接主机">
|
content="连接主机">
|
||||||
@@ -124,6 +127,7 @@
|
|||||||
<!-- 连接设置 -->
|
<!-- 连接设置 -->
|
||||||
<a-tooltip position="top"
|
<a-tooltip position="top"
|
||||||
:mini="true"
|
:mini="true"
|
||||||
|
:auto-fix-position="false"
|
||||||
content-class="terminal-tooltip-content"
|
content-class="terminal-tooltip-content"
|
||||||
arrow-class="terminal-tooltip-content"
|
arrow-class="terminal-tooltip-content"
|
||||||
content="连接设置">
|
content="连接设置">
|
||||||
@@ -136,6 +140,7 @@
|
|||||||
<!-- 收藏 -->
|
<!-- 收藏 -->
|
||||||
<a-tooltip position="top"
|
<a-tooltip position="top"
|
||||||
:mini="true"
|
:mini="true"
|
||||||
|
:auto-fix-position="false"
|
||||||
content-class="terminal-tooltip-content"
|
content-class="terminal-tooltip-content"
|
||||||
arrow-class="terminal-tooltip-content"
|
arrow-class="terminal-tooltip-content"
|
||||||
content="收藏">
|
content="收藏">
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
<a-drawer v-model:visible="visible"
|
||||||
|
:width="368"
|
||||||
|
:footer="false">
|
||||||
|
<!-- 表头 -->
|
||||||
|
<template #title>
|
||||||
|
<span class="snippet-drawer-title">
|
||||||
|
<icon-code />
|
||||||
|
代码片段
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<!-- 命令容器 -->
|
||||||
|
<div class="snippet-container">
|
||||||
|
<!-- 命令头部 -->
|
||||||
|
<div class="snippet-header-container">
|
||||||
|
<!-- 头部操作 -->
|
||||||
|
<div class="snippet-header">
|
||||||
|
<a-button>新建分组</a-button>
|
||||||
|
<a-button>新建命令</a-button>
|
||||||
|
<a-button>搜索</a-button>
|
||||||
|
</div>
|
||||||
|
<!-- 提示 -->
|
||||||
|
<a-alert v-if="isNotTipped(snippetTipsKey)"
|
||||||
|
class="snippet-tips"
|
||||||
|
:closable="true"
|
||||||
|
@on-close="closeTips">
|
||||||
|
双击命令直接粘贴
|
||||||
|
</a-alert>
|
||||||
|
</div>
|
||||||
|
<!-- 命令片段 -->
|
||||||
|
<div class="snippet-list-container">
|
||||||
|
<a-collapse :default-active-key="['1']" :bordered="false">
|
||||||
|
<a-collapse-item header="group 1" key="1" style="border: none;">
|
||||||
|
</a-collapse-item>
|
||||||
|
<a-collapse-item header="group 2" key="2" style="border: none;">
|
||||||
|
</a-collapse-item>
|
||||||
|
<a-collapse-item header="group 3" key="3" style="border: none;">
|
||||||
|
</a-collapse-item>
|
||||||
|
</a-collapse>
|
||||||
|
123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>
|
||||||
|
123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>
|
||||||
|
123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>123123 <br>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'snippetDrawer'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useTipsStore } from '@/store';
|
||||||
|
import useVisible from '@/hooks/visible';
|
||||||
|
import { snippetTipsKey } from '../../types/terminal.const';
|
||||||
|
|
||||||
|
const { isNotTipped, setTipped } = useTipsStore();
|
||||||
|
const { visible, setVisible } = useVisible(true);
|
||||||
|
|
||||||
|
// 打开
|
||||||
|
const open = () => {
|
||||||
|
setVisible(true);
|
||||||
|
// loading
|
||||||
|
};
|
||||||
|
|
||||||
|
// 关闭提示
|
||||||
|
const closeTips = () => {
|
||||||
|
console.log('close');
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({ open });
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.snippet-drawer-title {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snippet-container {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.snippet-header-container {
|
||||||
|
padding: 12px;
|
||||||
|
//height: 104px;
|
||||||
|
|
||||||
|
.snippet-header {
|
||||||
|
}
|
||||||
|
|
||||||
|
.snippet-tips{
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.snippet-list-container {
|
||||||
|
position: relative;
|
||||||
|
//height: calc(100% - 104px);
|
||||||
|
overflow: auto;
|
||||||
|
padding: 0 12px 12px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.arco-collapse-item-header) {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -5,7 +5,8 @@
|
|||||||
ref="inputRef"
|
ref="inputRef"
|
||||||
v-model="inputValue"
|
v-model="inputValue"
|
||||||
placeholder="搜索关键字"
|
placeholder="搜索关键字"
|
||||||
@keyup.enter="find(true)" />
|
@keyup.enter="find(true)"
|
||||||
|
@keyup.esc="close" />
|
||||||
<div class="options-wrapper">
|
<div class="options-wrapper">
|
||||||
<!-- 上一个-->
|
<!-- 上一个-->
|
||||||
<div class="icon-wrapper"
|
<div class="icon-wrapper"
|
||||||
@@ -124,7 +125,7 @@
|
|||||||
width: 272px;
|
width: 272px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
z-index: 9999;
|
z-index: 30;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<terminal-left-sidebar />
|
<terminal-left-sidebar />
|
||||||
</div>
|
</div>
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<div class="host-layout-content">
|
<div id="terminal-layout-content" class="host-layout-content">
|
||||||
<!-- 主机加载中骨架 -->
|
<!-- 主机加载中骨架 -->
|
||||||
<loading-skeleton v-if="contentLoading" />
|
<loading-skeleton v-if="contentLoading" />
|
||||||
<!-- 终端内容区域 -->
|
<!-- 终端内容区域 -->
|
||||||
@@ -116,7 +116,6 @@
|
|||||||
height: var(--header-height);
|
height: var(--header-height);
|
||||||
background: var(--color-bg-header);
|
background: var(--color-bg-header);
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 9999;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-main {
|
&-main {
|
||||||
|
|||||||
@@ -208,6 +208,9 @@ export const TerminalShortcutItems: Array<ShortcutKeyItem> = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 代码片段操作提示
|
||||||
|
export const snippetTipsKey = 'snippet:opt';
|
||||||
|
|
||||||
// 打开 sshModal key
|
// 打开 sshModal key
|
||||||
export const openSshModalKey = Symbol();
|
export const openSshModalKey = Symbol();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user