feat(vm): 虚拟机详情页新增 SSH 连接按钮
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
</div>
|
||||
<div class="overview-actions">
|
||||
<el-button type="primary" @click="handleGetVnc">远程连接</el-button>
|
||||
<el-button type="success" @click="handleSshConnect" :disabled="!publicIpList.length || isWindows">SSH连接</el-button>
|
||||
<el-button type="danger" @click="handlePower('stop')" :disabled="detail.status === 'stopped' || detail.status === 'stop' || isMigrating">关机</el-button>
|
||||
<el-dropdown trigger="click" @command="handleMoreCommand">
|
||||
<el-button>更多 <el-icon class="el-icon--right"><ArrowDown /></el-icon></el-button>
|
||||
@@ -2783,6 +2784,15 @@ const loadVncNodes = async () => {
|
||||
} catch { /* */ }
|
||||
}
|
||||
|
||||
const handleSshConnect = () => {
|
||||
const host = publicIpList.value[0]
|
||||
if (!host) return ElMessage.warning('无可用公网 IP')
|
||||
const username = isWindows.value ? 'Administrator' : 'root'
|
||||
const password = detail.value?.root_password || ''
|
||||
const encodedPwd = btoa(password)
|
||||
window.open(`https://webssh1.007yjs.com/?hostname=${encodeURIComponent(host)}&username=${encodeURIComponent(username)}&password=${encodedPwd}`, '_blank')
|
||||
}
|
||||
|
||||
const handleGetVnc = async () => {
|
||||
vncNodeId.value = null
|
||||
vncResult.value = null
|
||||
|
||||
Reference in New Issue
Block a user