Add batch-delete, batch-run, delete-all, run-all functionalities for

scheduled and retry tasks
This commit is contained in:
Ken Hibino
2020-12-19 06:07:23 -08:00
parent 68738ec962
commit f527b0c6d8
9 changed files with 981 additions and 12 deletions

View File

@@ -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

View File

@@ -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