From 0557c41454e57b2347c539f5b233a123c2fdfb80 Mon Sep 17 00:00:00 2001 From: lijiahang Date: Mon, 30 Dec 2024 15:54:07 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E4=B8=BB=E6=9C=BA?= =?UTF-8?q?=E5=88=86=E7=BB=84=E6=8E=88=E6=9D=83=E6=98=BE=E7=A4=BA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../grant/components/host-group-grant.vue | 75 ++++++++++-- .../grant/components/host-identity-grant.vue | 18 +-- .../asset/grant/components/host-key-grant.vue | 12 +- .../asset/grant/components/host-list.vue | 112 ------------------ .../src/views/asset/grant/types/const.ts | 8 +- .../views/asset/grant/types/table.columns.ts | 30 +++++ .../host-group/components/host-transfer.vue | 12 +- .../host-list/components/host-card-list.vue | 2 +- .../asset/host-list/components/host-table.vue | 4 +- .../src/views/asset/host-list/types/const.ts | 1 - .../workplace/components/batch-exec-table.vue | 5 + .../components/terminal-connect-table.vue | 5 + 12 files changed, 140 insertions(+), 144 deletions(-) delete mode 100644 orion-visor-ui/src/views/asset/grant/components/host-list.vue diff --git a/orion-visor-ui/src/views/asset/grant/components/host-group-grant.vue b/orion-visor-ui/src/views/asset/grant/components/host-group-grant.vue index 10cf2476..a8cf7657 100644 --- a/orion-visor-ui/src/views/asset/grant/components/host-group-grant.vue +++ b/orion-visor-ui/src/views/asset/grant/components/host-group-grant.vue @@ -5,7 +5,7 @@ @grant="doGrant" @select-all="selectAll" @reverse="reverseSelect"> - + - - + + + + + + + + + + @@ -28,15 +56,18 @@ diff --git a/orion-visor-ui/src/views/asset/grant/components/host-key-grant.vue b/orion-visor-ui/src/views/asset/grant/components/host-key-grant.vue index 50d07b54..5a5c70eb 100644 --- a/orion-visor-ui/src/views/asset/grant/components/host-key-grant.vue +++ b/orion-visor-ui/src/views/asset/grant/components/host-key-grant.vue @@ -30,7 +30,7 @@ import type { TableData } from '@arco-design/web-vue/es/table/interface'; import type { AssetAuthorizedDataQueryRequest, AssetDataGrantRequest } from '@/api/asset/asset-data-grant'; import type { HostKeyQueryResponse } from '@/api/asset/host-key'; - import { ref, onMounted } from 'vue'; + import { ref, onMounted, onActivated } from 'vue'; import { getAuthorizedHostKey, grantHostKey } from '@/api/asset/asset-data-grant'; import useLoading from '@/hooks/loading'; import { useRowSelection } from '@/hooks/table'; @@ -101,8 +101,8 @@ } }; - // 初始化数据 - onMounted(async () => { + // 初始化主机密钥 + const initKeys = async () => { setLoading(true); try { hostKeys.value = await cacheStore.loadHostKeys(); @@ -110,7 +110,11 @@ } finally { setLoading(false); } - }); + }; + + // 初始化主机密钥 + onMounted(initKeys); + onActivated(initKeys); diff --git a/orion-visor-ui/src/views/asset/grant/components/host-list.vue b/orion-visor-ui/src/views/asset/grant/components/host-list.vue deleted file mode 100644 index bb3eb349..00000000 --- a/orion-visor-ui/src/views/asset/grant/components/host-list.vue +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - diff --git a/orion-visor-ui/src/views/asset/grant/types/const.ts b/orion-visor-ui/src/views/asset/grant/types/const.ts index 67efb6c9..c4a72a91 100644 --- a/orion-visor-ui/src/views/asset/grant/types/const.ts +++ b/orion-visor-ui/src/views/asset/grant/types/const.ts @@ -74,8 +74,14 @@ export const GrantTabs = [ }, ]; +// 主机类型 字典项 +export const hostTypeKey = 'hostType'; + +// 主机系统类型 字典项 +export const hostOsTypeKey = 'hostOsType'; + // 身份类型 字典项 export const identityTypeKey = 'hostIdentityType'; // 加载的字典值 -export const dictKeys = [identityTypeKey]; +export const dictKeys = [hostTypeKey, hostOsTypeKey, identityTypeKey]; diff --git a/orion-visor-ui/src/views/asset/grant/types/table.columns.ts b/orion-visor-ui/src/views/asset/grant/types/table.columns.ts index 7fa686a1..beac0419 100644 --- a/orion-visor-ui/src/views/asset/grant/types/table.columns.ts +++ b/orion-visor-ui/src/views/asset/grant/types/table.columns.ts @@ -1,6 +1,36 @@ import type { TableColumnData } from '@arco-design/web-vue/es/table/interface'; import { dateFormat } from '@/utils'; +// 主机列 +export const hostColumns = [ + { + title: 'id', + dataIndex: 'id', + slotName: 'id', + width: 68, + align: 'left', + fixed: 'left', + }, { + title: '主机类型', + dataIndex: 'type', + slotName: 'type', + align: 'center', + width: 100, + }, { + title: '主机名称', + dataIndex: 'name', + slotName: 'name', + ellipsis: true, + tooltip: true, + }, { + title: '主机地址', + dataIndex: 'address', + slotName: 'address', + ellipsis: true, + tooltip: true, + }, +] as TableColumnData[]; + // 主机密钥列 export const hostKeyColumns = [ { diff --git a/orion-visor-ui/src/views/asset/host-group/components/host-transfer.vue b/orion-visor-ui/src/views/asset/host-group/components/host-transfer.vue index 6bbcc899..5dc92281 100644 --- a/orion-visor-ui/src/views/asset/host-group/components/host-transfer.vue +++ b/orion-visor-ui/src/views/asset/host-group/components/host-transfer.vue @@ -53,7 +53,7 @@ diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue b/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue index f73a65af..2893eafc 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue @@ -324,7 +324,7 @@ // 重新加载数据 fetchCardData(); // 清空缓存 - cacheStore.reset('host_SSH'); + cacheStore.reset('host_', 'host_SSH'); }; defineExpose({ reload }); diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-table.vue b/orion-visor-ui/src/views/asset/host-list/components/host-table.vue index 94062bd2..d65551de 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-table.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-table.vue @@ -364,13 +364,11 @@ // 重新加载数据 fetchTableData(); // 清空缓存 - cacheStore.reset('host_SSH'); + cacheStore.reset('host_', 'host_SSH'); }; defineExpose({ reload }); - defineExpose({ reload }); - // 加载数据 const doFetchTableData = async (request: HostQueryRequest) => { try { diff --git a/orion-visor-ui/src/views/asset/host-list/types/const.ts b/orion-visor-ui/src/views/asset/host-list/types/const.ts index 5253a485..a19c3457 100644 --- a/orion-visor-ui/src/views/asset/host-list/types/const.ts +++ b/orion-visor-ui/src/views/asset/host-list/types/const.ts @@ -30,7 +30,6 @@ export const HostOsType = { }, }; - // 主机类型 字典项 export const hostTypeKey = 'hostType'; diff --git a/orion-visor-ui/src/views/dashboard/workplace/components/batch-exec-table.vue b/orion-visor-ui/src/views/dashboard/workplace/components/batch-exec-table.vue index bb85b424..9843a974 100644 --- a/orion-visor-ui/src/views/dashboard/workplace/components/batch-exec-table.vue +++ b/orion-visor-ui/src/views/dashboard/workplace/components/batch-exec-table.vue @@ -11,6 +11,7 @@
+ + +