Skip to content

Commit c3d6286

Browse files
authored
[Fix-17984][UI] Release workflow definition list loading lock on request failure (#17989)
1 parent c3cc817 commit c3d6286

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

dolphinscheduler-ui/src/locales/en_US/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ export default {
242242
'The downstream dependent tasks exists. You can not delete the task.',
243243
warning_delete_scheduler_dependent_tasks_desc:
244244
'The downstream dependent tasks exists. Are you sure to delete the scheduler?',
245+
request_failed: 'Request failed, please retry',
245246
warning_too_large_parallelism_number:
246247
'The parallelism number is too large. It is better not to be over 10.'
247248
},

dolphinscheduler-ui/src/locales/zh_CN/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export default {
239239
'下游存在依赖,你不能删除该任务.',
240240
warning_delete_scheduler_dependent_tasks_desc:
241241
'下游存在依赖, 删除定时可能会对下游任务产生影响. 你确定要删除该定时嘛?',
242+
request_failed: '请求失败,请重试',
242243
warning_too_large_parallelism_number: '并行度设置太大了, 最好不要超过10.'
243244
},
244245
task: {

dolphinscheduler-ui/src/views/projects/workflow/definition/use-table.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,17 +506,28 @@ export function useTable() {
506506
const getTableData = (params: IDefinitionParam) => {
507507
if (variables.loadingRef) return
508508
variables.loadingRef = true
509-
const { state } = useAsyncState(
510-
queryListPaging({ ...params }, variables.projectCode).then((res: any) => {
509+
// Always release loading lock, even when request fails.
510+
const queryStatePromise = queryListPaging(
511+
{ ...params },
512+
variables.projectCode
513+
)
514+
.then((res: any) => {
511515
variables.totalCount = res.total
512516
variables.totalPage = res.totalPage
513517
variables.tableData = res.totalList.map((item: any) => {
514518
return { ...item }
515519
})
520+
})
521+
.catch((err: Error) => {
522+
window.$message.error(
523+
err?.message || t('project.workflow.request_failed')
524+
)
525+
})
526+
.finally(() => {
516527
variables.loadingRef = false
517-
}),
518-
{ total: 0, table: [] }
519-
)
528+
})
529+
530+
const { state } = useAsyncState(queryStatePromise, { total: 0, table: [] })
520531
return state
521532
}
522533

0 commit comments

Comments
 (0)