mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-23 14:56:13 +08:00
(ui): Add action buttons to AggregatingTasksTable
This commit is contained in:
@@ -53,6 +53,15 @@ import {
|
||||
DELETE_COMPLETED_TASK_SUCCESS,
|
||||
DELETE_ALL_COMPLETED_TASKS_SUCCESS,
|
||||
BATCH_DELETE_COMPLETED_TASKS_SUCCESS,
|
||||
DELETE_ALL_AGGREGATING_TASKS_SUCCESS,
|
||||
ARCHIVE_ALL_AGGREGATING_TASKS_SUCCESS,
|
||||
RUN_ALL_AGGREGATING_TASKS_SUCCESS,
|
||||
BATCH_DELETE_AGGREGATING_TASKS_SUCCESS,
|
||||
BATCH_RUN_AGGREGATING_TASKS_SUCCESS,
|
||||
BATCH_ARCHIVE_AGGREGATING_TASKS_SUCCESS,
|
||||
DELETE_AGGREGATING_TASK_SUCCESS,
|
||||
RUN_AGGREGATING_TASK_SUCCESS,
|
||||
ARCHIVE_AGGREGATING_TASK_SUCCESS,
|
||||
} from "../actions/tasksActions";
|
||||
import { Queue } from "../api";
|
||||
|
||||
@@ -175,6 +184,23 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case RUN_AGGREGATING_TASK_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
pending: queueInfo.currentStats.pending + 1,
|
||||
aggregating: queueInfo.currentStats.aggregating - 1,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case RUN_SCHEDULED_TASK_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
@@ -243,6 +269,23 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case ARCHIVE_AGGREGATING_TASK_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
archived: queueInfo.currentStats.archived + 1,
|
||||
aggregating: queueInfo.currentStats.aggregating - 1,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case ARCHIVE_SCHEDULED_TASK_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
@@ -311,6 +354,23 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case DELETE_AGGREGATING_TASK_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
size: queueInfo.currentStats.size - 1,
|
||||
aggregating: queueInfo.currentStats.aggregating - 1,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case BATCH_ARCHIVE_PENDING_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
@@ -370,6 +430,24 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case ARCHIVE_ALL_AGGREGATING_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
groups: queueInfo.currentStats.groups - 1,
|
||||
archived: queueInfo.currentStats.archived + action.archived,
|
||||
aggregating: queueInfo.currentStats.aggregating - action.archived,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case DELETE_ALL_PENDING_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
@@ -449,6 +527,24 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case RUN_ALL_AGGREGATING_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
groups: queueInfo.currentStats.groups - 1,
|
||||
pending: queueInfo.currentStats.pending + action.scheduled,
|
||||
aggregating: queueInfo.currentStats.aggregating - action.scheduled,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case RUN_ALL_SCHEDULED_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
@@ -486,6 +582,24 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case DELETE_ALL_AGGREGATING_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
size: queueInfo.currentStats.size - action.deleted,
|
||||
groups: queueInfo.currentStats.groups - 1,
|
||||
aggregating: queueInfo.currentStats.aggregating - action.deleted,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case DELETE_ALL_SCHEDULED_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
@@ -579,6 +693,68 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case BATCH_RUN_AGGREGATING_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_ids.length,
|
||||
aggregating:
|
||||
queueInfo.currentStats.aggregating -
|
||||
action.payload.pending_ids.length,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case BATCH_ARCHIVE_AGGREGATING_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
archived:
|
||||
queueInfo.currentStats.archived +
|
||||
action.payload.archived_ids.length,
|
||||
aggregating:
|
||||
queueInfo.currentStats.aggregating -
|
||||
action.payload.archived_ids.length,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case BATCH_DELETE_AGGREGATING_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
size:
|
||||
queueInfo.currentStats.size - action.payload.deleted_ids.length,
|
||||
aggregating:
|
||||
queueInfo.currentStats.aggregating -
|
||||
action.payload.deleted_ids.length,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case RUN_ALL_RETRY_TASKS_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
|
Reference in New Issue
Block a user