NEZ-2485 fix:terminal 发送文本到所有SSH终端失效 以及样式问题

This commit is contained in:
zhangyu
2022-12-28 14:02:21 +08:00
parent 0773a6e9af
commit ae4a5f3a6d
4 changed files with 20 additions and 7 deletions

View File

@@ -138,6 +138,7 @@
input {
background: #1E1E1E !important;
border: none;
color: white;
}
input::input-placeholder{
color: #7C7C7C;

View File

@@ -154,6 +154,7 @@ export default {
}
let url = ''
this.terminal.height = document.body.clientHeight - 100
this.terminal.width = document.body.clientWidth
if (this.terminal.type === 'asset') {
url = baseUrl + '/terminal.ws?width=' + this.terminal.width + '&height=' + this.terminal.height + '&cols=' + this.terminal.cols + '&rows=' + this.terminal.rows + '&token=' + token + '&assetId=' + this.terminal.assetId + '&accountId=' + this.terminal.accountId + '&uuid=' + this.terminal.uuid
} else if (this.terminal.type === 'custom') {
@@ -240,7 +241,7 @@ export default {
this.term.attach(this.terminalSocket)
this.term._initialized = true
this.term.fit()// 自适应大小(使终端的尺寸和几何尺寸适合于终端容器的尺寸) 只是width
// this.term.fit()// 自适应大小(使终端的尺寸和几何尺寸适合于终端容器的尺寸) 只是width
this.$nextTick(() => { // 解决进入全屏和退出全屏是底部隐藏
this.setFontSize(this.fontSize)
})

View File

@@ -11,7 +11,7 @@
</div>
<fileListState v-clickoutside="hideFileState" ref="fileListState"/>
<webSSHNew ref="websshNew" />
<el-input :placeholder="'发送文本到所有SSH终端'" size="small" class="shell-input" v-model="message" @keyup.enter.native="sendMessage"/>
<el-input :placeholder="placeholder" size="small" class="shell-input" v-model="message" @keyup.enter.native="sendMessage" @focus="placeholderChange('focus')" @blur="placeholderChange('blur')"/>
</div>
</template>
@@ -31,7 +31,8 @@ export default {
logo: '',
fileListStateType: '',
message: '',
name: ''
name: '',
placeholder: this.$t('terminal.placeholder')
}
},
computed: {
@@ -83,8 +84,18 @@ export default {
hideFileState () {
this.$refs.fileListState.fileStateShow(false, this.fileListStateType)
},
placeholderChange (type) {
if (type == 'focus') {
this.placeholder = ''
}else {
this.placeholder = this.$t('terminal.placeholder')
}
},
sendMessage () {
this.$refs.websshNew.sendMessage(this.message)
setTimeout(() => {
this.message = ''
})
}
},
beforeDestroy () {

View File

@@ -14,7 +14,7 @@
<!-- tab显示的内容 1 grey,2 green, 3 red-->
<span slot="label" class="el-tabs__item-label">
<div class="active-icon" :class="item.terminal.isLogin ? 'green-bg': 'red-bg'"></div>
<div class="el-tabs__item-label-name text-ellipsis">
<div class="el-tabs__item-label-name text-ellipsis" :title="item.terminal.userName">
{{item.terminal.userName}}
</div>
<el-popover
@@ -409,8 +409,8 @@ export default {
this.currentIndex = currentName
}
},
handleClick () {
handleClick (el) {
// this.$refs['console' + el.index][0].focusConsole()
},
windowChange () { // 窗口大小改变
// alert('winChange');
@@ -579,7 +579,7 @@ export default {
cols: 225,
rows: 200,
width: width,
height: this.consoleHeight,
height: document.body.clientHeight - 100,
assetId: id,
accountId: accountId,
uuid: uuid,