fix(SessionList): 修复命令详情参数及在线会话快捷操作组件 (#198)

* fix(SessionList): 修复命令详情参数及在线会话快捷操作组件

Closes https://github.com/jumpserver/trello/issues/72

* fix: 更新API参数
This commit is contained in:
Orange
2020-07-15 18:31:13 +08:00
committed by GitHub
parent a3d45fd4b9
commit c597bc1dca
3 changed files with 71 additions and 24 deletions

View File

@@ -546,6 +546,7 @@
"terminalDetail": "终端详情",
"terminalUpdate": "更新终端",
"terminate": "终断",
"sessionTerminate": "会话终断",
"test": "测试",
"type": "类型",
"user": "用户",
@@ -553,7 +554,8 @@
"common": "普通"
},
"Monitor": "监控",
"TerminateTaskSendSuccessMsg": "终断任务已下发,请稍后刷新表格查看"
"sessionMonitor": "监控",
"TerminateTaskSendSuccessMsg": "终断任务已下发,请稍后刷新查看"
},
"setting": {
"ApiKeyList": "API Key 列表",

View File

@@ -545,6 +545,7 @@
"terminalDetail": "Terminal detail",
"terminalUpdate": "Update terminal",
"terminate": "Terminate",
"sessionTerminate": "Session Terminate",
"test": "Test",
"type": "Type",
"user": "Use",
@@ -552,6 +553,7 @@
"common": "common"
},
"Monitor": "Monitor",
"sessionMonitor": "Session Monitor",
"TerminateTaskSendSuccessMsg": "Terminate task has been send, Please check later"
},
"setting": {

View File

@@ -12,6 +12,7 @@
<script>
import DetailCard from '@/components/DetailCard/index'
import QuickActions from '@/components/QuickActions'
import { terminateSession } from '@/api/sessions'
export default {
name: 'SessionDetailCard',
components: {
@@ -68,33 +69,75 @@ export default {
},
quickActions() {
const vm = this
return [
{
title: this.$t('sessions.replaySession'),
attrs: {
type: 'primary',
label: this.$t('sessions.go')
},
callbacks: {
click: function() {
vm.openReplaySession(vm.sessionData.id)
}
if (vm.sessionData.is_finished) {
return [
{
title: this.$t('sessions.replaySession'),
attrs: {
type: 'primary',
label: this.$t('sessions.go')
},
callbacks: {
click: function() {
vm.openReplaySession(vm.sessionData.id)
}
}
},
{
title: this.$t('sessions.downloadReplay'),
attrs: {
type: 'primary',
label: this.$t('sessions.download')
}
},
callbacks: {
click: function() {
vm.openReplayDownload(vm.sessionData.id)
{
title: this.$t('sessions.downloadReplay'),
attrs: {
type: 'primary',
label: this.$t('sessions.download')
},
callbacks: {
click: function() {
vm.openReplayDownload(vm.sessionData.id)
}
}
}
}
]
]
} else {
return [
{
title: this.$t('sessions.sessionTerminate'),
attrs: {
type: 'danger',
label: this.$t('sessions.terminate')
},
callbacks: {
click: function() {
// 终断 session reload
terminateSession(vm.sessionData.id).then(res => {
const msg = vm.$t('sessions.TerminateTaskSendSuccessMsg')
vm.$message.success(msg)
window.setTimeout(function() {
window.location.reload()
}, 50000)
}
)
}
}
},
{
title: this.$t('sessions.sessionMonitor'),
attrs: {
type: 'primary',
label: this.$t('sessions.Monitor')
},
can: () => {
return vm.sessionData.can_join
},
callbacks: {
click: function() {
// 跳转到luna页面
const joinUrl = '/luna/join/?shareroom=' + vm.sessionData.id
window.open(joinUrl, 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')
}
}
}
]
}
}
},
methods: {