Add delete button for scheduled and dead tasks

This commit is contained in:
Ken Hibino
2020-12-09 06:56:44 -08:00
parent 601a7c8add
commit ce978f4516
7 changed files with 303 additions and 18 deletions

View File

@@ -14,7 +14,9 @@ import {
DELETE_QUEUE_SUCCESS,
} from "../actions/queuesActions";
import {
DELETE_DEAD_TASK_SUCCESS,
DELETE_RETRY_TASK_SUCCESS,
DELETE_SCHEDULED_TASK_SUCCESS,
LIST_ACTIVE_TASKS_SUCCESS,
LIST_DEAD_TASKS_SUCCESS,
LIST_PENDING_TASKS_SUCCESS,
@@ -148,6 +150,22 @@ function queuesReducer(
return { ...state, data: newData };
}
case DELETE_SCHEDULED_TASK_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
return queueInfo;
}
return {
...queueInfo,
currentStats: {
...queueInfo.currentStats,
scheduled: queueInfo.currentStats.scheduled - 1,
},
};
});
return { ...state, data: newData };
}
case DELETE_RETRY_TASK_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
@@ -164,6 +182,22 @@ function queuesReducer(
return { ...state, data: newData };
}
case DELETE_DEAD_TASK_SUCCESS: {
const newData = state.data.map((queueInfo) => {
if (queueInfo.name !== action.queue) {
return queueInfo;
}
return {
...queueInfo,
currentStats: {
...queueInfo.currentStats,
dead: queueInfo.currentStats.dead - 1,
},
};
});
return { ...state, data: newData };
}
default:
return state;
}