mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-01 23:18:17 +00:00
perf: 优化代码
This commit is contained in:
parent
f042692dbf
commit
cc60f2c1f5
@ -150,3 +150,8 @@ export function toM2MJsonParams(attrFilter) {
|
||||
const data = encoder.encode(JSON.stringify(attrFilter))
|
||||
return ['attr_rules', encodeURIComponent(btoa(String.fromCharCode(...data)))]
|
||||
}
|
||||
|
||||
export function IsSupportPauseSessionType(terminalType) {
|
||||
const supportedType = ['koko', 'lion', 'magnus', 'chen', 'kael']
|
||||
return supportedType.includes(terminalType)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
<script>
|
||||
import BaseList from './BaseList'
|
||||
import { terminateSession, toggleLockSession } from '@/api/sessions'
|
||||
import { IsSupportPauseSessionType } from '@/utils/jms'
|
||||
export default {
|
||||
name: 'OnlineList',
|
||||
components: {
|
||||
@ -39,8 +40,7 @@ export default {
|
||||
type: 'warning',
|
||||
can: ({ row }) => {
|
||||
const terminalType = row['terminal']['type']
|
||||
const supportedType = ['koko', 'lion', 'magnus', 'chen', 'kael']
|
||||
.includes(terminalType)
|
||||
const supportedType = IsSupportPauseSessionType(terminalType)
|
||||
return supportedType && vm.$hasPerm('terminal.terminate_session')
|
||||
},
|
||||
has: ({ row }) => !row['is_locked'],
|
||||
@ -63,8 +63,7 @@ export default {
|
||||
type: 'warning',
|
||||
can: ({ row }) => {
|
||||
const terminalType = row['terminal']['type']
|
||||
const supportedType = ['koko', 'lion', 'magnus', 'chen', 'kael']
|
||||
.includes(terminalType)
|
||||
const supportedType = IsSupportPauseSessionType(terminalType)
|
||||
return supportedType && vm.$hasPerm('terminal.terminate_session')
|
||||
},
|
||||
has: ({ row }) => row['is_locked'],
|
||||
|
@ -69,6 +69,7 @@
|
||||
|
||||
<script>
|
||||
import IBox from '@/components/IBox'
|
||||
import { IsSupportPauseSessionType } from '@/utils/jms'
|
||||
|
||||
export default {
|
||||
components: { IBox },
|
||||
@ -108,8 +109,7 @@ export default {
|
||||
}).then(res => {
|
||||
this.session = res || {}
|
||||
const terminalType = res['terminal']['type']
|
||||
this.supportedLock = ['koko', 'lion', 'magnus', 'chen', 'kael']
|
||||
.includes(terminalType)
|
||||
this.supportedLock = IsSupportPauseSessionType(terminalType)
|
||||
}).catch(err => {
|
||||
this.curTimer = setTimeout(() => {
|
||||
this.init()
|
||||
|
Loading…
Reference in New Issue
Block a user