mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-24 07:16:12 +08:00
Rename DeadTask to ArchivedTask, and action Kill to Archive
This commit is contained in:
@@ -28,13 +28,13 @@ import SyntaxHighlighter from "react-syntax-highlighter";
|
||||
import syntaxHighlightStyle from "react-syntax-highlighter/dist/esm/styles/hljs/github";
|
||||
import { AppState } from "../store";
|
||||
import {
|
||||
batchDeleteDeadTasksAsync,
|
||||
batchRunDeadTasksAsync,
|
||||
deleteDeadTaskAsync,
|
||||
deleteAllDeadTasksAsync,
|
||||
listDeadTasksAsync,
|
||||
runDeadTaskAsync,
|
||||
runAllDeadTasksAsync,
|
||||
batchDeleteArchivedTasksAsync,
|
||||
batchRunArchivedTasksAsync,
|
||||
deleteArchivedTaskAsync,
|
||||
deleteAllArchivedTasksAsync,
|
||||
listArchivedTasksAsync,
|
||||
runArchivedTaskAsync,
|
||||
runAllArchivedTasksAsync,
|
||||
} from "../actions/tasksActions";
|
||||
import TablePaginationActions, {
|
||||
defaultPageSize,
|
||||
@@ -43,7 +43,7 @@ import TablePaginationActions, {
|
||||
import TableActions from "./TableActions";
|
||||
import { timeAgo, uuidPrefix } from "../utils";
|
||||
import { usePolling } from "../hooks";
|
||||
import { DeadTaskExtended } from "../reducers/tasksReducer";
|
||||
import { ArchivedTaskExtended } from "../reducers/tasksReducer";
|
||||
import { TableColumn } from "../types/table";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
@@ -69,22 +69,22 @@ const useRowStyles = makeStyles({
|
||||
|
||||
function mapStateToProps(state: AppState) {
|
||||
return {
|
||||
loading: state.tasks.deadTasks.loading,
|
||||
tasks: state.tasks.deadTasks.data,
|
||||
batchActionPending: state.tasks.deadTasks.batchActionPending,
|
||||
allActionPending: state.tasks.deadTasks.allActionPending,
|
||||
loading: state.tasks.archivedTasks.loading,
|
||||
tasks: state.tasks.archivedTasks.data,
|
||||
batchActionPending: state.tasks.archivedTasks.batchActionPending,
|
||||
allActionPending: state.tasks.archivedTasks.allActionPending,
|
||||
pollInterval: state.settings.pollInterval,
|
||||
};
|
||||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
listDeadTasksAsync,
|
||||
runDeadTaskAsync,
|
||||
runAllDeadTasksAsync,
|
||||
deleteDeadTaskAsync,
|
||||
deleteAllDeadTasksAsync,
|
||||
batchRunDeadTasksAsync,
|
||||
batchDeleteDeadTasksAsync,
|
||||
listArchivedTasksAsync,
|
||||
runArchivedTaskAsync,
|
||||
runAllArchivedTasksAsync,
|
||||
deleteArchivedTaskAsync,
|
||||
deleteAllArchivedTasksAsync,
|
||||
batchRunArchivedTasksAsync,
|
||||
batchDeleteArchivedTasksAsync,
|
||||
};
|
||||
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -93,11 +93,11 @@ type ReduxProps = ConnectedProps<typeof connector>;
|
||||
|
||||
interface Props {
|
||||
queue: string; // name of the queue.
|
||||
totalTaskCount: number; // totoal number of dead tasks.
|
||||
totalTaskCount: number; // totoal number of archived tasks.
|
||||
}
|
||||
|
||||
function DeadTasksTable(props: Props & ReduxProps) {
|
||||
const { pollInterval, listDeadTasksAsync, queue } = props;
|
||||
function ArchivedTasksTable(props: Props & ReduxProps) {
|
||||
const { pollInterval, listArchivedTasksAsync, queue } = props;
|
||||
const classes = useStyles();
|
||||
const [page, setPage] = useState(0);
|
||||
const [pageSize, setPageSize] = useState(defaultPageSize);
|
||||
@@ -128,29 +128,29 @@ function DeadTasksTable(props: Props & ReduxProps) {
|
||||
};
|
||||
|
||||
const handleRunAllClick = () => {
|
||||
props.runAllDeadTasksAsync(queue);
|
||||
props.runAllArchivedTasksAsync(queue);
|
||||
};
|
||||
|
||||
const handleDeleteAllClick = () => {
|
||||
props.deleteAllDeadTasksAsync(queue);
|
||||
props.deleteAllArchivedTasksAsync(queue);
|
||||
};
|
||||
|
||||
const handleBatchRunClick = () => {
|
||||
props
|
||||
.batchRunDeadTasksAsync(queue, selectedKeys)
|
||||
.batchRunArchivedTasksAsync(queue, selectedKeys)
|
||||
.then(() => setSelectedKeys([]));
|
||||
};
|
||||
|
||||
const handleBatchDeleteClick = () => {
|
||||
props
|
||||
.batchDeleteDeadTasksAsync(queue, selectedKeys)
|
||||
.batchDeleteArchivedTasksAsync(queue, selectedKeys)
|
||||
.then(() => setSelectedKeys([]));
|
||||
};
|
||||
|
||||
const fetchData = useCallback(() => {
|
||||
const pageOpts = { page: page + 1, size: pageSize };
|
||||
listDeadTasksAsync(queue, pageOpts);
|
||||
}, [page, pageSize, queue, listDeadTasksAsync]);
|
||||
listArchivedTasksAsync(queue, pageOpts);
|
||||
}, [page, pageSize, queue, listArchivedTasksAsync]);
|
||||
|
||||
usePolling(fetchData, pollInterval);
|
||||
|
||||
@@ -158,7 +158,7 @@ function DeadTasksTable(props: Props & ReduxProps) {
|
||||
return (
|
||||
<Alert severity="info">
|
||||
<AlertTitle>Info</AlertTitle>
|
||||
No dead tasks at this time.
|
||||
No archived tasks at this time.
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
@@ -209,7 +209,7 @@ function DeadTasksTable(props: Props & ReduxProps) {
|
||||
<Table
|
||||
stickyHeader={true}
|
||||
className={classes.table}
|
||||
aria-label="dead tasks table"
|
||||
aria-label="archived tasks table"
|
||||
size="small"
|
||||
>
|
||||
<TableHead>
|
||||
@@ -247,10 +247,10 @@ function DeadTasksTable(props: Props & ReduxProps) {
|
||||
}
|
||||
}}
|
||||
onRunClick={() => {
|
||||
props.runDeadTaskAsync(queue, task.key);
|
||||
props.runArchivedTaskAsync(queue, task.key);
|
||||
}}
|
||||
onDeleteClick={() => {
|
||||
props.deleteDeadTaskAsync(queue, task.key);
|
||||
props.deleteArchivedTaskAsync(queue, task.key);
|
||||
}}
|
||||
allActionPending={props.allActionPending}
|
||||
onActionCellEnter={() => setActiveTaskId(task.id)}
|
||||
@@ -284,7 +284,7 @@ function DeadTasksTable(props: Props & ReduxProps) {
|
||||
}
|
||||
|
||||
interface RowProps {
|
||||
task: DeadTaskExtended;
|
||||
task: ArchivedTaskExtended;
|
||||
isSelected: boolean;
|
||||
onSelectChange: (checked: boolean) => void;
|
||||
onRunClick: () => void;
|
||||
@@ -386,4 +386,4 @@ function Row(props: RowProps) {
|
||||
);
|
||||
}
|
||||
|
||||
export default connector(DeadTasksTable);
|
||||
export default connector(ArchivedTasksTable);
|
||||
|
||||
Reference in New Issue
Block a user