mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-20 10:46:35 +00:00
[Update] merge
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<pre style="border: none; background: none; white-space: pre-wrap">
|
||||||
|
{{ '$ '+ row.input }}
|
||||||
|
<br>
|
||||||
|
{{ row.output }}
|
||||||
|
</pre>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseFormatter from '@/components/ListTable/formatters/base'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'OutputExpandFormatter',
|
||||||
|
extends: BaseFormatter
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
23
src/components/ListTable/formatters/RouterFormatter.vue
Normal file
23
src/components/ListTable/formatters/RouterFormatter.vue
Normal 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>
|
@@ -5,14 +5,7 @@ import ActionsFormatter from './ActionsFormatter'
|
|||||||
import ExpandPreFormatter from './ExpandPreFormatter'
|
import ExpandPreFormatter from './ExpandPreFormatter'
|
||||||
import LengthFormatter from './LengthFormatter'
|
import LengthFormatter from './LengthFormatter'
|
||||||
|
|
||||||
// export { default as DetailFormatter } from './DetailFormatter'
|
export default {
|
||||||
// export { default as DisplayFormatter } from './DisplayFormatter'
|
|
||||||
// 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 const modules = {
|
|
||||||
DetailFormatter,
|
DetailFormatter,
|
||||||
DisplayFormatter,
|
DisplayFormatter,
|
||||||
BooleanFormatter,
|
BooleanFormatter,
|
||||||
@@ -21,7 +14,6 @@ export const modules = {
|
|||||||
LengthFormatter
|
LengthFormatter
|
||||||
}
|
}
|
||||||
|
|
||||||
export default modules
|
|
||||||
export {
|
export {
|
||||||
DetailFormatter,
|
DetailFormatter,
|
||||||
DisplayFormatter,
|
DisplayFormatter,
|
||||||
|
@@ -90,6 +90,7 @@ const cn = {
|
|||||||
'Sessions': '会话管理',
|
'Sessions': '会话管理',
|
||||||
'SessionOnline': '在线会话',
|
'SessionOnline': '在线会话',
|
||||||
'SessionOffline': '历史会话',
|
'SessionOffline': '历史会话',
|
||||||
|
'SessionDetail': '会话详情',
|
||||||
'Commands': '命令记录',
|
'Commands': '命令记录',
|
||||||
'WebTerminal': 'Web终端',
|
'WebTerminal': 'Web终端',
|
||||||
'FileManager': '文件管理',
|
'FileManager': '文件管理',
|
||||||
@@ -384,14 +385,15 @@ const cn = {
|
|||||||
'active': '激活中',
|
'active': '激活中',
|
||||||
'alive': '在线',
|
'alive': '在线',
|
||||||
'StorageConfiguration': '存储配置',
|
'StorageConfiguration': '存储配置',
|
||||||
'join': '加入'
|
'join': '加入',
|
||||||
|
'goto': '转到'
|
||||||
},
|
},
|
||||||
jobcenter: {
|
jobcenter: {
|
||||||
'RunTimes': '执行次数',
|
'RunTimes': '执行次数',
|
||||||
'hosts': '主机',
|
'Hosts': '主机',
|
||||||
'success': '成功',
|
'Success': '成功',
|
||||||
'date': '日期',
|
'Date': '日期',
|
||||||
'time': '时间',
|
'Time': '时间',
|
||||||
'run': '执行'
|
'run': '执行'
|
||||||
},
|
},
|
||||||
tickets: {
|
tickets: {
|
||||||
|
@@ -18,7 +18,11 @@ const en = {
|
|||||||
'assets': 'Assets',
|
'assets': 'Assets',
|
||||||
'applications': 'Applications',
|
'applications': 'Applications',
|
||||||
'perms': 'Perms',
|
'perms': 'Perms',
|
||||||
'sessions': 'Sessions',
|
'Sessions': 'Sessions',
|
||||||
|
'SessionOnline': 'Session Online',
|
||||||
|
'SessionOffline': 'Session Offline',
|
||||||
|
'SessionDetail': 'Session Detail',
|
||||||
|
'Goto': 'Goto',
|
||||||
'jobcenter': 'Job Center'
|
'jobcenter': 'Job Center'
|
||||||
},
|
},
|
||||||
users: {
|
users: {
|
||||||
@@ -289,7 +293,8 @@ const en = {
|
|||||||
'terminate_session': 'Terminate session',
|
'terminate_session': 'Terminate session',
|
||||||
'confirm': 'Confirm',
|
'confirm': 'Confirm',
|
||||||
'commands': 'Commands',
|
'commands': 'Commands',
|
||||||
'join': 'join'
|
'join': 'join',
|
||||||
|
'goto': 'Goto'
|
||||||
},
|
},
|
||||||
setting: {
|
setting: {
|
||||||
'setting': 'System Setting',
|
'setting': 'System Setting',
|
||||||
|
@@ -274,6 +274,13 @@ export const constantRoutes = [
|
|||||||
component: () => import('@/views/sessions/CommandList'),
|
component: () => import('@/views/sessions/CommandList'),
|
||||||
meta: { title: 'Commands' }
|
meta: { title: 'Commands' }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'sessions/:id',
|
||||||
|
name: 'SessionDetail',
|
||||||
|
component: () => import('@/views/sessions/SessionDetail'),
|
||||||
|
meta: { title: 'SessionDetail' },
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'luna',
|
path: 'luna',
|
||||||
name: 'WebTerminal',
|
name: 'WebTerminal',
|
||||||
|
@@ -3,8 +3,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { timeOffset, toSafeLocalDateStr } from '@/utils/common'
|
||||||
import { GenericListPage } from '@/layout/components'
|
import { GenericListPage } from '@/layout/components'
|
||||||
import { DetailFormatter, ActionsFormatter } from '@/components/ListTable/formatters/index'
|
import { ActionsFormatter } from '@/components/ListTable/formatters/index'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -14,47 +15,71 @@ export default {
|
|||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/ops/tasks/',
|
url: '/api/v1/ops/tasks/',
|
||||||
columns: [
|
columns: ['name', 'runtimes', 'host_amount', 'is_success', 'date_start', 'time', 'actions'],
|
||||||
{
|
columnsMeta: {
|
||||||
prop: 'name',
|
name: {
|
||||||
label: this.$tc('Name'),
|
label: this.$tc('Name'),
|
||||||
formatter: DetailFormatter,
|
showOverflowTooltip: true
|
||||||
sortable: 'custom',
|
|
||||||
route: 'UserDetail'
|
|
||||||
},
|
},
|
||||||
{
|
runtimes: {
|
||||||
prop: 'latest_execution',
|
label: this.$t('jobcenter.RunTimes'),
|
||||||
label: this.$t('jobcenter.RunTimes')
|
formatter: function(row) {
|
||||||
|
const summary = <div>
|
||||||
|
<span class='text-primary'>{row.summary.success}</span>/
|
||||||
|
<span class='text-danger'>{row.summary.failed}</span>/
|
||||||
|
<span>{row.summary.total}</span>
|
||||||
|
</div>
|
||||||
|
return summary
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
host_amount: {
|
||||||
prop: 'latest_execution.hosts_amount',
|
label: this.$t('jobcenter.Hosts'),
|
||||||
label: this.$t('jobcenter.hosts')
|
formatter: function(row) {
|
||||||
|
return row.latest_execution.hosts_amount
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
is_success: {
|
||||||
prop: 'latest_execution.is_success',
|
label: this.$t('jobcenter.Success'),
|
||||||
label: this.$t('jobcenter.success')
|
formatter: row => {
|
||||||
|
if (row.latest_execution.is_success) {
|
||||||
|
return <i class='fa fa-check text-primary'/>
|
||||||
|
}
|
||||||
|
return <i class='fa fa-times text-danger'/>
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
date_start: {
|
||||||
prop: 'latest_execution.date_start',
|
label: this.$t('jobcenter.Date'),
|
||||||
label: this.$t('jobcenter.date'),
|
formatter: function(row) {
|
||||||
sortable: 'custom'
|
return toSafeLocalDateStr(row.latest_execution.date_start)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
time: {
|
||||||
prop: 'latest_execution.timedelta',
|
label: this.$t('jobcenter.Time'),
|
||||||
label: this.$t('jobcenter.time')
|
formatter: function(row) {
|
||||||
|
return timeOffset(row.latest_execution.date_start, row.latest_execution.date_finished)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
actions: {
|
||||||
prop: 'id',
|
prop: 'id',
|
||||||
label: this.$tc('Action'),
|
label: this.$tc('Action'),
|
||||||
align: 'center',
|
|
||||||
formatter: ActionsFormatter,
|
formatter: ActionsFormatter,
|
||||||
width: '200px',
|
actions: {
|
||||||
actions: [
|
hasUpdate: false,
|
||||||
|
extraActions: [
|
||||||
|
{
|
||||||
|
name: 'run',
|
||||||
|
title: this.$t('jobcenter.run'),
|
||||||
|
type: 'primary',
|
||||||
|
callback: function({ cellValue, tableData }) {
|
||||||
|
// 跳转页面
|
||||||
|
const replayUrl = '/ops/celery/task/' + cellValue
|
||||||
|
window.open(replayUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
hasEdit: false,
|
}
|
||||||
hasDelete: false
|
|
||||||
},
|
},
|
||||||
headerActions: {
|
headerActions: {
|
||||||
hasCreate: false,
|
hasCreate: false,
|
||||||
|
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { GenericListPage } from '@/layout/components'
|
import { GenericListPage } from '@/layout/components'
|
||||||
|
import { toSafeLocalDateStr } from '@/utils/common'
|
||||||
|
import { RouterFormatter, OutputExpandFormatter } from '@/components/ListTable/formatters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -12,55 +14,47 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
axiosConfig: {
|
|
||||||
raw: 1,
|
|
||||||
params: {
|
|
||||||
display: 1,
|
|
||||||
is_finished: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hasSelection: false,
|
hasSelection: false,
|
||||||
hasOperation: false,
|
|
||||||
url: '/api/v1/terminal/commands/',
|
url: '/api/v1/terminal/commands/',
|
||||||
columns: [
|
columns: [
|
||||||
{
|
'expandCol', 'input', 'risk_level', 'user',
|
||||||
type: 'expand'
|
'asset', 'system_user', 'session', 'timestamp'
|
||||||
|
],
|
||||||
|
columnsMeta: {
|
||||||
|
expandCol: {
|
||||||
|
type: 'expand',
|
||||||
|
prop: 'output',
|
||||||
|
formatter: OutputExpandFormatter
|
||||||
},
|
},
|
||||||
{
|
input: {
|
||||||
prop: 'input',
|
|
||||||
label: this.$t('sessions.command')
|
label: this.$t('sessions.command')
|
||||||
},
|
},
|
||||||
{
|
risk_level: {
|
||||||
prop: 'output',
|
|
||||||
label: '命令输出结果 (怎么放到隐藏内容 ??)',
|
|
||||||
expand: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'risk_level',
|
|
||||||
label: this.$t('sessions.RiskLevel')
|
label: this.$t('sessions.RiskLevel')
|
||||||
},
|
},
|
||||||
{
|
user: {
|
||||||
prop: 'user',
|
label: this.$t('sessions.user')
|
||||||
label: this.$t('sessions.user'),
|
|
||||||
sortable: true
|
|
||||||
},
|
},
|
||||||
{
|
asset: {
|
||||||
prop: 'asset',
|
|
||||||
label: this.$t('sessions.asset')
|
label: this.$t('sessions.asset')
|
||||||
},
|
},
|
||||||
{
|
system_user: {
|
||||||
prop: 'system_user',
|
|
||||||
label: this.$t('sessions.systemUser')
|
label: this.$t('sessions.systemUser')
|
||||||
},
|
},
|
||||||
{
|
session: {
|
||||||
prop: 'session',
|
label: this.$t('sessions.session'),
|
||||||
label: this.$t('sessions.session')
|
formatter: RouterFormatter,
|
||||||
|
route: 'SessionDetail',
|
||||||
|
linkName: this.$t('sessions.goto')
|
||||||
},
|
},
|
||||||
{
|
timestamp: {
|
||||||
prop: 'timestamp',
|
label: this.$t('sessions.date'),
|
||||||
label: this.$t('sessions.date')
|
formatter: function(row) {
|
||||||
|
return toSafeLocalDateStr(row.timestamp * 1000)
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
|
|
||||||
|
},
|
||||||
tableActions: {
|
tableActions: {
|
||||||
hasEdit: false,
|
hasEdit: false,
|
||||||
hasDelete: false
|
hasDelete: false
|
||||||
|
13
src/views/sessions/SessionDetail.vue
Normal file
13
src/views/sessions/SessionDetail.vue
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
<div>SessionDetail</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'SessionDetail'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@@ -22,8 +22,10 @@ export default {
|
|||||||
],
|
],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
index: {
|
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: {
|
command_amount: {
|
||||||
label: this.$t('sessions.command')
|
label: this.$t('sessions.command')
|
||||||
|
@@ -22,8 +22,10 @@ export default {
|
|||||||
],
|
],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
index: {
|
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: {
|
command_amount: {
|
||||||
label: this.$t('sessions.command')
|
label: this.$t('sessions.command')
|
||||||
|
Reference in New Issue
Block a user