mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-29 21:28:52 +00:00
perf: merge with remote
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user