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