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 { input {
background: #1E1E1E !important; background: #1E1E1E !important;
border: none; border: none;
color: white;
} }
input::input-placeholder{ input::input-placeholder{
color: #7C7C7C; color: #7C7C7C;

View File

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

View File

@@ -11,7 +11,7 @@
</div> </div>
<fileListState v-clickoutside="hideFileState" ref="fileListState"/> <fileListState v-clickoutside="hideFileState" ref="fileListState"/>
<webSSHNew ref="websshNew" /> <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> </div>
</template> </template>
@@ -31,7 +31,8 @@ export default {
logo: '', logo: '',
fileListStateType: '', fileListStateType: '',
message: '', message: '',
name: '' name: '',
placeholder: this.$t('terminal.placeholder')
} }
}, },
computed: { computed: {
@@ -83,8 +84,18 @@ export default {
hideFileState () { hideFileState () {
this.$refs.fileListState.fileStateShow(false, this.fileListStateType) this.$refs.fileListState.fileStateShow(false, this.fileListStateType)
}, },
placeholderChange (type) {
if (type == 'focus') {
this.placeholder = ''
}else {
this.placeholder = this.$t('terminal.placeholder')
}
},
sendMessage () { sendMessage () {
this.$refs.websshNew.sendMessage(this.message) this.$refs.websshNew.sendMessage(this.message)
setTimeout(() => {
this.message = ''
})
} }
}, },
beforeDestroy () { beforeDestroy () {

View File

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