Skip to content

Commit

Permalink
fix:ui: 修复实例关联列表错误的显示了实例自身的问题 (#5436)
Browse files Browse the repository at this point in the history
  • Loading branch information
joe511230 authored Jul 2, 2021
1 parent 8081fc7 commit 6c7d5b2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/ui/src/components/model-instance/relation/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
const { isSource } = this
return this.searchInstAssociation({
params: {
bk_obj_id: isSource ? this.objId : option.bk_obj_id,
condition: {
bk_asst_id: option.bk_asst_id,
bk_obj_asst_id: option.bk_obj_asst_id,
Expand Down
9 changes: 4 additions & 5 deletions src/ui/src/components/model-instance/relation/list-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@
return this.type === 'source'
},
instances() {
return this.allInstances.filter((instance) => {
const sameAsstId = instance.bk_asst_id === this.associationType.bk_asst_id
const sameModelId = this.id === instance[this.isSource ? 'bk_asst_obj_id' : 'bk_obj_id']
return sameAsstId && sameModelId
})
const objAsstId = this.isSource
? `${this.objId}_${this.associationType.bk_asst_id}_${this.id}`
: `${this.id}_${this.associationType.bk_asst_id}_${this.objId}`
return this.allInstances.filter(instance => instance.bk_obj_asst_id === objAsstId)
},
instanceIds() {
return this.instances.map(instance => (this.isSource ? instance.bk_asst_inst_id : instance.bk_inst_id))
Expand Down
4 changes: 2 additions & 2 deletions src/ui/src/components/model-instance/relation/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@
const targetCondition = { bk_asst_obj_id: this.objId, bk_asst_inst_id: this.instId }
const [source, target] = await Promise.all([
this.$store.dispatch('objectAssociation/searchInstAssociation', {
params: { condition: sourceCondition },
params: { condition: sourceCondition, bk_obj_id: this.objId },
config: { requestId: 'getSourceAssociation' }
}),
this.$store.dispatch('objectAssociation/searchInstAssociation', {
params: { condition: targetCondition },
params: { condition: targetCondition, bk_obj_id: this.objId },
config: { requestId: 'getTargetAssociation' }
})
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@
const { isSource } = this
return this.searchInstAssociation({
params: {
bk_obj_id: isSource ? this.objId : option.bk_obj_id,
condition: {
bk_asst_id: option.bk_asst_id,
bk_obj_asst_id: option.bk_obj_asst_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,10 @@
return this.type === 'source'
},
instances() {
return this.allInstances.filter((instance) => {
const sameAsstId = instance.bk_asst_id === this.associationType.bk_asst_id
const sameModelId = this.id === instance[this.isSource ? 'bk_asst_obj_id' : 'bk_obj_id']
return sameAsstId && sameModelId
})
const objAsstId = this.isSource
? `host_${this.associationType.bk_asst_id}_${this.id}`
: `${this.id}_${this.associationType.bk_asst_id}_host`
return this.allInstances.filter(instance => instance.bk_obj_asst_id === objAsstId)
},
instanceIds() {
return this.instances.map(instance => (this.isSource ? instance.bk_asst_inst_id : instance.bk_inst_id))
Expand Down
4 changes: 2 additions & 2 deletions src/ui/src/views/host-details/children/association-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@
const targetCondition = { bk_asst_obj_id: 'host', bk_asst_inst_id: this.id }
const [source, target] = await Promise.all([
this.$store.dispatch('objectAssociation/searchInstAssociation', {
params: { condition: sourceCondition },
params: { condition: sourceCondition, bk_obj_id: 'host' },
config: { requestId: 'getSourceAssociation' }
}),
this.$store.dispatch('objectAssociation/searchInstAssociation', {
params: { condition: targetCondition },
params: { condition: targetCondition, bk_obj_id: 'host' },
config: { requestId: 'getTargetAssociation' }
})
])
Expand Down

0 comments on commit 6c7d5b2

Please sign in to comment.