From 0f6ae3f626ee149dd68b4832fd8f852099e4b373 Mon Sep 17 00:00:00 2001
From: w940853815 <940853815@qq.com>
Date: Wed, 5 Feb 2025 18:44:10 +0800
Subject: [PATCH 1/2] fix: profile preferences api request 404
---
.../components/GenericCreateUpdateForm/index.vue | 3 ---
src/layout/components/GenericDetailPage/index.vue | 15 +++++----------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/src/layout/components/GenericCreateUpdateForm/index.vue b/src/layout/components/GenericCreateUpdateForm/index.vue
index 94477e65c..b7304cd9b 100644
--- a/src/layout/components/GenericCreateUpdateForm/index.vue
+++ b/src/layout/components/GenericCreateUpdateForm/index.vue
@@ -430,9 +430,6 @@ export default {
return object
},
async getObjectDetail(url, id) {
- if (!id) {
- return
- }
this.$log.debug('Get object detail: ', url)
let data = await this.$axios.get(url, { params: { id }})
if (Array.isArray(data)) {
diff --git a/src/layout/components/GenericDetailPage/index.vue b/src/layout/components/GenericDetailPage/index.vue
index ba191b12c..64e2aa57e 100644
--- a/src/layout/components/GenericDetailPage/index.vue
+++ b/src/layout/components/GenericDetailPage/index.vue
@@ -198,17 +198,12 @@ export default {
},
getDetailUrl() {
const vm = this
- let objectId = ''
- if (this.actionId) {
- objectId = this.actionId
- } else {
- objectId = vm.$route.params.id
- }
- if (vm.url) {
- return `${vm.url}/${objectId}/`
- } else {
- return getApiPath(vm, objectId)
+ const objectId = this.actionId || this.$route.params.id
+ // 兼容之前的 detailApiUrl
+ if (vm.validActions.detailApiUrl || vm.detailApiUrl) {
+ return vm.validActions.detailApiUrl || vm.detailApiUrl
}
+ return vm.url ? `${vm.url}/${objectId}/` : getApiPath(vm, objectId)
},
afterDelete() {
if (this.drawer) {
From e3c17ef96d99495fd77f924245e7d871a01176a2 Mon Sep 17 00:00:00 2001
From: zhaojisen <1301338853@qq.com>
Date: Thu, 6 Feb 2025 11:05:01 +0800
Subject: [PATCH 2/2] Perf: Add Account Valid License
---
.../AccountConnectFormatter.vue | 28 ++++++-------------
src/views/pam/Account/AccountList.vue | 8 +++++-
src/views/pam/Account/index.vue | 6 +++-
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/components/Table/TableFormatters/AccountConnectFormatter.vue b/src/components/Table/TableFormatters/AccountConnectFormatter.vue
index 0a69b3c08..28e5d5236 100644
--- a/src/components/Table/TableFormatters/AccountConnectFormatter.vue
+++ b/src/components/Table/TableFormatters/AccountConnectFormatter.vue
@@ -50,8 +50,8 @@ export default {
default: ''
},
connectUrlTemplate: {
- type: String,
- default: ''
+ type: Function,
+ default: () => {}
}
},
data() {
@@ -71,11 +71,7 @@ export default {
handleCommand(protocol) {
if (protocol === 'Title') return
- this.$store.commit('table/SET_PROTOCOL_MAP_ITEM', {
- key: this.row.id,
- value: protocol
- })
-
+ this.formatterArgs.setMapItem(this.row.id, protocol)
this.handleWindowOpen(this.row, protocol)
},
visibleChange(visible) {
@@ -84,19 +80,17 @@ export default {
}
},
handleWindowOpen(row, protocol) {
- const url = this.formatterArgs.connectUrlTemplate
- .replace('{id}', row.id)
- .replace('{username}', row.username)
- .replace('{assetId}', row.asset.id)
- .replace('{assetName}', row.asset.name)
- .replace('{protocol}', protocol)
+ const url = this.formatterArgs.connectUrlTemplate(row) + `${protocol}`
- window.open(url, '_blank')
+ this.$nextTick(() => {
+ window.open(url, '_blank')
+ })
},
async handlePamConnect() {
const protocolMap = this.$store.getters.protocolMap
if (protocolMap.has(this.row.id)) {
+ // 直连
const protocol = protocolMap.get(this.row.id)
this.handleWindowOpen(this.row, protocol)
} else {
@@ -107,11 +101,7 @@ export default {
if (res && res.protocols.length > 0) {
const protocol = res.protocols[0]
- this.$store.commit('table/SET_PROTOCOL_MAP_ITEM', {
- key: this.row.id,
- value: protocol.name
- })
-
+ this.formatterArgs.setMapItem(this.row.id, protocol.name)
this.handleWindowOpen(this.row, protocol.name)
}
} catch (e) {
diff --git a/src/views/pam/Account/AccountList.vue b/src/views/pam/Account/AccountList.vue
index 1e33d8651..f53ed034d 100644
--- a/src/views/pam/Account/AccountList.vue
+++ b/src/views/pam/Account/AccountList.vue
@@ -39,7 +39,13 @@ export default {
buttonIcon: 'fa fa-desktop',
titleText: '可选协议',
url: '/api/v1/assets/assets/{id}',
- connectUrlTemplate: '/luna/pam_connect/{id}/{username}/{assetId}/{assetName}/{protocol}'
+ connectUrlTemplate: (row) => `/luna/pam_connect/${row.id}/${row.username}/${row.asset.id}/${row.asset.name}/`,
+ setMapItem: (id, protocol) => {
+ this.$store.commit('table/SET_PROTOCOL_MAP_ITEM', {
+ key: id,
+ value: protocol
+ })
+ }
}
}
}
diff --git a/src/views/pam/Account/index.vue b/src/views/pam/Account/index.vue
index 919d6b3e9..5ab93bab3 100644
--- a/src/views/pam/Account/index.vue
+++ b/src/views/pam/Account/index.vue
@@ -2,11 +2,12 @@