From 3ba81a43cb26cc1f2168ee39597f49422aabad98 Mon Sep 17 00:00:00 2001
From: fit2bot <68588906+fit2bot@users.noreply.github.com>
Date: Mon, 4 Dec 2023 15:20:57 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B5=84=E4=BA=A7=E8=AF=A6=E6=83=85?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E5=8E=86=E5=8F=B2=E6=89=A7?=
=?UTF-8?q?=E8=A1=8C=E5=91=BD=E4=BB=A4=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=20(#3568)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat: 资产详情页面添加历史执行命令列表页面
---------
Co-authored-by: wangruidong <940853815@qq.com>
---
src/router/audit/sessions.js | 2 +-
src/router/console/sessions.js | 2 +-
.../assets/Asset/AssetDetail/AssetCommand.vue | 31 +++++++++++++++++++
.../assets/Asset/AssetDetail/AssetSession.vue | 30 ++++++++++++++++++
src/views/assets/Asset/AssetDetail/index.vue | 16 +++++++++-
.../BaseList.vue} | 30 +++++++++++-------
src/views/sessions/CommandList/index.vue | 27 ++++++++++++++++
src/views/sessions/SessionList/BaseList.vue | 20 +++++++-----
.../users/User/UserDetail/UserSession.vue | 15 ++++++---
9 files changed, 148 insertions(+), 25 deletions(-)
create mode 100644 src/views/assets/Asset/AssetDetail/AssetCommand.vue
create mode 100644 src/views/assets/Asset/AssetDetail/AssetSession.vue
rename src/views/sessions/{CommandList.vue => CommandList/BaseList.vue} (92%)
create mode 100644 src/views/sessions/CommandList/index.vue
diff --git a/src/router/audit/sessions.js b/src/router/audit/sessions.js
index c84ae812f..5675ec732 100644
--- a/src/router/audit/sessions.js
+++ b/src/router/audit/sessions.js
@@ -34,7 +34,7 @@ export default [
{
path: 'command',
name: 'CommandList',
- component: () => import('@/views/sessions/CommandList'),
+ component: () => import('@/views/sessions/CommandList/index'),
meta: {
title: i18n.t('route.Commands'),
permissions: ['terminal.view_command']
diff --git a/src/router/console/sessions.js b/src/router/console/sessions.js
index 6997519c3..bec33ed55 100644
--- a/src/router/console/sessions.js
+++ b/src/router/console/sessions.js
@@ -26,7 +26,7 @@ export default [
{
path: 'commands',
name: 'CommandList',
- component: () => import('@/views/sessions/CommandList'),
+ component: () => import('@/views/sessions/CommandList/index'),
meta: { title: i18n.t('route.Commands'), permissions: [] }
},
{
diff --git a/src/views/assets/Asset/AssetDetail/AssetCommand.vue b/src/views/assets/Asset/AssetDetail/AssetCommand.vue
new file mode 100644
index 000000000..fda0e783d
--- /dev/null
+++ b/src/views/assets/Asset/AssetDetail/AssetCommand.vue
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/views/assets/Asset/AssetDetail/AssetSession.vue b/src/views/assets/Asset/AssetDetail/AssetSession.vue
new file mode 100644
index 000000000..88e747568
--- /dev/null
+++ b/src/views/assets/Asset/AssetDetail/AssetSession.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/views/assets/Asset/AssetDetail/index.vue b/src/views/assets/Asset/AssetDetail/index.vue
index 293e7d0cf..5462c2d2a 100644
--- a/src/views/assets/Asset/AssetDetail/index.vue
+++ b/src/views/assets/Asset/AssetDetail/index.vue
@@ -16,6 +16,8 @@ import { GenericDetailPage, TabPage } from '@/layout/components'
import Detail from './Detail.vue'
import Account from './Account.vue'
import PermUserList from './PermUser.vue'
+import AssetSession from './AssetSession.vue'
+import AssetCommand from './AssetCommand.vue'
export default {
name: 'AssetListDetail',
@@ -24,7 +26,9 @@ export default {
TabPage,
Detail,
Account,
- PermUserList
+ PermUserList,
+ AssetSession,
+ AssetCommand
},
data() {
return {
@@ -45,6 +49,16 @@ export default {
title: this.$t('assets.PermUserList'),
name: 'PermUserList',
hidden: () => !this.$hasPerm('perms.view_assetpermission')
+ },
+ {
+ title: this.$t('route.SessionList'),
+ name: 'AssetSession',
+ hidden: () => !this.$hasPerm('terminal.view_session')
+ },
+ {
+ title: this.$t('route.Commands'),
+ name: 'AssetCommand',
+ hidden: () => !this.$hasPerm('terminal.view_command')
}
],
hasRightSide: true,
diff --git a/src/views/sessions/CommandList.vue b/src/views/sessions/CommandList/BaseList.vue
similarity index 92%
rename from src/views/sessions/CommandList.vue
rename to src/views/sessions/CommandList/BaseList.vue
index 5f58fed44..72fc2b419 100644
--- a/src/views/sessions/CommandList.vue
+++ b/src/views/sessions/CommandList/BaseList.vue
@@ -1,6 +1,6 @@
-
diff --git a/src/views/sessions/SessionList/BaseList.vue b/src/views/sessions/SessionList/BaseList.vue
index 9d6794342..2e8bb6764 100644
--- a/src/views/sessions/SessionList/BaseList.vue
+++ b/src/views/sessions/SessionList/BaseList.vue
@@ -20,6 +20,18 @@ export default {
extraActions: {
type: Array,
default: () => []
+ },
+ columnsShow: {
+ type: Object,
+ default: () => {
+ return {
+ min: ['id', 'actions'],
+ default: [
+ 'id', 'user', 'asset', 'account', 'remote_addr', 'protocol',
+ 'command_amount', 'date_start', 'duration', 'actions'
+ ]
+ }
+ }
}
},
data() {
@@ -28,13 +40,7 @@ export default {
url: this.url,
columnsExtra: ['index', 'duration'],
columnsExclude: ['terminal'],
- columnsShow: {
- min: ['id', 'actions'],
- default: [
- 'id', 'user', 'asset', 'account', 'remote_addr', 'protocol',
- 'command_amount', 'date_start', 'duration', 'actions'
- ]
- },
+ columnsShow: this.columnsShow,
columnsMeta: {
id: {
prop: 'id',
diff --git a/src/views/users/User/UserDetail/UserSession.vue b/src/views/users/User/UserDetail/UserSession.vue
index b3334a1d1..1fa0f1016 100644
--- a/src/views/users/User/UserDetail/UserSession.vue
+++ b/src/views/users/User/UserDetail/UserSession.vue
@@ -1,18 +1,18 @@
-
+