Skip to content

Commit

Permalink
fix: 制品分发在编辑分发计划时目标节点存在已经被删除的节点导致保存时报错 #1088 (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
gujunling authored Aug 31, 2023
1 parent ec3f7ba commit 6f74dd1
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@
}
},
created () {
// 需要获取最新的节点列表
this.getClusterList()
this.getRepoListAll({ projectId: this.projectId })
this.routeName !== 'createPlan' && this.handlePlanDetail()
},
Expand All @@ -266,7 +268,8 @@
'getRepoListAll',
'createPlan',
'getPlanDetail',
'updatePlan'
'updatePlan',
'getClusterList'
]),
formatDate,
handlePlanDetail () {
Expand Down Expand Up @@ -306,7 +309,7 @@
}
: {}),
conflictStrategy,
remoteClusterIds: remoteClusters.map(v => v.id),
remoteClusterIds: this.checkClusterExist(remoteClusters.map(v => v.id)),
description,
createdBy,
createdDate
Expand All @@ -316,6 +319,12 @@
this.isLoading = false
})
},
// 判断当前选择的节点是否存在于节点列表中
checkClusterExist (arr) {
return arr.map(v => {
return this.clusterList.map(v => v.id).includes(v) && v
}).filter(Boolean)
},
changeReplicaObjectType () {
this.replicaTaskObjects = []
this.planForm.executionStrategy === 'REAL_TIME' && (this.planForm.executionStrategy = 'IMMEDIATELY')
Expand All @@ -325,6 +334,8 @@
this.$refs.planForm.clearError()
},
async save () {
// 保存时也需要校验
this.planForm.remoteClusterIds = this.checkClusterExist(this.planForm.remoteClusterIds)
await this.$refs.planForm.validate()
if (this.planForm.loading) return
Expand Down

0 comments on commit 6f74dd1

Please sign in to comment.