NEZ-2446 feat: web terminal 新页面开发(通过浏览器新标签页方式打开)
This commit is contained in:
@@ -104,10 +104,12 @@
|
|||||||
.file-size{
|
.file-size{
|
||||||
width: 15%;
|
width: 15%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
.file-date{
|
.file-date{
|
||||||
width: 25%;
|
width: 25%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
.file-opt{
|
.file-opt{
|
||||||
width: 14%;
|
width: 14%;
|
||||||
@@ -116,6 +118,27 @@
|
|||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.file-arrow-header{
|
||||||
|
display: inline-flex;align-items: center;width: 100%
|
||||||
|
}
|
||||||
|
.nz-arrow-box{
|
||||||
|
display: flex;flex-direction: column;align-items: center;margin-left: 7px
|
||||||
|
}
|
||||||
|
.nz-arrow-up{
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.nz-arrow-up.is-select{
|
||||||
|
border-bottom:5px solid $--color-primary; /* 定义底部颜色 */
|
||||||
|
}
|
||||||
|
.nz-arrow-down.is-select{
|
||||||
|
border-top:5px solid $--color-primary; /* 定义底部颜色 */
|
||||||
|
}
|
||||||
|
.nz-icon-caret-up {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.nz-icon-caret-down {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
.file-item{
|
.file-item{
|
||||||
font-family: Roboto-Regular;
|
font-family: Roboto-Regular;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@@ -153,3 +176,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
div.nz-arrow-up {
|
||||||
|
width:0px;
|
||||||
|
height:0px;
|
||||||
|
border-left:5px solid transparent; /* 右透明 */
|
||||||
|
border-right:5px solid transparent; /*右透明 */
|
||||||
|
border-bottom:5px solid $--color-text-disabled; /* 定义底部颜色 */
|
||||||
|
font-size:0px;
|
||||||
|
line-height:0px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
/* css3三角形(向下 ▼) */
|
||||||
|
div.nz-arrow-down {
|
||||||
|
width:0px;
|
||||||
|
height:0px;
|
||||||
|
border-left:5px solid transparent;
|
||||||
|
border-right:5px solid transparent;
|
||||||
|
border-top:5px solid $--color-text-disabled;
|
||||||
|
font-size:0px;
|
||||||
|
line-height:0px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -700,7 +700,6 @@ const unitOptions = [
|
|||||||
]
|
]
|
||||||
const units = []
|
const units = []
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
console.log(13213)
|
|
||||||
if (units.length < 1) {
|
if (units.length < 1) {
|
||||||
unitOptions.forEach((item, index) => {
|
unitOptions.forEach((item, index) => {
|
||||||
item.children.forEach((n, i) => {
|
item.children.forEach((n, i) => {
|
||||||
|
|||||||
@@ -300,7 +300,6 @@ export default {
|
|||||||
// 错误
|
// 错误
|
||||||
this.terminalSocket.onerror = (e) => {
|
this.terminalSocket.onerror = (e) => {
|
||||||
this.isLogin = false
|
this.isLogin = false
|
||||||
console.log(this.isLogin, 'close')
|
|
||||||
}
|
}
|
||||||
// 选中 复制
|
// 选中 复制
|
||||||
this.term.on('selection', function () {})
|
this.term.on('selection', function () {})
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ export default {
|
|||||||
authPinTip: this.$loadsh.get(this.terminal, 'custom.authPinTip', '')
|
authPinTip: this.$loadsh.get(this.terminal, 'custom.authPinTip', '')
|
||||||
}
|
}
|
||||||
this.$post('/terminal/login', params).then(res => {
|
this.$post('/terminal/login', params).then(res => {
|
||||||
console.log(res)
|
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.terminal.uuid = res.data.uuid
|
this.terminal.uuid = res.data.uuid
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
@@ -234,7 +233,6 @@ export default {
|
|||||||
// 错误
|
// 错误
|
||||||
this.terminalSocket.onerror = (e) => {
|
this.terminalSocket.onerror = (e) => {
|
||||||
this.terminal.isLogin = false
|
this.terminal.isLogin = false
|
||||||
console.log(this.terminal.isLogin, 'close')
|
|
||||||
}
|
}
|
||||||
// 选中 复制
|
// 选中 复制
|
||||||
this.term.on('selection', function () {})
|
this.term.on('selection', function () {})
|
||||||
@@ -262,7 +260,6 @@ export default {
|
|||||||
this.term && this.term.setOption('fontSize', fontSize)
|
this.term && this.term.setOption('fontSize', fontSize)
|
||||||
const consoleBox = document.getElementById('ternimalContainer' + this.idIndex)
|
const consoleBox = document.getElementById('ternimalContainer' + this.idIndex)
|
||||||
const width = document.body.clientWidth// 可视宽度
|
const width = document.body.clientWidth// 可视宽度
|
||||||
console.log(consoleBox.offsetHeight)
|
|
||||||
let height = parseInt(consoleBox.offsetHeight)
|
let height = parseInt(consoleBox.offsetHeight)
|
||||||
if (height == null || !height) { height = this.termimalHeight }
|
if (height == null || !height) { height = this.termimalHeight }
|
||||||
const winStyle = {
|
const winStyle = {
|
||||||
@@ -306,6 +303,12 @@ export default {
|
|||||||
this.animateCSS(this.$refs.fileDirectory.$el, animationClass).then((message) => {
|
this.animateCSS(this.$refs.fileDirectory.$el, animationClass).then((message) => {
|
||||||
this.fileDirectoryShow = show
|
this.fileDirectoryShow = show
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
enterStr (message) {
|
||||||
|
this.terminalSocket.send(message)
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.terminalSocket.send('\n')
|
||||||
|
}, 100)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|||||||
@@ -32,10 +32,34 @@
|
|||||||
{{$t('overall.name')}}
|
{{$t('overall.name')}}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-ellipsis file-size">
|
<div class="text-ellipsis file-size">
|
||||||
{{$t('backup.size')}}
|
<div class="file-arrow-header" >
|
||||||
|
<div>
|
||||||
|
{{$t('backup.size')}}
|
||||||
|
</div>
|
||||||
|
<div class="nz-arrow-box">
|
||||||
|
<div class="nz-arrow-up" :class="{
|
||||||
|
'is-select': sizeOrderType === 'asc'
|
||||||
|
}" @click="orderBy('sizeOrderType','asc' , 'size')"></div>
|
||||||
|
<div class="nz-arrow-down" :class="{
|
||||||
|
'is-select': sizeOrderType === 'desc'
|
||||||
|
}" @click="orderBy('sizeOrderType','desc', 'size')"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-ellipsis file-date">
|
<div class="text-ellipsis file-date">
|
||||||
{{$t('issue.createTime')}}
|
<div class="file-arrow-header">
|
||||||
|
<div>
|
||||||
|
{{$t('issue.createTime')}}
|
||||||
|
</div>
|
||||||
|
<div class="nz-arrow-box" style="">
|
||||||
|
<div class="nz-arrow-up" :class="{
|
||||||
|
'is-select': dateOrderType === 'asc'
|
||||||
|
}" @click="orderBy('dateOrderType','asc', 'cts')"></div>
|
||||||
|
<div class="nz-arrow-down" :class="{
|
||||||
|
'is-select': dateOrderType === 'desc'
|
||||||
|
}" @click="orderBy('dateOrderType','desc', 'cts')"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-ellipsis file-opt">
|
<div class="text-ellipsis file-opt">
|
||||||
{{$t('overall.option')}}
|
{{$t('overall.option')}}
|
||||||
@@ -217,8 +241,11 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
fileDirectory: '/',
|
fileDirectory: '/',
|
||||||
|
sizeOrderType: 0,
|
||||||
|
dateOrderType: 0,
|
||||||
breadcrumb: [],
|
breadcrumb: [],
|
||||||
fileList: [],
|
fileList: [],
|
||||||
|
oldFileList: [],
|
||||||
newFolderBoxShow: false,
|
newFolderBoxShow: false,
|
||||||
folder: '',
|
folder: '',
|
||||||
fileDirectoryLoading: false,
|
fileDirectoryLoading: false,
|
||||||
@@ -287,8 +314,7 @@ export default {
|
|||||||
this.editPath = ''
|
this.editPath = ''
|
||||||
this.editPathShow = false
|
this.editPathShow = false
|
||||||
},
|
},
|
||||||
goEditPath () {
|
goEditPath () {
|
||||||
console.log('123123123')
|
|
||||||
this.getSftpPath(this.editPath)
|
this.getSftpPath(this.editPath)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.editPath = ''
|
this.editPath = ''
|
||||||
@@ -302,7 +328,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
showFileInfo (item) {
|
showFileInfo (item) {
|
||||||
console.log(item)
|
|
||||||
this.fileInfo = item
|
this.fileInfo = item
|
||||||
this.fileInfoShow = true
|
this.fileInfoShow = true
|
||||||
},
|
},
|
||||||
@@ -344,6 +369,7 @@ export default {
|
|||||||
this.fileDirectoryLoading = false
|
this.fileDirectoryLoading = false
|
||||||
this.fileDirectory = res.data.path
|
this.fileDirectory = res.data.path
|
||||||
this.fileList = res.data.list
|
this.fileList = res.data.list
|
||||||
|
this.oldFileList = res.data.list
|
||||||
this.editPath = ''
|
this.editPath = ''
|
||||||
this.breadcrumb = res.data.path.split('/').filter(item => item)
|
this.breadcrumb = res.data.path.split('/').filter(item => item)
|
||||||
} else {
|
} else {
|
||||||
@@ -475,6 +501,15 @@ export default {
|
|||||||
}
|
}
|
||||||
return '-'
|
return '-'
|
||||||
},
|
},
|
||||||
|
orderBy (key, orderType, order) {
|
||||||
|
if (this[key] == orderType) {
|
||||||
|
this[key] = 0
|
||||||
|
this.fileList = this.oldFileList
|
||||||
|
} else {
|
||||||
|
this[key] = orderType
|
||||||
|
this.fileList = this.$loadsh.orderBy(this.oldFileList, order, orderType)
|
||||||
|
}
|
||||||
|
},
|
||||||
tableOperation ([command, row, param]) {
|
tableOperation ([command, row, param]) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 'rename':
|
case 'rename':
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
bytes: chartDataFormat.getUnit(7).compute,
|
bytes: chartDataFormat.getUnit(7).compute,
|
||||||
customColorMethod (percentage, item) {
|
customColorMethod (percentage, item) {
|
||||||
console.log(item)
|
|
||||||
if (percentage < 100) {
|
if (percentage < 100) {
|
||||||
return '#3B92F1'
|
return '#3B92F1'
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -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"/>
|
<el-input :placeholder="'发送文本到所有SSH终端'" size="small" class="shell-input" v-model="message" @keyup.enter.native="sendMessage"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -59,7 +59,6 @@ export default {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
window.addEventListener('message', function (e) {
|
window.addEventListener('message', function (e) {
|
||||||
console.log(e)
|
|
||||||
if (e.data) {
|
if (e.data) {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(e.data)
|
const data = JSON.parse(e.data)
|
||||||
@@ -81,6 +80,9 @@ export default {
|
|||||||
},
|
},
|
||||||
hideFileState () {
|
hideFileState () {
|
||||||
this.$refs.fileListState.fileStateShow(false, this.fileListStateType)
|
this.$refs.fileListState.fileStateShow(false, this.fileListStateType)
|
||||||
|
},
|
||||||
|
sendMessage () {
|
||||||
|
this.$refs.websshNew.sendMessage(this.message)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
|
|||||||
@@ -610,12 +610,12 @@ export default {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.terminal.username = ''
|
console.terminal.username = ''
|
||||||
|
console.terminal.terminalType = this.customConnect.authProtocol
|
||||||
this.editableTabsValue = newTabName
|
this.editableTabsValue = newTabName
|
||||||
this.editableTabs.push(console)
|
this.editableTabs.push(console)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
duplicate (item, index) {
|
duplicate (item, index) {
|
||||||
console.log(item, index)
|
|
||||||
if (item.terminal.assetId) {
|
if (item.terminal.assetId) {
|
||||||
const newTabName = ++this.tabIndex + ''
|
const newTabName = ++this.tabIndex + ''
|
||||||
this.editableTabsValue = newTabName
|
this.editableTabsValue = newTabName
|
||||||
@@ -652,7 +652,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
reconnect (item, index) {
|
reconnect (item, index) {
|
||||||
console.log(item, index)
|
|
||||||
this.$refs['console' + index][0].reconnect()
|
this.$refs['console' + index][0].reconnect()
|
||||||
},
|
},
|
||||||
showFileDir (item, index) {
|
showFileDir (item, index) {
|
||||||
@@ -660,6 +659,11 @@ export default {
|
|||||||
},
|
},
|
||||||
closeShell (item, index) {
|
closeShell (item, index) {
|
||||||
this.removeTab(item.name)
|
this.removeTab(item.name)
|
||||||
|
},
|
||||||
|
sendMessage (message) {
|
||||||
|
this.editableTabs.forEach((item, index) => {
|
||||||
|
this.$refs['console' + index][0].enterStr(message)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
console.log(this.$router, this.$route)
|
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
localStorage.removeItem('moduleProjectId')
|
localStorage.removeItem('moduleProjectId')
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import vm from '../../../../entrance/app/main'
|
|||||||
import exportHtml from '../../../../entrance/exportHtml/exportHtml'
|
import exportHtml from '../../../../entrance/exportHtml/exportHtml'
|
||||||
// const vm = window.dataJson ? exportHtml : app
|
// const vm = window.dataJson ? exportHtml : app
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
console.log(123213)
|
|
||||||
if (!window.dataJson) {
|
if (!window.dataJson) {
|
||||||
commonOption.toolbox.feature.dataZoom.title.zoom = vm.$i18n.t('overall.toolBox.zoom')
|
commonOption.toolbox.feature.dataZoom.title.zoom = vm.$i18n.t('overall.toolBox.zoom')
|
||||||
commonOption.toolbox.feature.dataZoom.title.back = vm.$i18n.t('overall.toolBox.back')
|
commonOption.toolbox.feature.dataZoom.title.back = vm.$i18n.t('overall.toolBox.back')
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ const terminalFile = {
|
|||||||
if (!state.messageFunction) {
|
if (!state.messageFunction) {
|
||||||
state.messageFunction = true
|
state.messageFunction = true
|
||||||
window.addEventListener('message', function (e) {
|
window.addEventListener('message', function (e) {
|
||||||
console.log(e)
|
|
||||||
const data = JSON.parse(e.data) // e.data 里面有自己所传的所有参数 可以根据参数做自己的判断
|
const data = JSON.parse(e.data) // e.data 里面有自己所传的所有参数 可以根据参数做自己的判断
|
||||||
if (data.close) {
|
if (data.close) {
|
||||||
state.externalTerminal = false
|
state.externalTerminal = false
|
||||||
@@ -39,11 +38,8 @@ const terminalFile = {
|
|||||||
state.externalTerminalWindow = ''
|
state.externalTerminalWindow = ''
|
||||||
}
|
}
|
||||||
if (item && state.externalTerminal) {
|
if (item && state.externalTerminal) {
|
||||||
console.log('onloda', state.externalTerminalWindow)
|
|
||||||
state.externalTerminalWindow.addEventListener('load', () => {
|
state.externalTerminalWindow.addEventListener('load', () => {
|
||||||
console.log(123123123123123)
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log('time')
|
|
||||||
state.externalTerminalWindow.postMessage(
|
state.externalTerminalWindow.postMessage(
|
||||||
JSON.stringify(item)
|
JSON.stringify(item)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user