Session detail view link

This commit is contained in:
Eric
2020-04-09 19:30:46 +08:00
parent 95a373ae68
commit a1959fd44a
9 changed files with 68 additions and 9 deletions

View File

@@ -0,0 +1,23 @@
<template>
<el-link class="detail" :type="col.type || 'success'" @click="goDetail">{{ col.linkName }}</el-link>
</template>
<script>
import BaseFormatter from './base'
export default {
name: 'RouterFormatter',
extends: BaseFormatter,
methods: {
goDetail() {
const routeName = this.col.route || ''
this.$router.push({ name: routeName, params: { id: this.cellValue }})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -4,3 +4,5 @@ export { default as BooleanFormatter } from './ChoicesFormatter'
export { default as ActionsFormatter } from './ActionsFormatter'
export { default as ExpandPreFormatter } from './ExpandPreFormatter'
export { default as LengthFormatter } from './LengthFormatter'
export { default as RouterFormatter } from './RouterFormatter'
export { default as OutputExpandFormatter } from './OutputExpandFormatter'

View File

@@ -87,6 +87,7 @@ const cn = {
'Sessions': '会话管理',
'SessionOnline': '在线会话',
'SessionOffline': '历史会话',
'SessionDetail': '会话详情',
'Commands': '命令记录',
'WebTerminal': 'Web终端',
'FileManager': '文件管理',
@@ -380,7 +381,8 @@ const cn = {
'active': '激活中',
'alive': '在线',
'StorageConfiguration': '存储配置',
'join': '加入'
'join': '加入',
'goto': '转到'
},
jobcenter: {
'RunTimes': '执行次数',

View File

@@ -18,7 +18,11 @@ const en = {
'assets': 'Assets',
'applications': 'Applications',
'perms': 'Perms',
'sessions': 'Sessions',
'Sessions': 'Sessions',
'SessionOnline': 'Session Online',
'SessionOffline': 'Session Offline',
'SessionDetail': 'Session Detail',
'Goto': 'Goto',
'jobcenter': 'Job Center'
},
users: {
@@ -289,7 +293,8 @@ const en = {
'terminate_session': 'Terminate session',
'confirm': 'Confirm',
'commands': 'Commands',
'join': 'join'
'join': 'join',
'goto': 'Goto'
},
setting: {
'setting': 'System Setting',

View File

@@ -274,6 +274,13 @@ export const constantRoutes = [
component: () => import('@/views/sessions/CommandList'),
meta: { title: 'Commands' }
},
{
path: 'sessions/:id',
name: 'SessionDetail',
component: () => import('@/views/sessions/SessionDetail'),
meta: { title: 'SessionDetail' },
hidden: true
},
{
path: 'luna',
name: 'WebTerminal',

View File

@@ -5,7 +5,7 @@
<script>
import { GenericListPage } from '@/layout/components'
import { toSafeLocalDateStr } from '@/utils/common'
import OutputExpandFormatter from '@/components/ListTable/formatters/OutputExpandFormatter'
import { RouterFormatter, OutputExpandFormatter } from '@/components/ListTable/formatters'
export default {
components: {
@@ -42,7 +42,10 @@ export default {
label: this.$t('sessions.systemUser')
},
session: {
label: this.$t('sessions.session')
label: this.$t('sessions.session'),
formatter: RouterFormatter,
route: 'SessionDetail',
linkName: this.$t('sessions.goto')
},
timestamp: {
label: this.$t('sessions.date'),

View File

@@ -0,0 +1,13 @@
<template>
<div>SessionDetail</div>
</template>
<script>
export default {
name: 'SessionDetail'
}
</script>
<style scoped>
</style>

View File

@@ -22,8 +22,10 @@ export default {
],
columnsMeta: {
index: {
type: 'index',
label: this.$t('sessions.id')
label: this.$t('sessions.id'),
formatter: function(row, column, cellValue, index) {
return <a class='detail el-link el-link--success is-underline' href= { '/terminal/sessions/' + row.id }>{ index + 1}</a>
}
},
command_amount: {
label: this.$t('sessions.command')

View File

@@ -22,8 +22,10 @@ export default {
],
columnsMeta: {
index: {
type: 'index',
label: this.$t('sessions.id')
label: this.$t('sessions.id'),
formatter: function(row, column, cellValue, index) {
return <a class='detail el-link el-link--success is-underline' href= { '/terminal/sessions/' + row.id }>{ index + 1}</a>
}
},
command_amount: {
label: this.$t('sessions.command')