Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 制品分发在编辑分发计划时目标节点存在已经被删除的节点导致保存时报错 #1088 #1089

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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