Skip to content

Commit

Permalink
fix: disable job has no perms
Browse files Browse the repository at this point in the history
  • Loading branch information
w940853815 committed Nov 21, 2024
1 parent 8477888 commit 40f972e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/Table/TableFormatters/SwitchFormatter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export default {
onChange(val) {
this.$axios.patch(this.patchUrl, this.patchData).then(res => {
this.formatterArgs.callback(this.row)
this.$message.success(this.$t('updateSuccessMsg'))
this.$message.success(this.$t('UpdateSuccessMsg'))
}).catch(err => {
this.value = !val
this.$message.error(this.$t('updateErrorMsg' + ' ' + err))
this.$message.error(this.$t('UpdateErrorMsg' + ' ' + err))
})
}
}
Expand Down
13 changes: 5 additions & 8 deletions src/views/audits/JobPeriodTaskList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<script type="text/jsx">
import GenericListPage from '@/layout/components/GenericListPage'
import { SwitchFormatter } from '@/components/Table/TableFormatters'
import { auditUpdateJob } from '@/api/ops'

export default {
components: {
Expand Down Expand Up @@ -54,25 +53,23 @@ export default {
label: this.$t('Periodic')
},
is_periodic: {
width: '120px',
width: '140px',
label: `${this.$t('Enable')}/${this.$t('Disable')}`,
formatter: SwitchFormatter,
formatterArgs: {
isDisplay(row) {
return row.is_periodic
},
getPatchUrl(row) {
return `/api/v1/ops/celery/period-tasks/run_ops_job_period_${row.id.slice(0, 8)}/`
return `/api/v1/audits/jobs/${row.id}/`
},
getPatchData(row) {
return {
enabled: !row.is_periodic
is_periodic: !row.is_periodic
}
},
callback(row) {
auditUpdateJob(row.id, { is_periodic: !row.is_periodic }).then(() => {
vm.$refs.ListPage.reloadTable()
})
callback() {
vm.$refs.ListPage.reloadTable()
}
}
}
Expand Down

0 comments on commit 40f972e

Please sign in to comment.