Skip to content

Commit

Permalink
feat: call retry failed task api
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Nov 21, 2023
1 parent 2dde057 commit 0b0a857
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lang/en/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"undone": "Running",
"clear_succeeded": "Clear Succeeded",
"retry": "Retry",
"retry_failed": "Retry Failed",
"state": {
"0": "Pending",
"1": "Running",
Expand Down
13 changes: 13 additions & 0 deletions src/pages/manage/tasks/Tasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export const Tasks = (props: TasksProps) => {
const [clearSucceededLoading, clearSucceeded] = useFetch(
(): PEmptyResp => r.post(`/admin/task/${props.type}/clear_succeeded`),
)
const [retryFailedLoading, retryFailed] = useFetch(
(): PEmptyResp => r.post(`/admin/task/${props.type}/retry_failed`),
)
const [page, setPage] = createSignal(1)
const pageSize = 20
const curTasks = createMemo(() => {
Expand All @@ -57,6 +60,16 @@ export const Tasks = (props: TasksProps) => {
{t(`global.refresh`)}
</Button>
<Button
loading={retryFailedLoading()}
onClick={async () => {
const resp = await retryFailed()
handleResp(resp, () => refresh())
}}
>
{t(`tasks.retry_failed`)}
</Button>
<Button
colorScheme="danger"
loading={clearDoneLoading()}
onClick={async () => {
const resp = await clearDone()
Expand Down

0 comments on commit 0b0a857

Please sign in to comment.