Skip to content

Commit

Permalink
fix: 解决工作负载无法编辑重启策略的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu committed Jul 21, 2023
1 parent 47fdbeb commit e3c6db1
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions web/dashboard/src/components/ko-workloads/ko-spec/ko-spec-base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,17 @@ export default {
for (const sec of newObj.imagePullSecrets) {
this.form.imagePullSecrets.push(sec.name)
}
if (this.specBaseParentObj.restartPolicy) {
this.form.restartPolicy = this.specBaseParentObj.restartPolicy
}
if (this.specBaseParentObj.serviceAccountName) {
this.form.serviceAccountName = this.specBaseParentObj.serviceAccountName
}
if (this.specBaseParentObj.terminationGracePeriodSeconds) {
this.form.terminationGracePeriodSeconds = this.specBaseParentObj.terminationGracePeriodSeconds
}
}
if (this.specBaseParentObj.restartPolicy) {
this.form.restartPolicy = this.specBaseParentObj.restartPolicy
} else {
this.form.restartPolicy = this.isJobs() ? "OnFailure" : "Always"
}
if (this.specBaseParentObj.serviceAccountName) {
this.form.serviceAccountName = this.specBaseParentObj.serviceAccountName
}
if (this.specBaseParentObj.terminationGracePeriodSeconds) {
this.form.terminationGracePeriodSeconds = this.specBaseParentObj.terminationGracePeriodSeconds
}
},
immediate: true,
Expand Down Expand Up @@ -109,12 +111,7 @@ export default {
},
methods: {
isJobs() {
if (this.resourceType === "jobs" || this.resourceType === "cronjobs") {
this.form.restartPolicy = "OnFailure"
return true
}
this.form.restartPolicy = "Always"
return false
return this.resourceType === "jobs" || this.resourceType === "cronjobs"
},
transformation(parentFrom, metadata) {
parentFrom.restartPolicy = this.form.restartPolicy || undefined
Expand Down

0 comments on commit e3c6db1

Please sign in to comment.