✨ temp push
This commit is contained in:
parent
851d063773
commit
660ca88dac
@ -79,8 +79,8 @@ const removeSSH = async ({ res, request }) => {
|
||||
const getCommand = async ({ res, request }) => {
|
||||
let { host } = request.query
|
||||
if(!host) return res.fail({ data: false, msg: '参数错误' })
|
||||
let sshRecord = await readSSHRecord()
|
||||
let record = sshRecord?.find(item => item.host === host)
|
||||
let hostInfo = await readHostList()
|
||||
let record = hostInfo?.find(item => item.host === host)
|
||||
consola.info('查询登录后执行的指令:', host)
|
||||
if(!record) return res.fail({ data: false, msg: 'host not found' }) // host不存在
|
||||
const { command } = record
|
||||
|
@ -66,7 +66,8 @@ module.exports = (httpServer) => {
|
||||
}
|
||||
consola.info('准备连接终端:', host)
|
||||
targetHostInfo[targetHostInfo.authType] = await AESDecryptSync(targetHostInfo[targetHostInfo.authType])
|
||||
|
||||
// :TODO: 初始化后连接失败...
|
||||
// console.log('targetHostInfo:', targetHostInfo)
|
||||
consola.log('连接信息', { username, port, authType })
|
||||
sshClient
|
||||
.on('ready', () => {
|
||||
|
@ -13,7 +13,7 @@ import { WebLinksAddon } from 'xterm-addon-web-links'
|
||||
import socketIo from 'socket.io-client'
|
||||
|
||||
const { io } = socketIo
|
||||
const { proxy: { $api, $store, $serviceURI, $notification, $router, $message, $messageBox } } = getCurrentInstance()
|
||||
const { proxy: { $api, $store, $serviceURI, $notification, $router, $message } } = getCurrentInstance()
|
||||
|
||||
const props = defineProps({
|
||||
host: {
|
||||
@ -225,7 +225,7 @@ const handleInputCommand = (command) => {
|
||||
|
||||
onMounted(async () => {
|
||||
createLocalTerminal()
|
||||
// await getCommand()
|
||||
await getCommand()
|
||||
connectIO()
|
||||
})
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
<div class="top">
|
||||
<el-dropdown trigger="click">
|
||||
<div class="action_wrap">
|
||||
<!-- 全屏 -->
|
||||
<el-icon><FullScreen /></el-icon>
|
||||
<span class="link_host">连接<el-icon class="el-icon--right"><arrow-down /></el-icon></span>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
@ -57,7 +59,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, defineEmits, computed, defineProps, getCurrentInstance, watch, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import { ArrowDown, FullScreen } from '@element-plus/icons-vue'
|
||||
import TerminalTab from './terminal-tab.vue'
|
||||
import InfoSide from './info-side.vue'
|
||||
import Sftp from './sftp.vue'
|
||||
@ -75,9 +77,7 @@ const props = defineProps({
|
||||
const emit = defineEmits(['closed', 'removeTab', 'add-host',])
|
||||
|
||||
const activeTabIndex = ref(0)
|
||||
// const terminalTabs = reactive([])
|
||||
const isFullScreen = ref(false)
|
||||
const timer = ref(null)
|
||||
const showInputCommand = ref(false)
|
||||
const visible = ref(true)
|
||||
const infoSideRef = ref(null)
|
||||
@ -139,18 +139,6 @@ const clickInputCommand = () => {
|
||||
showInputCommand.value = true
|
||||
}
|
||||
|
||||
const tabAdd = () => {
|
||||
if (timer.value) clearTimeout(timer.value)
|
||||
timer.value = setTimeout(() => {
|
||||
let title = name.value
|
||||
let key = Date.now().toString()
|
||||
terminalTabs.value.push({ title, key })
|
||||
activeTabIndex.value = key
|
||||
tabChange(key)
|
||||
// registryDbClick()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
const removeTab = (index) => {
|
||||
// terminalTabs.value.splice(index, 1)
|
||||
emit('removeTab', index)
|
||||
|
Loading…
x
Reference in New Issue
Block a user