mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-08-24 14:48:42 +08:00
Add run retry task, run scheduled task functionality
This commit is contained in:
@@ -29,6 +29,7 @@ import {
|
||||
runAllRetryTasksAsync,
|
||||
listRetryTasksAsync,
|
||||
deleteRetryTaskAsync,
|
||||
runRetryTaskAsync,
|
||||
} from "../actions/tasksActions";
|
||||
import { AppState } from "../store";
|
||||
import TablePaginationActions, {
|
||||
@@ -63,6 +64,7 @@ const mapDispatchToProps = {
|
||||
runAllRetryTasksAsync,
|
||||
listRetryTasksAsync,
|
||||
deleteRetryTaskAsync,
|
||||
runRetryTaskAsync,
|
||||
};
|
||||
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -193,6 +195,7 @@ function RetryTasksTable(props: Props & ReduxProps) {
|
||||
<Row
|
||||
key={task.id}
|
||||
task={task}
|
||||
allActionPending={props.allActionPending}
|
||||
isSelected={selectedKeys.includes(task.key)}
|
||||
onSelectChange={(checked: boolean) => {
|
||||
if (checked) {
|
||||
@@ -203,6 +206,9 @@ function RetryTasksTable(props: Props & ReduxProps) {
|
||||
);
|
||||
}
|
||||
}}
|
||||
onRunClick={() => {
|
||||
props.runRetryTaskAsync(task.queue, task.key);
|
||||
}}
|
||||
onDeleteClick={() => {
|
||||
props.deleteRetryTaskAsync(task.queue, task.key);
|
||||
}}
|
||||
@@ -246,6 +252,8 @@ interface RowProps {
|
||||
isSelected: boolean;
|
||||
onSelectChange: (checked: boolean) => void;
|
||||
onDeleteClick: () => void;
|
||||
onRunClick: () => void;
|
||||
allActionPending: boolean;
|
||||
}
|
||||
|
||||
function Row(props: RowProps) {
|
||||
@@ -281,7 +289,16 @@ function Row(props: RowProps) {
|
||||
<TableCell>{task.retried}</TableCell>
|
||||
<TableCell>{task.max_retry}</TableCell>
|
||||
<TableCell>
|
||||
<Button disabled={task.requestPending} onClick={props.onDeleteClick}>
|
||||
<Button
|
||||
onClick={props.onRunClick}
|
||||
disabled={task.requestPending || props.allActionPending}
|
||||
>
|
||||
Run
|
||||
</Button>
|
||||
<Button
|
||||
disabled={task.requestPending}
|
||||
onClick={props.onDeleteClick || props.allActionPending}
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
</TableCell>
|
||||
|
@@ -29,6 +29,7 @@ import {
|
||||
runAllScheduledTasksAsync,
|
||||
listScheduledTasksAsync,
|
||||
deleteScheduledTaskAsync,
|
||||
runScheduledTaskAsync,
|
||||
} from "../actions/tasksActions";
|
||||
import { AppState } from "../store";
|
||||
import TablePaginationActions, {
|
||||
@@ -63,6 +64,7 @@ const mapDispatchToProps = {
|
||||
batchRunScheduledTasksAsync,
|
||||
deleteAllScheduledTasksAsync,
|
||||
runAllScheduledTasksAsync,
|
||||
runScheduledTaskAsync,
|
||||
};
|
||||
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -190,6 +192,7 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
|
||||
<Row
|
||||
key={task.id}
|
||||
task={task}
|
||||
allActionPending={props.allActionPending}
|
||||
isSelected={selectedKeys.includes(task.key)}
|
||||
onSelectChange={(checked: boolean) => {
|
||||
if (checked) {
|
||||
@@ -200,6 +203,9 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
|
||||
);
|
||||
}
|
||||
}}
|
||||
onRunClick={() => {
|
||||
props.runScheduledTaskAsync(queue, task.key);
|
||||
}}
|
||||
onDeleteClick={() => {
|
||||
props.deleteScheduledTaskAsync(queue, task.key);
|
||||
}}
|
||||
@@ -242,7 +248,9 @@ interface RowProps {
|
||||
task: ScheduledTaskExtended;
|
||||
isSelected: boolean;
|
||||
onSelectChange: (checked: boolean) => void;
|
||||
onRunClick: () => void;
|
||||
onDeleteClick: () => void;
|
||||
allActionPending: boolean;
|
||||
}
|
||||
|
||||
function Row(props: RowProps) {
|
||||
@@ -275,7 +283,16 @@ function Row(props: RowProps) {
|
||||
<TableCell>{task.type}</TableCell>
|
||||
<TableCell>{durationBefore(task.next_process_at)}</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={props.onDeleteClick} disabled={task.requestPending}>
|
||||
<Button
|
||||
onClick={props.onRunClick}
|
||||
disabled={task.requestPending || props.allActionPending}
|
||||
>
|
||||
Run
|
||||
</Button>
|
||||
<Button
|
||||
onClick={props.onDeleteClick}
|
||||
disabled={task.requestPending || props.allActionPending}
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
</TableCell>
|
||||
|
Reference in New Issue
Block a user