fix:解决 terminal 首次建立连接刷新的问题
This commit is contained in:
@@ -195,7 +195,7 @@ export default {
|
||||
this.term.open(terminalContainer)
|
||||
this.term.focus()
|
||||
const token = sessionStorage.getItem('nz-token')
|
||||
let baseUrl = this.$axios.defaults.baseURL
|
||||
let baseUrl = JSON.parse(JSON.stringify(this.$axios.defaults.baseURL))
|
||||
if (baseUrl.startsWith('/')) {
|
||||
baseUrl = 'ws://' + window.location.host + baseUrl
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
@import './webSSH.scss';
|
||||
</style>
|
||||
<template>
|
||||
<!-- <div id="shell-service" data-yunlog-scope="popup" :class="{'shell-service-max': isFullScreen,'shell-service':true}" v-show="consoleShow">
|
||||
<!-- <div id="shell-service" data-yunlog-scope="popup" :class="{'shell-service-max': isFullScreen,'shell-service':true}" v-show="consoleShow">
|
||||
<div class="resize-modal">
|
||||
<div class="sub-list-resize-copy">一</div>
|
||||
</div>
|
||||
@@ -67,13 +67,14 @@
|
||||
<el-tab-pane key="add" name="addConsole" style="width: 20px">
|
||||
<el-popover
|
||||
slot="label"
|
||||
placement="bottom"
|
||||
width="200"
|
||||
placement="bottom-start"
|
||||
width="150"
|
||||
trigger="hover"
|
||||
:popper-class="'popover-webshell'"
|
||||
>
|
||||
<div>
|
||||
<div @click="assetShowChange">Asset</div>
|
||||
<div @click="customShow=true">Custom</div>
|
||||
<div class="popover-webshell-item" @click="assetShowChange"><i class="nz-icon nz-icon-menu-assets" />Select asset</div>
|
||||
<div class="popover-webshell-item" @click="customShow=true"><i class="nz-icon nz-icon-edit" />Custom connect</div>
|
||||
</div>
|
||||
<span slot="reference" style="padding:8px;font-size:20px;font-weight:bold;">+</span>
|
||||
</el-popover>
|
||||
@@ -197,7 +198,7 @@
|
||||
:placeholder="$t('dashboard.panel.chartForm.selectAsset')"
|
||||
id="box-input-asset-id"
|
||||
:result-format="resultFormat"></v-selectpage>
|
||||
<button @click="connect" :disabled="prevent_opt.save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new">Connect</button>
|
||||
<button @click.prevent="connect" type="button" :disabled="prevent_opt.save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new">Connect</button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -205,12 +206,12 @@
|
||||
<el-dialog :modal-append-to-body='false' :show-close="true" :visible.sync="customShow" @close="customShow=false" class="nz-dialog" width="620px" >
|
||||
<div >
|
||||
<el-form label-width="120px" size="small" :model="customConnect" label-position = "top" :rules="rulesCustom" ref="customConnect" v-loading="assetLoading" class="custom">
|
||||
<el-form-item :label='$t("webshell.protocol")' prop="authProtocol">
|
||||
<el-form-item :label='$t("webshell.protocol")' prop="authProtocol" @change="protocolChange">
|
||||
<el-select value-key="id" popper-class="config-dropdown" v-model="customConnect.authProtocol" placeholder="" size="small" id="webshell-box-input-protocol">
|
||||
<el-option v-for="item in authProtocol" :id="'dc-principal-op-'+item.value" :key="item.value" :label="item.name" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label='$t("webshell.authType")' prop="authType">
|
||||
<el-form-item :label='$t("webshell.authType")' prop="authType" @change="authTypeChange">
|
||||
<el-select value-key="id" popper-class="config-dropdown" v-model="customConnect.authType" placeholder="" size="small" id="webshell-box-input-protocol">
|
||||
<el-option v-for="item in authType" :id="'dc-principal-op-'+item.value" :key="item.value" :label="item.name" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
@@ -227,20 +228,40 @@
|
||||
<el-form-item :label='$t("webshell.authPin")' prop="authPin">
|
||||
<el-input v-model="customConnect.authPin" size="small"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label='$t("webshell.authUserTip")' prop="authUserTip">
|
||||
<el-form-item
|
||||
v-if="customConnect.authProtocol === 2"
|
||||
:label='$t("webshell.authUserTip")'
|
||||
prop="authUserTip"
|
||||
:rules="[
|
||||
{ required: customConnect.authProtocol ===2, message:$t('validate.required'), trigger: 'change'},
|
||||
]">
|
||||
<el-input v-model="customConnect.authUserTip" size="small"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label='$t("webshell.authPinTip")' prop="authPinTip">
|
||||
<el-form-item
|
||||
v-if="customConnect.authProtocol === 2"
|
||||
:label='$t("webshell.authPinTip")'
|
||||
prop="authPinTip"
|
||||
:rules="[
|
||||
{ required: customConnect.authProtocol ===2, message:$t('validate.required'), trigger: 'change'},
|
||||
]"
|
||||
>
|
||||
<el-input v-model="customConnect.authPinTip" size="small"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label='$t("webshell.authPriKey")' prop="authPriKey">
|
||||
<el-form-item
|
||||
v-if="customConnect.authType === 2"
|
||||
:label='$t("webshell.authPriKey")'
|
||||
prop="authPriKey"
|
||||
:rules="[
|
||||
{ required: customConnect.authType ===2, message:$t('validate.required'), trigger: 'change'},
|
||||
]"
|
||||
>
|
||||
<el-input v-model="customConnect.authPriKey" size="small"/>
|
||||
</el-form-item>
|
||||
<div class="right-box__footer">
|
||||
<button id="asset-edit-cancel" @click="customShow=false" class="footer__btn footer__btn--light">
|
||||
<button id="asset-edit-cancel" @click="customShow=false" class="footer__btn footer__btn--light" type="button">
|
||||
<span>{{$t('overall.cancel')}}</span>
|
||||
</button>
|
||||
<button id="asset-edit-save" :disabled="prevent_opt.save" class="footer__btn" @click="connect">
|
||||
<button id="asset-edit-save" :disabled="prevent_opt.save" class="footer__btn" @click.prevent="connect" type="button">
|
||||
<span>Connect</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -378,7 +399,7 @@ export default {
|
||||
],
|
||||
authPin: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
||||
],
|
||||
]
|
||||
// authUserTip: [
|
||||
// { validator: this.authUserTipValid, trigger: 'change' }
|
||||
// ],
|
||||
@@ -794,7 +815,6 @@ export default {
|
||||
})
|
||||
},
|
||||
resultFormat (resp) {
|
||||
console.log(resp)
|
||||
if (resp && resp.data) return resp.data.values.gridResult
|
||||
},
|
||||
assetShowChange () {
|
||||
@@ -811,12 +831,10 @@ export default {
|
||||
connect () {
|
||||
this.prevent_opt.save = true
|
||||
if (this.assetShow) {
|
||||
console.log(this.assetContent)
|
||||
this.$refs.assetConnect.validate((valid) => {
|
||||
if (valid) {
|
||||
// this.show(id, host, accountId, port)
|
||||
const asset = this.assetData.find(item => item.id == this.assetContent.assetId)
|
||||
console.log(asset)
|
||||
this.addConsole(asset.id, asset.manageIp, '', '', 'asset')
|
||||
this.assetShow = false
|
||||
this.prevent_opt.save = false
|
||||
@@ -832,14 +850,16 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
authUserTipValid () {
|
||||
|
||||
protocolChange () {
|
||||
if (this.customConnect.authProtocol === 1) {
|
||||
this.customConnect.authUserTip = ''
|
||||
this.customConnect.authPinTip = ''
|
||||
}
|
||||
},
|
||||
authPinTipValid () {
|
||||
|
||||
},
|
||||
authPriKeyValid () {
|
||||
|
||||
authTypeChange () {
|
||||
if (this.customConnect.authType === 1) {
|
||||
this.customConnect.authPriKey = ''
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -909,3 +929,29 @@ export default {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.popover-webshell{
|
||||
margin-top: 0 !important;
|
||||
.popover-webshell-item{
|
||||
padding: 5px;
|
||||
font-family: Roboto-Regular;
|
||||
font-size: 14px;
|
||||
color: #666666;
|
||||
font-weight: 400;
|
||||
.nz-icon{
|
||||
margin-right: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
.popover-webshell-item:hover{
|
||||
background: #F6F6F6;
|
||||
font-family: Roboto-Regular;
|
||||
font-size: 14px;
|
||||
color: #FA901C;
|
||||
font-weight: 400;
|
||||
}
|
||||
.popper__arrow{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user