mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-08-24 14:48:42 +08:00
Add batch-delete, batch-run, delete-all, run-all functionalities for
scheduled and retry tasks
This commit is contained in:
@@ -23,6 +23,10 @@ import AlertTitle from "@material-ui/lab/AlertTitle";
|
||||
import SyntaxHighlighter from "react-syntax-highlighter";
|
||||
import syntaxHighlightStyle from "react-syntax-highlighter/dist/esm/styles/hljs/github";
|
||||
import {
|
||||
batchDeleteRetryTasksAsync,
|
||||
batchRunRetryTasksAsync,
|
||||
deleteAllRetryTasksAsync,
|
||||
runAllRetryTasksAsync,
|
||||
listRetryTasksAsync,
|
||||
deleteRetryTaskAsync,
|
||||
} from "../actions/tasksActions";
|
||||
@@ -52,7 +56,14 @@ function mapStateToProps(state: AppState) {
|
||||
};
|
||||
}
|
||||
|
||||
const mapDispatchToProps = { listRetryTasksAsync, deleteRetryTaskAsync };
|
||||
const mapDispatchToProps = {
|
||||
batchDeleteRetryTasksAsync,
|
||||
batchRunRetryTasksAsync,
|
||||
deleteAllRetryTasksAsync,
|
||||
runAllRetryTasksAsync,
|
||||
listRetryTasksAsync,
|
||||
deleteRetryTaskAsync,
|
||||
};
|
||||
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -93,6 +104,26 @@ function RetryTasksTable(props: Props & ReduxProps) {
|
||||
}
|
||||
};
|
||||
|
||||
const handleRunAllClick = () => {
|
||||
props.runAllRetryTasksAsync(queue);
|
||||
};
|
||||
|
||||
const handleDeleteAllClick = () => {
|
||||
props.deleteAllRetryTasksAsync(queue);
|
||||
};
|
||||
|
||||
const handleBatchRunClick = () => {
|
||||
props
|
||||
.batchDeleteRetryTasksAsync(queue, selectedKeys)
|
||||
.then(() => setSelectedKeys([]));
|
||||
};
|
||||
|
||||
const handleBatchDeleteClick = () => {
|
||||
props
|
||||
.batchRunRetryTasksAsync(queue, selectedKeys)
|
||||
.then(() => setSelectedKeys([]));
|
||||
};
|
||||
|
||||
const fetchData = useCallback(() => {
|
||||
const pageOpts = { page: page + 1, size: pageSize };
|
||||
listRetryTasksAsync(queue, pageOpts);
|
||||
@@ -128,10 +159,10 @@ function RetryTasksTable(props: Props & ReduxProps) {
|
||||
allActionPending={props.allActionPending}
|
||||
batchActionPending={props.batchActionPending}
|
||||
showBatchActions={numSelected > 0}
|
||||
onRunAllClick={() => console.log("TODO")}
|
||||
onDeleteAllClick={() => console.log("TODO")}
|
||||
onBatchRunClick={() => console.log("TODO")}
|
||||
onBatchDeleteClick={() => console.log("TODO")}
|
||||
onRunAllClick={handleRunAllClick}
|
||||
onDeleteAllClick={handleDeleteAllClick}
|
||||
onBatchRunClick={handleBatchRunClick}
|
||||
onBatchDeleteClick={handleBatchDeleteClick}
|
||||
/>
|
||||
<TableContainer component={Paper}>
|
||||
<Table
|
||||
|
@@ -23,6 +23,10 @@ import AlertTitle from "@material-ui/lab/AlertTitle";
|
||||
import SyntaxHighlighter from "react-syntax-highlighter";
|
||||
import syntaxHighlightStyle from "react-syntax-highlighter/dist/esm/styles/hljs/github";
|
||||
import {
|
||||
batchDeleteScheduledTasksAsync,
|
||||
batchRunScheduledTasksAsync,
|
||||
deleteAllScheduledTasksAsync,
|
||||
runAllScheduledTasksAsync,
|
||||
listScheduledTasksAsync,
|
||||
deleteScheduledTaskAsync,
|
||||
} from "../actions/tasksActions";
|
||||
@@ -55,6 +59,10 @@ function mapStateToProps(state: AppState) {
|
||||
const mapDispatchToProps = {
|
||||
listScheduledTasksAsync,
|
||||
deleteScheduledTaskAsync,
|
||||
batchDeleteScheduledTasksAsync,
|
||||
batchRunScheduledTasksAsync,
|
||||
deleteAllScheduledTasksAsync,
|
||||
runAllScheduledTasksAsync,
|
||||
};
|
||||
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -96,6 +104,26 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
|
||||
}
|
||||
};
|
||||
|
||||
const handleRunAllClick = () => {
|
||||
props.runAllScheduledTasksAsync(queue);
|
||||
};
|
||||
|
||||
const handleDeleteAllClick = () => {
|
||||
props.deleteAllScheduledTasksAsync(queue);
|
||||
};
|
||||
|
||||
const handleBatchRunClick = () => {
|
||||
props
|
||||
.batchDeleteScheduledTasksAsync(queue, selectedKeys)
|
||||
.then(() => setSelectedKeys([]));
|
||||
};
|
||||
|
||||
const handleBatchDeleteClick = () => {
|
||||
props
|
||||
.batchRunScheduledTasksAsync(queue, selectedKeys)
|
||||
.then(() => setSelectedKeys([]));
|
||||
};
|
||||
|
||||
const fetchData = useCallback(() => {
|
||||
const pageOpts = { page: page + 1, size: pageSize };
|
||||
listScheduledTasksAsync(queue, pageOpts);
|
||||
@@ -128,10 +156,10 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
|
||||
allActionPending={props.allActionPending}
|
||||
batchActionPending={props.batchActionPending}
|
||||
showBatchActions={numSelected > 0}
|
||||
onRunAllClick={() => console.log("TODO")}
|
||||
onDeleteAllClick={() => console.log("TODO")}
|
||||
onBatchRunClick={() => console.log("TODO")}
|
||||
onBatchDeleteClick={() => console.log("TODO")}
|
||||
onRunAllClick={handleRunAllClick}
|
||||
onDeleteAllClick={handleDeleteAllClick}
|
||||
onBatchRunClick={handleBatchRunClick}
|
||||
onBatchDeleteClick={handleBatchDeleteClick}
|
||||
/>
|
||||
<TableContainer component={Paper}>
|
||||
<Table
|
||||
|
Reference in New Issue
Block a user