mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-26 15:07:04 +00:00
feat: 支持暂停会话操作
This commit is contained in:
@@ -8,24 +8,11 @@ export function terminateSession(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSessionDetail(id) {
|
export function toggleLockSession(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/api/v1/terminal/sessions/${id}/`,
|
url: '/api/v1/terminal/tasks/toggle-lock-session/',
|
||||||
method: 'get'
|
method: 'post',
|
||||||
})
|
data: data
|
||||||
}
|
|
||||||
|
|
||||||
export function getSessionCommands(id) {
|
|
||||||
return request({
|
|
||||||
url: `/api/v1/terminal/commands/?session_id=${id}`,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getTerminalDetail(id) {
|
|
||||||
return request({
|
|
||||||
url: `/api/v1/terminal/terminals/${id}/`,
|
|
||||||
method: 'get'
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1484,6 +1484,8 @@
|
|||||||
"terminalUpdate": "Update terminal",
|
"terminalUpdate": "Update terminal",
|
||||||
"terminalUpdateStorage": "Update terminal storage",
|
"terminalUpdateStorage": "Update terminal storage",
|
||||||
"terminate": "Terminate",
|
"terminate": "Terminate",
|
||||||
|
"resume": "Resume",
|
||||||
|
"pause": "Pause",
|
||||||
"sessionTerminate": "Session Terminate",
|
"sessionTerminate": "Session Terminate",
|
||||||
"test": "Test",
|
"test": "Test",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
@@ -1499,6 +1501,8 @@
|
|||||||
"RazorNotSupport": "RDP Client session not support now",
|
"RazorNotSupport": "RDP Client session not support now",
|
||||||
"sessionMonitor": "Session Monitor",
|
"sessionMonitor": "Session Monitor",
|
||||||
"TerminateTaskSendSuccessMsg": "Terminate task has been send, Please check later",
|
"TerminateTaskSendSuccessMsg": "Terminate task has been send, Please check later",
|
||||||
|
"PauseTaskSendSuccessMsg": "Pause task has been send, Please check later",
|
||||||
|
"ResumeTaskSendSuccessMsg": "Resume task has been send, Please check later",
|
||||||
"helpText": {
|
"helpText": {
|
||||||
"esUrl": "Tip: If you have multiple hosts, use comma (, ) to split (eg: http://www.jumpserver.a.com, http://www.jumpserver.b.com)",
|
"esUrl": "Tip: If you have multiple hosts, use comma (, ) to split (eg: http://www.jumpserver.a.com, http://www.jumpserver.b.com)",
|
||||||
"esIndex": "Es provides the default index: jumpserver. If you choose to build an index by date, this blank is the index prefix",
|
"esIndex": "Es provides the default index: jumpserver. If you choose to build an index by date, this blank is the index prefix",
|
||||||
|
@@ -1479,6 +1479,8 @@
|
|||||||
"terminalUpdate": "端末の更新",
|
"terminalUpdate": "端末の更新",
|
||||||
"terminalUpdateStorage": "端末ストレージの更新",
|
"terminalUpdateStorage": "端末ストレージの更新",
|
||||||
"terminate": "終断",
|
"terminate": "終断",
|
||||||
|
"resume": "再開",
|
||||||
|
"pause": "一時停止",
|
||||||
"sessionTerminate": "会話が終わる",
|
"sessionTerminate": "会話が終わる",
|
||||||
"test": "テスト",
|
"test": "テスト",
|
||||||
"type": "タイプ",
|
"type": "タイプ",
|
||||||
@@ -1494,6 +1496,8 @@
|
|||||||
"RazorNotSupport": "RDPクライアントセッションは、監視をサポートしていません",
|
"RazorNotSupport": "RDPクライアントセッションは、監視をサポートしていません",
|
||||||
"sessionMonitor": "モニタリング",
|
"sessionMonitor": "モニタリング",
|
||||||
"TerminateTaskSendSuccessMsg": "最終タスクが発行されました。後で更新して確認してください。",
|
"TerminateTaskSendSuccessMsg": "最終タスクが発行されました。後で更新して確認してください。",
|
||||||
|
"PauseTaskSendSuccessMsg": "一時停止タスクが発行されました。後で更新して確認してください。",
|
||||||
|
"ResumeTaskSendSuccessMsg": "再開タスクが発行されました。後で更新して確認してください。",
|
||||||
"helpText": {
|
"helpText": {
|
||||||
"esUrl": "ヒント: 複数のホストがある場合は、カンマ ( , ) で分割します。 (Eg: http://www.jumpserver.a.com:3000、http://www.jumpserver.b.com:3000)",
|
"esUrl": "ヒント: 複数のホストがある場合は、カンマ ( , ) で分割します。 (Eg: http://www.jumpserver.a.com:3000、http://www.jumpserver.b.com:3000)",
|
||||||
"esIndex": "Esはデフォルトindexを提供します。日付による索引の作成を選択した場合、この空は索引接頭辞です。",
|
"esIndex": "Esはデフォルトindexを提供します。日付による索引の作成を選択した場合、この空は索引接頭辞です。",
|
||||||
|
@@ -1468,6 +1468,8 @@
|
|||||||
"terminalUpdate": "更新终端",
|
"terminalUpdate": "更新终端",
|
||||||
"terminalUpdateStorage": "更新终端存储",
|
"terminalUpdateStorage": "更新终端存储",
|
||||||
"terminate": "终断",
|
"terminate": "终断",
|
||||||
|
"resume": "恢复",
|
||||||
|
"pause": "暂停",
|
||||||
"sessionTerminate": "会话终断",
|
"sessionTerminate": "会话终断",
|
||||||
"test": "测试",
|
"test": "测试",
|
||||||
"type": "类型",
|
"type": "类型",
|
||||||
@@ -1483,6 +1485,8 @@
|
|||||||
"RazorNotSupport": "RDP 客户端会话, 暂不支持监控",
|
"RazorNotSupport": "RDP 客户端会话, 暂不支持监控",
|
||||||
"sessionMonitor": "监控",
|
"sessionMonitor": "监控",
|
||||||
"TerminateTaskSendSuccessMsg": "终断任务已下发,请稍后刷新查看",
|
"TerminateTaskSendSuccessMsg": "终断任务已下发,请稍后刷新查看",
|
||||||
|
"PauseTaskSendSuccessMsg": "暂停任务已下发,请稍后刷新查看",
|
||||||
|
"ResumeTaskSendSuccessMsg": "恢复任务已下发,请稍后刷新查看",
|
||||||
"helpText": {
|
"helpText": {
|
||||||
"esUrl": "提示:如果有多台主机,请使用逗号 ( , ) 进行分割。(eg: http://www.jumpserver.a.com:3000,http://www.jumpserver.b.com:3000)",
|
"esUrl": "提示:如果有多台主机,请使用逗号 ( , ) 进行分割。(eg: http://www.jumpserver.a.com:3000,http://www.jumpserver.b.com:3000)",
|
||||||
"esIndex": "es 提供默认 index:jumpserver。如果开启按日期建立索引,那么输入的值会作为索引前缀",
|
"esIndex": "es 提供默认 index:jumpserver。如果开启按日期建立索引,那么输入的值会作为索引前缀",
|
||||||
|
@@ -32,7 +32,8 @@ export default {
|
|||||||
min: ['id', 'actions'],
|
min: ['id', 'actions'],
|
||||||
default: [
|
default: [
|
||||||
'id', 'user', 'asset', 'account', 'remote_addr', 'protocol', 'login_from',
|
'id', 'user', 'asset', 'account', 'remote_addr', 'protocol', 'login_from',
|
||||||
'command_amount', 'date_start', 'duration', 'terminal_display', 'actions'
|
'command_amount', 'date_start', 'duration', 'terminal_display', 'actions',
|
||||||
|
'is_locked'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseList from './BaseList'
|
import BaseList from './BaseList'
|
||||||
import { terminateSession } from '@/api/sessions'
|
import { terminateSession, toggleLockSession } from '@/api/sessions'
|
||||||
export default {
|
export default {
|
||||||
name: 'OnlineList',
|
name: 'OnlineList',
|
||||||
components: {
|
components: {
|
||||||
@@ -33,6 +33,47 @@ export default {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'pause',
|
||||||
|
title: this.$t('sessions.pause'),
|
||||||
|
type: 'warning',
|
||||||
|
can: ({ row }) => row['can_join'] && vm.$hasPerm('terminal.terminate_session'),
|
||||||
|
has: ({ row }) => !row['is_locked'],
|
||||||
|
callback: function({ reload, row }) {
|
||||||
|
const data = {
|
||||||
|
'session_id': row.id,
|
||||||
|
'task_name': 'lock_session'
|
||||||
|
}
|
||||||
|
toggleLockSession(data).then(res => {
|
||||||
|
const msg = vm.$t('sessions.PauseTaskSendSuccessMsg')
|
||||||
|
this.$message.success(msg)
|
||||||
|
window.setTimeout(function() {
|
||||||
|
reload()
|
||||||
|
}, 50000)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'resume',
|
||||||
|
title: this.$t('sessions.resume'),
|
||||||
|
type: 'warning',
|
||||||
|
can: ({ row }) => row['can_join'] && vm.$hasPerm('terminal.terminate_session'),
|
||||||
|
has: ({ row }) => row['is_locked'],
|
||||||
|
callback: function({ reload, row }) {
|
||||||
|
const data = {
|
||||||
|
'session_id': row.id,
|
||||||
|
'task_name': 'unlock_session'
|
||||||
|
}
|
||||||
|
toggleLockSession(data).then(res => {
|
||||||
|
const msg = vm.$t('sessions.ResumeTaskSendSuccessMsg')
|
||||||
|
this.$message.success(msg)
|
||||||
|
window.setTimeout(function() {
|
||||||
|
reload()
|
||||||
|
}, 50000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'join',
|
name: 'join',
|
||||||
title: this.$t('sessions.Monitor'),
|
title: this.$t('sessions.Monitor'),
|
||||||
|
@@ -42,6 +42,19 @@
|
|||||||
>
|
>
|
||||||
{{ $t('sessions.terminate') }}
|
{{ $t('sessions.terminate') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
size="small"
|
||||||
|
:disabled="!session.can_join"
|
||||||
|
@click="onToggleLock"
|
||||||
|
>
|
||||||
|
<template v-if="session.is_locked">
|
||||||
|
{{ $t('sessions.resume') }}
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ $t('sessions.pause') }}
|
||||||
|
</template>
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -117,6 +130,25 @@ export default {
|
|||||||
onMonitor() {
|
onMonitor() {
|
||||||
const joinUrl = `/luna/monitor/${this.session.id}`
|
const joinUrl = `/luna/monitor/${this.session.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=800, 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/'
|
||||||
|
const task_name = this.session.is_locked ? 'unlock_session' : 'lock_session'
|
||||||
|
const data = {
|
||||||
|
'session_id': this.session.id,
|
||||||
|
'task_name': task_name
|
||||||
|
}
|
||||||
|
const resumeMsg = this.$tc('sessions.ResumeTaskSendSuccessMsg')
|
||||||
|
const pauseMsg = this.$tc('sessions.PauseTaskSendSuccessMsg')
|
||||||
|
const msg = this.session.is_locked ? resumeMsg : pauseMsg
|
||||||
|
this.$axios.post(url, data).then(res => {
|
||||||
|
this.$message.success(msg)
|
||||||
|
this.curTimer = setTimeout(() => {
|
||||||
|
this.init()
|
||||||
|
}, 50000)
|
||||||
|
}).catch(err => {
|
||||||
|
this.$message.error(err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user