mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
perf: 优化会话暂停的组件判断
This commit is contained in:
@@ -152,6 +152,6 @@ export function toM2MJsonParams(attrFilter) {
|
||||
}
|
||||
|
||||
export function IsSupportPauseSessionType(terminalType) {
|
||||
const supportedType = ['koko', 'lion', 'magnus', 'chen', 'kael']
|
||||
const supportedType = ['koko', 'lion', 'chen', 'kael']
|
||||
return supportedType.includes(terminalType)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ export default {
|
||||
type: 'warning',
|
||||
can: ({ row }) => {
|
||||
const terminalType = row['terminal']['type']
|
||||
const supportedType = IsSupportPauseSessionType(terminalType)
|
||||
const isNormalSession = row['type']['value'] === 'normal'
|
||||
const supportedType = IsSupportPauseSessionType(terminalType) && isNormalSession
|
||||
return supportedType && vm.$hasPerm('terminal.terminate_session')
|
||||
},
|
||||
has: ({ row }) => !row['is_locked'],
|
||||
@@ -63,7 +64,8 @@ export default {
|
||||
type: 'warning',
|
||||
can: ({ row }) => {
|
||||
const terminalType = row['terminal']['type']
|
||||
const supportedType = IsSupportPauseSessionType(terminalType)
|
||||
const isNormalSession = row['type']['value'] === 'normal'
|
||||
const supportedType = IsSupportPauseSessionType(terminalType) && isNormalSession
|
||||
return supportedType && vm.$hasPerm('terminal.terminate_session')
|
||||
},
|
||||
has: ({ row }) => row['is_locked'],
|
||||
@@ -94,7 +96,7 @@ export default {
|
||||
},
|
||||
callback: function({ row, tableData }) {
|
||||
const monitorUrl = '/luna/monitor/' + row.id
|
||||
window.open(monitorUrl, '_blank', 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')
|
||||
window.open(monitorUrl, '_blank', 'height=600, width=850, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -109,7 +109,8 @@ export default {
|
||||
}).then(res => {
|
||||
this.session = res || {}
|
||||
const terminalType = res['terminal']['type']
|
||||
this.supportedLock = IsSupportPauseSessionType(terminalType)
|
||||
const isNormalSession = res['type']['value'] === 'normal'
|
||||
this.supportedLock = IsSupportPauseSessionType(terminalType) && isNormalSession
|
||||
}).catch(err => {
|
||||
this.curTimer = setTimeout(() => {
|
||||
this.init()
|
||||
@@ -133,7 +134,7 @@ export default {
|
||||
},
|
||||
onMonitor() {
|
||||
const joinUrl = `/luna/monitor/${this.session.id}?ticket_id=${this.object.id}`
|
||||
window.open(joinUrl, 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')
|
||||
window.open(joinUrl, 'height=600, width=850, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')
|
||||
},
|
||||
onToggleLock() {
|
||||
const url = '/api/v1/terminal/tasks/toggle-lock-session-for-ticket/'
|
||||
|
||||
Reference in New Issue
Block a user