mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-23 06:46:11 +08:00
Add redux actions and reducer for pending task delete/archive
This commit is contained in:
@@ -30,6 +30,12 @@ import {
|
||||
RUN_RETRY_TASK_SUCCESS,
|
||||
RUN_SCHEDULED_TASK_SUCCESS,
|
||||
TasksActionTypes,
|
||||
ARCHIVE_PENDING_TASK_SUCCESS,
|
||||
DELETE_PENDING_TASK_SUCCESS,
|
||||
BATCH_ARCHIVE_PENDING_TASKS_SUCCESS,
|
||||
BATCH_DELETE_PENDING_TASKS_SUCCESS,
|
||||
ARCHIVE_ALL_PENDING_TASKS_SUCCESS,
|
||||
DELETE_ALL_PENDING_TASKS_SUCCESS,
|
||||
} from "../actions/tasksActions";
|
||||
|
||||
interface SnackbarState {
|
||||
@@ -89,6 +95,12 @@ function snackbarReducer(
|
||||
message: `Archived task is now pending`,
|
||||
};
|
||||
|
||||
case ARCHIVE_PENDING_TASK_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
message: `Pending task is now archived`,
|
||||
};
|
||||
|
||||
case ARCHIVE_SCHEDULED_TASK_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
@@ -101,6 +113,12 @@ function snackbarReducer(
|
||||
message: `Retry task is now archived`,
|
||||
};
|
||||
|
||||
case DELETE_PENDING_TASK_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
message: `Pending task deleted`,
|
||||
};
|
||||
|
||||
case DELETE_SCHEDULED_TASK_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
@@ -117,6 +135,24 @@ function snackbarReducer(
|
||||
};
|
||||
}
|
||||
|
||||
case BATCH_ARCHIVE_PENDING_TASKS_SUCCESS: {
|
||||
const n = action.payload.archived_keys.length;
|
||||
return {
|
||||
isOpen: true,
|
||||
message: `${n} pending ${
|
||||
n === 1 ? "task is" : "tasks are"
|
||||
} now archived`,
|
||||
};
|
||||
}
|
||||
|
||||
case BATCH_DELETE_PENDING_TASKS_SUCCESS: {
|
||||
const n = action.payload.deleted_keys.length;
|
||||
return {
|
||||
isOpen: true,
|
||||
message: `${n} pending ${n === 1 ? "task" : "tasks"} deleted`,
|
||||
};
|
||||
}
|
||||
|
||||
case BATCH_ARCHIVE_SCHEDULED_TASKS_SUCCESS: {
|
||||
const n = action.payload.archived_keys.length;
|
||||
return {
|
||||
@@ -135,6 +171,18 @@ function snackbarReducer(
|
||||
};
|
||||
}
|
||||
|
||||
case ARCHIVE_ALL_PENDING_TASKS_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
message: "All pending tasks are now archived",
|
||||
};
|
||||
|
||||
case DELETE_ALL_PENDING_TASKS_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
message: "All pending tasks deleted",
|
||||
};
|
||||
|
||||
case RUN_ALL_SCHEDULED_TASKS_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
|
Reference in New Issue
Block a user