mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-09-16 19:51:38 +08:00
Add batch run button to DeadTasksTable
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
} from "../actions/queuesActions";
|
||||
import {
|
||||
BATCH_DELETE_DEAD_TASKS_SUCCESS,
|
||||
BATCH_RUN_DEAD_TASKS_SUCCESS,
|
||||
DELETE_DEAD_TASK_SUCCESS,
|
||||
DELETE_RETRY_TASK_SUCCESS,
|
||||
DELETE_SCHEDULED_TASK_SUCCESS,
|
||||
@@ -217,6 +218,26 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case BATCH_RUN_DEAD_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
pending:
|
||||
queueInfo.currentStats.pending +
|
||||
action.payload.pending_keys.length,
|
||||
dead:
|
||||
queueInfo.currentStats.dead - action.payload.pending_keys.length,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case BATCH_DELETE_DEAD_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
|
@@ -4,6 +4,7 @@ import {
|
||||
} from "../actions/snackbarActions";
|
||||
import {
|
||||
BATCH_DELETE_DEAD_TASKS_SUCCESS,
|
||||
BATCH_RUN_DEAD_TASKS_SUCCESS,
|
||||
DELETE_DEAD_TASK_SUCCESS,
|
||||
DELETE_RETRY_TASK_SUCCESS,
|
||||
DELETE_SCHEDULED_TASK_SUCCESS,
|
||||
@@ -62,6 +63,14 @@ function snackbarReducer(
|
||||
message: `Dead task ${action.taskKey} deleted`,
|
||||
};
|
||||
|
||||
case BATCH_RUN_DEAD_TASKS_SUCCESS: {
|
||||
const n = action.payload.pending_keys.length;
|
||||
return {
|
||||
isOpen: true,
|
||||
message: `${n} Dead ${n === 1 ? "task is" : "tasks are"} now pending`,
|
||||
};
|
||||
}
|
||||
|
||||
case BATCH_DELETE_DEAD_TASKS_SUCCESS: {
|
||||
const n = action.payload.deleted_keys.length;
|
||||
return {
|
||||
|
@@ -33,6 +33,9 @@ import {
|
||||
RUN_DEAD_TASK_BEGIN,
|
||||
RUN_DEAD_TASK_SUCCESS,
|
||||
RUN_DEAD_TASK_ERROR,
|
||||
BATCH_RUN_DEAD_TASKS_BEGIN,
|
||||
BATCH_RUN_DEAD_TASKS_ERROR,
|
||||
BATCH_RUN_DEAD_TASKS_SUCCESS,
|
||||
} from "../actions/tasksActions";
|
||||
import {
|
||||
ActiveTask,
|
||||
@@ -464,6 +467,7 @@ function tasksReducer(
|
||||
},
|
||||
};
|
||||
|
||||
case BATCH_RUN_DEAD_TASKS_BEGIN:
|
||||
case BATCH_DELETE_DEAD_TASKS_BEGIN:
|
||||
return {
|
||||
...state,
|
||||
@@ -473,6 +477,20 @@ function tasksReducer(
|
||||
},
|
||||
};
|
||||
|
||||
case BATCH_RUN_DEAD_TASKS_SUCCESS: {
|
||||
const newData = state.deadTasks.data.filter(
|
||||
(task) => !action.payload.pending_keys.includes(task.key)
|
||||
);
|
||||
return {
|
||||
...state,
|
||||
deadTasks: {
|
||||
...state.deadTasks,
|
||||
batchActionPending: false,
|
||||
data: newData,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
case BATCH_DELETE_DEAD_TASKS_SUCCESS: {
|
||||
const newData = state.deadTasks.data.filter(
|
||||
(task) => !action.payload.deleted_keys.includes(task.key)
|
||||
@@ -487,6 +505,7 @@ function tasksReducer(
|
||||
};
|
||||
}
|
||||
|
||||
case BATCH_RUN_DEAD_TASKS_ERROR:
|
||||
case BATCH_DELETE_DEAD_TASKS_ERROR:
|
||||
return {
|
||||
...state,
|
||||
|
Reference in New Issue
Block a user