🐛 修复终端配置自动连接

This commit is contained in:
chaos-zhu 2024-08-09 12:17:59 +08:00
parent 69dd8dcdeb
commit b1532ca9da
3 changed files with 7 additions and 13 deletions

View File

@ -431,7 +431,7 @@ const handleSave = () => {
}
}
visible.value = false
emit('update-list')
emit('update-list', { host: isBatchModify.value ? batchHosts.value : hostForm.value.host })
})
}
</script>

View File

@ -188,13 +188,11 @@ onBeforeUnmount(() => {
window.removeEventListener('resize', handleResizeTerminalSftp)
})
const handleUpdateList = async ({ isConfig, host }) => {
const handleUpdateList = async ({ host }) => {
try {
await $store.getHostList()
if (isConfig) {
let targetHost = hostList.value.find(item => item.host === host)
if (targetHost !== -1) emit('add-host', targetHost)
}
let targetHost = hostList.value.find(item => item.host === host)
if (targetHost) emit('add-host', targetHost)
} catch (err) {
$message.error('获取实例列表失败')
console.error('获取实例列表失败: ', err)

View File

@ -60,8 +60,6 @@ import { randomStr } from '@utils/index.js'
const { proxy: { $store, $message } } = getCurrentInstance()
// const emit = defineEmits(['add-host',])
let terminalTabs = reactive([])
let hostFormVisible = ref(false)
let updateHostData = ref(null)
@ -88,13 +86,11 @@ function handleRemoveTab(index) {
terminalTabs.splice(index, 1)
}
const handleUpdateList = async ({ isConfig, host }) => {
const handleUpdateList = async ({ host }) => {
try {
await $store.getHostList()
if (isConfig) {
let targetHost = hostList.value.find(item => item.host === host)
if (targetHost !== -1) linkTerminal(targetHost)
}
let targetHost = hostList.value.find(item => item.host === host)
if (targetHost) linkTerminal(targetHost)
} catch (err) {
$message.error('获取实例列表失败')
console.error('获取实例列表失败: ', err)