Skip to content

Commit

Permalink
feat(startTask): Add errorCode
Browse files Browse the repository at this point in the history
  • Loading branch information
StormKennen committed Nov 10, 2023
1 parent 88e28c7 commit 5d6ec53
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 21 deletions.
9 changes: 8 additions & 1 deletion apps/dfs/src/plugins/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@ const responseInterceptor = response => {
return reject(response)
}
// 其他情况交由业务端自行处理
if (['Datasource.TableNotFound', 'SubscribeFailed.OrderLimit', 'Task.ScheduleLimit'].includes(code)) {
if (
[
'Datasource.TableNotFound',
'SubscribeFailed.OrderLimit',
'Task.ScheduleLimit',
'Task.ManuallyScheduleLimit'
].includes(code)
) {
return reject(Object.assign(response))
}
// 文件处理
Expand Down
25 changes: 15 additions & 10 deletions packages/business/src/views/task/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@

<UpgradeFee
:visible.sync="upgradeFeeVisible"
:tooltip="$t('packages_business_task_list_nindekeyunxing')"
:tooltip="upgradeFeeVisibleTips || $t('packages_business_task_list_nindekeyunxing')"
:go-page="upgradeFeeGoPage"
></UpgradeFee>

<UpgradeCharges
:visible.sync="upgradeChargesVisible"
:tooltip="$t('packages_business_task_list_nindekeyunxing')"
:tooltip="upgradeChargesVisibleTips || $t('packages_business_task_list_nindekeyunxing')"
:go-page="upgradeFeeGoPage"
></UpgradeCharges>
</section>
Expand Down Expand Up @@ -439,7 +439,9 @@ export default {
failList: [], //错误列表
taskErrorCause: {},
upgradeFeeVisible: false,
upgradeChargesVisible: false
upgradeFeeVisibleTips: '',
upgradeChargesVisible: false,
upgradeChargesVisibleTips: ''
}
},
Expand Down Expand Up @@ -714,8 +716,9 @@ export default {
let failList = data?.filter(t => t.code !== 'ok') || []
failList = [...failList, ...canNotList]
if (failList.length) {
if (failList.some(t => t.code === 'Task.ScheduleLimit')) {
this.handleShowUpgradeDialog()
const findErr = failList.find(t => ['Task.ScheduleLimit', 'Task.ManuallyScheduleLimit'].includes(t.code))
if (findErr) {
this.handleShowUpgradeDialog(findErr)
return
}
let nameMapping = {}
Expand Down Expand Up @@ -1106,16 +1109,18 @@ export default {
},
// 升级专业版
handleShowUpgradeFee() {
handleShowUpgradeFee(msg) {
this.upgradeFeeVisibleTips = msg
this.upgradeFeeVisible = true
},
// 升级规格
handleShowUpgradeCharges() {
handleShowUpgradeCharges(msg) {
this.upgradeChargesVisibleTips = msg
this.upgradeChargesVisible = true
},
handleShowUpgradeDialog() {
handleShowUpgradeDialog(err) {
!this.isDaas &&
this.$axios
.get(
Expand All @@ -1136,8 +1141,8 @@ export default {
}
items.length <= 1 && items.some(t => t.orderInfo?.chargeProvider === 'FreeTier' || !t.orderInfo?.amount)
? this.handleShowUpgradeFee()
: this.handleShowUpgradeCharges()
? this.handleShowUpgradeFee(err.message)
: this.handleShowUpgradeCharges(err.message)
})
}
}
Expand Down
8 changes: 5 additions & 3 deletions packages/dag/src/MigrationMonitor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@

<UpgradeFee
:visible.sync="upgradeFeeVisible"
:tooltip="$t('packages_business_task_list_nindekeyunxing')"
:tooltip="upgradeFeeVisibleTips || $t('packages_business_task_list_nindekeyunxing')"
:go-page="upgradeFeeGoPage"
></UpgradeFee>

<UpgradeCharges
:visible.sync="upgradeChargesVisible"
:tooltip="$t('packages_business_task_list_nindekeyunxing')"
:tooltip="upgradeChargesVisibleTips || $t('packages_business_task_list_nindekeyunxing')"
:go-page="upgradeFeeGoPage"
></UpgradeCharges>

Expand Down Expand Up @@ -304,7 +304,9 @@ export default {
items: []
},
upgradeFeeVisible: false,
upgradeChargesVisible: false
upgradeFeeVisibleTips: '',
upgradeChargesVisible: false,
upgradeChargesVisibleTips: ''
}
},
Expand Down
16 changes: 9 additions & 7 deletions packages/dag/src/mixins/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1997,8 +1997,8 @@ export default {
}).then(resFlag => {
resFlag && location.reload()
})
} else if (code === 'Task.ScheduleLimit') {
this.handleShowUpgradeDialog()
} else if (['Task.ScheduleLimit', 'Task.ManuallyScheduleLimit'].includes(code)) {
this.handleShowUpgradeDialog(error.data)
} else {
const msg = error?.data?.message || msg
this.$message.error(msg)
Expand Down Expand Up @@ -2405,16 +2405,18 @@ export default {
},

// 升级专业版
handleShowUpgradeFee() {
handleShowUpgradeFee(msg) {
this.upgradeFeeVisibleTips = msg
this.upgradeFeeVisible = true
},

// 升级规格
handleShowUpgradeCharges() {
handleShowUpgradeCharges(msg) {
this.upgradeChargesVisibleTips = msg
this.upgradeChargesVisible = true
},

handleShowUpgradeDialog() {
handleShowUpgradeDialog(err) {
!this.isDaas &&
this.$axios
.get(
Expand All @@ -2435,8 +2437,8 @@ export default {
}

items.length <= 1 && items.some(t => t.orderInfo?.chargeProvider === 'FreeTier' || !t.orderInfo?.amount)
? this.handleShowUpgradeFee()
: this.handleShowUpgradeCharges()
? this.handleShowUpgradeFee(err.message)
: this.handleShowUpgradeCharges(err.message)
})
},

Expand Down
4 changes: 4 additions & 0 deletions packages/ldp/src/TablePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -802,9 +802,13 @@ export default {
if (data.every(t => t.code === 'ok')) {
this.$message.success(this.$t('public_message_operation_success'))
} else {
const findManuallyScheduleLimit = data.find(t => t.code === 'Task.ManuallyScheduleLimit')
if (data.some(t => t.code === 'Task.ScheduleLimit')) {
this.$emit('handle-show-upgrade')
return
} else if (findManuallyScheduleLimit) {
this.$message.error(findManuallyScheduleLimit.message)
return
}
this.$message.error(data[0]?.message)
}
Expand Down

0 comments on commit 5d6ec53

Please sign in to comment.