Update UI code with new API

This commit is contained in:
Ken Hibino 2021-05-28 15:02:52 -07:00
parent fa313ce180
commit 565dfb4ccf
11 changed files with 317 additions and 714 deletions

View File

@ -351,26 +351,26 @@ interface BatchCancelActiveTasksErrorAction {
interface DeletePendingTaskBeginAction {
type: typeof DELETE_PENDING_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface DeletePendingTaskSuccessAction {
type: typeof DELETE_PENDING_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface DeletePendingTaskErrorAction {
type: typeof DELETE_PENDING_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface BatchDeletePendingTasksBeginAction {
type: typeof BATCH_DELETE_PENDING_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchDeletePendingTasksSuccessAction {
@ -382,7 +382,7 @@ interface BatchDeletePendingTasksSuccessAction {
interface BatchDeletePendingTasksErrorAction {
type: typeof BATCH_DELETE_PENDING_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
@ -406,26 +406,26 @@ interface DeleteAllPendingTasksErrorAction {
interface ArchivePendingTaskBeginAction {
type: typeof ARCHIVE_PENDING_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface ArchivePendingTaskSuccessAction {
type: typeof ARCHIVE_PENDING_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface ArchivePendingTaskErrorAction {
type: typeof ARCHIVE_PENDING_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface BatchArchivePendingTasksBeginAction {
type: typeof BATCH_ARCHIVE_PENDING_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchArchivePendingTasksSuccessAction {
@ -437,7 +437,7 @@ interface BatchArchivePendingTasksSuccessAction {
interface BatchArchivePendingTasksErrorAction {
type: typeof BATCH_ARCHIVE_PENDING_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
@ -460,121 +460,121 @@ interface ArchiveAllPendingTasksErrorAction {
interface RunScheduledTaskBeginAction {
type: typeof RUN_SCHEDULED_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface RunScheduledTaskSuccessAction {
type: typeof RUN_SCHEDULED_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface RunScheduledTaskErrorAction {
type: typeof RUN_SCHEDULED_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface ArchiveScheduledTaskBeginAction {
type: typeof ARCHIVE_SCHEDULED_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface ArchiveScheduledTaskSuccessAction {
type: typeof ARCHIVE_SCHEDULED_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface ArchiveScheduledTaskErrorAction {
type: typeof ARCHIVE_SCHEDULED_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface RunRetryTaskBeginAction {
type: typeof RUN_RETRY_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface RunRetryTaskSuccessAction {
type: typeof RUN_RETRY_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface RunRetryTaskErrorAction {
type: typeof RUN_RETRY_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface ArchiveRetryTaskBeginAction {
type: typeof ARCHIVE_RETRY_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface ArchiveRetryTaskSuccessAction {
type: typeof ARCHIVE_RETRY_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface ArchiveRetryTaskErrorAction {
type: typeof ARCHIVE_RETRY_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface RunArchivedTaskBeginAction {
type: typeof RUN_ARCHIVED_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface RunArchivedTaskSuccessAction {
type: typeof RUN_ARCHIVED_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface RunArchivedTaskErrorAction {
type: typeof RUN_ARCHIVED_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface DeleteScheduledTaskBeginAction {
type: typeof DELETE_SCHEDULED_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface DeleteScheduledTaskSuccessAction {
type: typeof DELETE_SCHEDULED_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface DeleteScheduledTaskErrorAction {
type: typeof DELETE_SCHEDULED_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface BatchDeleteScheduledTasksBeginAction {
type: typeof BATCH_DELETE_SCHEDULED_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchDeleteScheduledTasksSuccessAction {
@ -586,14 +586,14 @@ interface BatchDeleteScheduledTasksSuccessAction {
interface BatchDeleteScheduledTasksErrorAction {
type: typeof BATCH_DELETE_SCHEDULED_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
interface BatchRunScheduledTasksBeginAction {
type: typeof BATCH_RUN_SCHEDULED_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchRunScheduledTasksSuccessAction {
@ -605,7 +605,7 @@ interface BatchRunScheduledTasksSuccessAction {
interface BatchRunScheduledTasksErrorAction {
type: typeof BATCH_RUN_SCHEDULED_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
@ -628,7 +628,7 @@ interface RunAllScheduledTasksErrorAction {
interface BatchArchiveScheduledTasksBeginAction {
type: typeof BATCH_ARCHIVE_SCHEDULED_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchArchiveScheduledTasksSuccessAction {
@ -640,7 +640,7 @@ interface BatchArchiveScheduledTasksSuccessAction {
interface BatchArchiveScheduledTasksErrorAction {
type: typeof BATCH_ARCHIVE_SCHEDULED_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
@ -680,26 +680,26 @@ interface DeleteAllScheduledTasksErrorAction {
interface DeleteRetryTaskBeginAction {
type: typeof DELETE_RETRY_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface DeleteRetryTaskSuccessAction {
type: typeof DELETE_RETRY_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface DeleteRetryTaskErrorAction {
type: typeof DELETE_RETRY_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface BatchDeleteRetryTasksBeginAction {
type: typeof BATCH_DELETE_RETRY_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchDeleteRetryTasksSuccessAction {
@ -711,14 +711,14 @@ interface BatchDeleteRetryTasksSuccessAction {
interface BatchDeleteRetryTasksErrorAction {
type: typeof BATCH_DELETE_RETRY_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
interface BatchRunRetryTasksBeginAction {
type: typeof BATCH_RUN_RETRY_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchRunRetryTasksSuccessAction {
@ -730,7 +730,7 @@ interface BatchRunRetryTasksSuccessAction {
interface BatchRunRetryTasksErrorAction {
type: typeof BATCH_RUN_RETRY_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
@ -753,7 +753,7 @@ interface RunAllRetryTasksErrorAction {
interface BatchArchiveRetryTasksBeginAction {
type: typeof BATCH_ARCHIVE_RETRY_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchArchiveRetryTasksSuccessAction {
@ -765,7 +765,7 @@ interface BatchArchiveRetryTasksSuccessAction {
interface BatchArchiveRetryTasksErrorAction {
type: typeof BATCH_ARCHIVE_RETRY_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
@ -805,26 +805,26 @@ interface DeleteAllRetryTasksErrorAction {
interface DeleteArchivedTaskBeginAction {
type: typeof DELETE_ARCHIVED_TASK_BEGIN;
queue: string;
taskKey: string;
taskId: string;
}
interface DeleteArchivedTaskSuccessAction {
type: typeof DELETE_ARCHIVED_TASK_SUCCESS;
queue: string;
taskKey: string;
taskId: string;
}
interface DeleteArchivedTaskErrorAction {
type: typeof DELETE_ARCHIVED_TASK_ERROR;
queue: string;
taskKey: string;
taskId: string;
error: string;
}
interface BatchDeleteArchivedTasksBeginAction {
type: typeof BATCH_DELETE_ARCHIVED_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchDeleteArchivedTasksSuccessAction {
@ -836,14 +836,14 @@ interface BatchDeleteArchivedTasksSuccessAction {
interface BatchDeleteArchivedTasksErrorAction {
type: typeof BATCH_DELETE_ARCHIVED_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
interface BatchRunArchivedTasksBeginAction {
type: typeof BATCH_RUN_ARCHIVED_TASKS_BEGIN;
queue: string;
taskKeys: string[];
taskIds: string[];
}
interface BatchRunArchivedTasksSuccessAction {
@ -855,7 +855,7 @@ interface BatchRunArchivedTasksSuccessAction {
interface BatchRunArchivedTasksErrorAction {
type: typeof BATCH_RUN_ARCHIVED_TASKS_ERROR;
queue: string;
taskKeys: string[];
taskIds: string[];
error: string;
}
@ -1210,12 +1210,12 @@ export function batchCancelActiveTasksAsync(queue: string, taskIds: string[]) {
};
}
export function runScheduledTaskAsync(queue: string, taskKey: string) {
export function runScheduledTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: RUN_SCHEDULED_TASK_BEGIN, queue, taskKey });
dispatch({ type: RUN_SCHEDULED_TASK_BEGIN, queue, taskId });
try {
await runScheduledTask(queue, taskKey);
dispatch({ type: RUN_SCHEDULED_TASK_SUCCESS, queue, taskKey });
await runScheduledTask(queue, taskId);
dispatch({ type: RUN_SCHEDULED_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"runScheduledTaskAsync: ",
@ -1225,36 +1225,36 @@ export function runScheduledTaskAsync(queue: string, taskKey: string) {
type: RUN_SCHEDULED_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
}
export function runRetryTaskAsync(queue: string, taskKey: string) {
export function runRetryTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: RUN_RETRY_TASK_BEGIN, queue, taskKey });
dispatch({ type: RUN_RETRY_TASK_BEGIN, queue, taskId });
try {
await runRetryTask(queue, taskKey);
dispatch({ type: RUN_RETRY_TASK_SUCCESS, queue, taskKey });
await runRetryTask(queue, taskId);
dispatch({ type: RUN_RETRY_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error("runRetryTaskAsync: ", toErrorStringWithHttpStatus(error));
dispatch({
type: RUN_RETRY_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
}
export function archivePendingTaskAsync(queue: string, taskKey: string) {
export function archivePendingTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: ARCHIVE_PENDING_TASK_BEGIN, queue, taskKey });
dispatch({ type: ARCHIVE_PENDING_TASK_BEGIN, queue, taskId });
try {
await archivePendingTask(queue, taskKey);
dispatch({ type: ARCHIVE_PENDING_TASK_SUCCESS, queue, taskKey });
await archivePendingTask(queue, taskId);
dispatch({ type: ARCHIVE_PENDING_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"archivePendingTaskAsync: ",
@ -1264,18 +1264,18 @@ export function archivePendingTaskAsync(queue: string, taskKey: string) {
type: ARCHIVE_PENDING_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
}
export function archiveScheduledTaskAsync(queue: string, taskKey: string) {
export function archiveScheduledTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: ARCHIVE_SCHEDULED_TASK_BEGIN, queue, taskKey });
dispatch({ type: ARCHIVE_SCHEDULED_TASK_BEGIN, queue, taskId });
try {
await archiveScheduledTask(queue, taskKey);
dispatch({ type: ARCHIVE_SCHEDULED_TASK_SUCCESS, queue, taskKey });
await archiveScheduledTask(queue, taskId);
dispatch({ type: ARCHIVE_SCHEDULED_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"archiveScheduledTaskAsync: ",
@ -1285,18 +1285,18 @@ export function archiveScheduledTaskAsync(queue: string, taskKey: string) {
type: ARCHIVE_SCHEDULED_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
}
export function archiveRetryTaskAsync(queue: string, taskKey: string) {
export function archiveRetryTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: ARCHIVE_RETRY_TASK_BEGIN, queue, taskKey });
dispatch({ type: ARCHIVE_RETRY_TASK_BEGIN, queue, taskId });
try {
await archiveRetryTask(queue, taskKey);
dispatch({ type: ARCHIVE_RETRY_TASK_SUCCESS, queue, taskKey });
await archiveRetryTask(queue, taskId);
dispatch({ type: ARCHIVE_RETRY_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"archiveRetryTaskAsync: ",
@ -1306,18 +1306,18 @@ export function archiveRetryTaskAsync(queue: string, taskKey: string) {
type: ARCHIVE_RETRY_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
}
export function runArchivedTaskAsync(queue: string, taskKey: string) {
export function runArchivedTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: RUN_ARCHIVED_TASK_BEGIN, queue, taskKey });
dispatch({ type: RUN_ARCHIVED_TASK_BEGIN, queue, taskId });
try {
await runArchivedTask(queue, taskKey);
dispatch({ type: RUN_ARCHIVED_TASK_SUCCESS, queue, taskKey });
await runArchivedTask(queue, taskId);
dispatch({ type: RUN_ARCHIVED_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"runArchivedTaskAsync: ",
@ -1327,18 +1327,18 @@ export function runArchivedTaskAsync(queue: string, taskKey: string) {
type: RUN_ARCHIVED_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
}
export function deletePendingTaskAsync(queue: string, taskKey: string) {
export function deletePendingTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: DELETE_PENDING_TASK_BEGIN, queue, taskKey });
dispatch({ type: DELETE_PENDING_TASK_BEGIN, queue, taskId });
try {
await deletePendingTask(queue, taskKey);
dispatch({ type: DELETE_PENDING_TASK_SUCCESS, queue, taskKey });
await deletePendingTask(queue, taskId);
dispatch({ type: DELETE_PENDING_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"deletePendingTaskAsync: ",
@ -1348,7 +1348,7 @@ export function deletePendingTaskAsync(queue: string, taskKey: string) {
type: DELETE_PENDING_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
@ -1356,12 +1356,12 @@ export function deletePendingTaskAsync(queue: string, taskKey: string) {
export function batchDeletePendingTasksAsync(
queue: string,
taskKeys: string[]
taskIds: string[]
) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_DELETE_PENDING_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_DELETE_PENDING_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchDeletePendingTasks(queue, taskKeys);
const response = await batchDeletePendingTasks(queue, taskIds);
dispatch({
type: BATCH_DELETE_PENDING_TASKS_SUCCESS,
queue: queue,
@ -1376,18 +1376,18 @@ export function batchDeletePendingTasksAsync(
type: BATCH_DELETE_PENDING_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
}
export function deleteScheduledTaskAsync(queue: string, taskKey: string) {
export function deleteScheduledTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: DELETE_SCHEDULED_TASK_BEGIN, queue, taskKey });
dispatch({ type: DELETE_SCHEDULED_TASK_BEGIN, queue, taskId });
try {
await deleteScheduledTask(queue, taskKey);
dispatch({ type: DELETE_SCHEDULED_TASK_SUCCESS, queue, taskKey });
await deleteScheduledTask(queue, taskId);
dispatch({ type: DELETE_SCHEDULED_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"deleteScheduledTaskAsync: ",
@ -1397,7 +1397,7 @@ export function deleteScheduledTaskAsync(queue: string, taskKey: string) {
type: DELETE_SCHEDULED_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
@ -1405,12 +1405,12 @@ export function deleteScheduledTaskAsync(queue: string, taskKey: string) {
export function batchDeleteScheduledTasksAsync(
queue: string,
taskKeys: string[]
taskIds: string[]
) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_DELETE_SCHEDULED_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_DELETE_SCHEDULED_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchDeleteScheduledTasks(queue, taskKeys);
const response = await batchDeleteScheduledTasks(queue, taskIds);
dispatch({
type: BATCH_DELETE_SCHEDULED_TASKS_SUCCESS,
queue: queue,
@ -1425,17 +1425,17 @@ export function batchDeleteScheduledTasksAsync(
type: BATCH_DELETE_SCHEDULED_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
}
export function batchRunScheduledTasksAsync(queue: string, taskKeys: string[]) {
export function batchRunScheduledTasksAsync(queue: string, taskIds: string[]) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_RUN_SCHEDULED_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_RUN_SCHEDULED_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchRunScheduledTasks(queue, taskKeys);
const response = await batchRunScheduledTasks(queue, taskIds);
dispatch({
type: BATCH_RUN_SCHEDULED_TASKS_SUCCESS,
queue: queue,
@ -1450,7 +1450,7 @@ export function batchRunScheduledTasksAsync(queue: string, taskKeys: string[]) {
type: BATCH_RUN_SCHEDULED_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
@ -1458,12 +1458,12 @@ export function batchRunScheduledTasksAsync(queue: string, taskKeys: string[]) {
export function batchArchiveScheduledTasksAsync(
queue: string,
taskKeys: string[]
taskIds: string[]
) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_ARCHIVE_SCHEDULED_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_ARCHIVE_SCHEDULED_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchArchiveScheduledTasks(queue, taskKeys);
const response = await batchArchiveScheduledTasks(queue, taskIds);
dispatch({
type: BATCH_ARCHIVE_SCHEDULED_TASKS_SUCCESS,
queue: queue,
@ -1478,7 +1478,7 @@ export function batchArchiveScheduledTasksAsync(
type: BATCH_ARCHIVE_SCHEDULED_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
@ -1486,12 +1486,12 @@ export function batchArchiveScheduledTasksAsync(
export function batchArchivePendingTasksAsync(
queue: string,
taskKeys: string[]
taskIds: string[]
) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_ARCHIVE_PENDING_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_ARCHIVE_PENDING_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchArchivePendingTasks(queue, taskKeys);
const response = await batchArchivePendingTasks(queue, taskIds);
dispatch({
type: BATCH_ARCHIVE_PENDING_TASKS_SUCCESS,
queue: queue,
@ -1506,7 +1506,7 @@ export function batchArchivePendingTasksAsync(
type: BATCH_ARCHIVE_PENDING_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
@ -1620,12 +1620,12 @@ export function archiveAllScheduledTasksAsync(queue: string) {
};
}
export function deleteRetryTaskAsync(queue: string, taskKey: string) {
export function deleteRetryTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: DELETE_RETRY_TASK_BEGIN, queue, taskKey });
dispatch({ type: DELETE_RETRY_TASK_BEGIN, queue, taskId });
try {
await deleteRetryTask(queue, taskKey);
dispatch({ type: DELETE_RETRY_TASK_SUCCESS, queue, taskKey });
await deleteRetryTask(queue, taskId);
dispatch({ type: DELETE_RETRY_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"deleteRetryTaskAsync: ",
@ -1635,17 +1635,17 @@ export function deleteRetryTaskAsync(queue: string, taskKey: string) {
type: DELETE_RETRY_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
}
export function batchDeleteRetryTasksAsync(queue: string, taskKeys: string[]) {
export function batchDeleteRetryTasksAsync(queue: string, taskIds: string[]) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_DELETE_RETRY_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_DELETE_RETRY_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchDeleteRetryTasks(queue, taskKeys);
const response = await batchDeleteRetryTasks(queue, taskIds);
dispatch({
type: BATCH_DELETE_RETRY_TASKS_SUCCESS,
queue: queue,
@ -1660,17 +1660,17 @@ export function batchDeleteRetryTasksAsync(queue: string, taskKeys: string[]) {
type: BATCH_DELETE_RETRY_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
}
export function batchRunRetryTasksAsync(queue: string, taskKeys: string[]) {
export function batchRunRetryTasksAsync(queue: string, taskIds: string[]) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_RUN_RETRY_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_RUN_RETRY_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchRunRetryTasks(queue, taskKeys);
const response = await batchRunRetryTasks(queue, taskIds);
dispatch({
type: BATCH_RUN_RETRY_TASKS_SUCCESS,
queue: queue,
@ -1685,17 +1685,17 @@ export function batchRunRetryTasksAsync(queue: string, taskKeys: string[]) {
type: BATCH_RUN_RETRY_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
}
export function batchArchiveRetryTasksAsync(queue: string, taskKeys: string[]) {
export function batchArchiveRetryTasksAsync(queue: string, taskIds: string[]) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_ARCHIVE_RETRY_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_ARCHIVE_RETRY_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchArchiveRetryTasks(queue, taskKeys);
const response = await batchArchiveRetryTasks(queue, taskIds);
dispatch({
type: BATCH_ARCHIVE_RETRY_TASKS_SUCCESS,
queue: queue,
@ -1710,7 +1710,7 @@ export function batchArchiveRetryTasksAsync(queue: string, taskKeys: string[]) {
type: BATCH_ARCHIVE_RETRY_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
@ -1780,12 +1780,12 @@ export function archiveAllRetryTasksAsync(queue: string) {
};
}
export function deleteArchivedTaskAsync(queue: string, taskKey: string) {
export function deleteArchivedTaskAsync(queue: string, taskId: string) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: DELETE_ARCHIVED_TASK_BEGIN, queue, taskKey });
dispatch({ type: DELETE_ARCHIVED_TASK_BEGIN, queue, taskId });
try {
await deleteArchivedTask(queue, taskKey);
dispatch({ type: DELETE_ARCHIVED_TASK_SUCCESS, queue, taskKey });
await deleteArchivedTask(queue, taskId);
dispatch({ type: DELETE_ARCHIVED_TASK_SUCCESS, queue, taskId });
} catch (error) {
console.error(
"deleteArchivedTaskAsync: ",
@ -1795,7 +1795,7 @@ export function deleteArchivedTaskAsync(queue: string, taskKey: string) {
type: DELETE_ARCHIVED_TASK_ERROR,
error: toErrorString(error),
queue,
taskKey,
taskId,
});
}
};
@ -1803,12 +1803,12 @@ export function deleteArchivedTaskAsync(queue: string, taskKey: string) {
export function batchDeleteArchivedTasksAsync(
queue: string,
taskKeys: string[]
taskIds: string[]
) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_DELETE_ARCHIVED_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_DELETE_ARCHIVED_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchDeleteArchivedTasks(queue, taskKeys);
const response = await batchDeleteArchivedTasks(queue, taskIds);
dispatch({
type: BATCH_DELETE_ARCHIVED_TASKS_SUCCESS,
queue: queue,
@ -1823,17 +1823,17 @@ export function batchDeleteArchivedTasksAsync(
type: BATCH_DELETE_ARCHIVED_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};
}
export function batchRunArchivedTasksAsync(queue: string, taskKeys: string[]) {
export function batchRunArchivedTasksAsync(queue: string, taskIds: string[]) {
return async (dispatch: Dispatch<TasksActionTypes>) => {
dispatch({ type: BATCH_RUN_ARCHIVED_TASKS_BEGIN, queue, taskKeys });
dispatch({ type: BATCH_RUN_ARCHIVED_TASKS_BEGIN, queue, taskIds });
try {
const response = await batchRunArchivedTasks(queue, taskKeys);
const response = await batchRunArchivedTasks(queue, taskIds);
dispatch({
type: BATCH_RUN_ARCHIVED_TASKS_SUCCESS,
queue: queue,
@ -1848,7 +1848,7 @@ export function batchRunArchivedTasksAsync(queue: string, taskKeys: string[]) {
type: BATCH_RUN_ARCHIVED_TASKS_ERROR,
error: toErrorString(error),
queue,
taskKeys,
taskIds,
});
}
};

View File

@ -54,18 +54,18 @@ export interface BatchCancelTasksResponse {
}
export interface BatchDeleteTasksResponse {
deleted_keys: string[];
failed_keys: string[];
deleted_ids: string[];
failed_ids: string[];
}
export interface BatchRunTasksResponse {
pending_keys: string[];
error_keys: string[];
pending_ids: string[];
error_ids: string[];
}
export interface BatchArchiveTasksResponse {
archived_keys: string[];
error_keys: string[];
archived_ids: string[];
error_ids: string[];
}
export interface DeleteAllTasksResponse {
@ -257,7 +257,6 @@ export interface ActiveTask extends BaseTask {
export interface PendingTask extends BaseTask {
id: string;
key: string;
queue: string;
max_retry: number;
retried: number;
@ -266,7 +265,6 @@ export interface PendingTask extends BaseTask {
export interface ScheduledTask extends BaseTask {
id: string;
key: string;
queue: string;
max_retry: number;
retried: number;
@ -276,7 +274,6 @@ export interface ScheduledTask extends BaseTask {
export interface RetryTask extends BaseTask {
id: string;
key: string;
queue: string;
next_process_at: string;
max_retry: number;
@ -286,7 +283,6 @@ export interface RetryTask extends BaseTask {
export interface ArchivedTask extends BaseTask {
id: string;
key: string;
queue: string;
max_retry: number;
retried: number;
@ -307,7 +303,10 @@ export interface ServerInfo {
}
export interface WorkerInfo {
task: ActiveTask;
task_id: string;
queue: string;
task_type: string;
task_payload: string;
start_time: string;
}
@ -478,23 +477,23 @@ export async function listArchivedTasks(
export async function archivePendingTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/pending_tasks/${taskKey}:archive`,
url: `${BASE_URL}/queues/${qname}/pending_tasks/${taskId}:archive`,
});
}
export async function batchArchivePendingTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchArchiveTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/pending_tasks:batch_archive`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -509,23 +508,23 @@ export async function archiveAllPendingTasks(qname: string): Promise<void> {
export async function deletePendingTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "delete",
url: `${BASE_URL}/queues/${qname}/pending_tasks/${taskKey}`,
url: `${BASE_URL}/queues/${qname}/pending_tasks/${taskId}`,
});
}
export async function batchDeletePendingTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchDeleteTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/pending_tasks:batch_delete`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -543,43 +542,43 @@ export async function deleteAllPendingTasks(
export async function runScheduledTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks/${taskKey}:run`,
url: `${BASE_URL}/queues/${qname}/scheduled_tasks/${taskId}:run`,
});
}
export async function archiveScheduledTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks/${taskKey}:archive`,
url: `${BASE_URL}/queues/${qname}/scheduled_tasks/${taskId}:archive`,
});
}
export async function deleteScheduledTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "delete",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks/${taskKey}`,
url: `${BASE_URL}/queues/${qname}/scheduled_tasks/${taskId}`,
});
}
export async function batchDeleteScheduledTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchDeleteTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks:batch_delete`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -597,13 +596,13 @@ export async function deleteAllScheduledTasks(
export async function batchRunScheduledTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchRunTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks:batch_run`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -618,13 +617,13 @@ export async function runAllScheduledTasks(qname: string): Promise<void> {
export async function batchArchiveScheduledTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchArchiveTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/scheduled_tasks:batch_archive`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -639,43 +638,43 @@ export async function archiveAllScheduledTasks(qname: string): Promise<void> {
export async function runRetryTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/retry_tasks/${taskKey}:run`,
url: `${BASE_URL}/queues/${qname}/retry_tasks/${taskId}:run`,
});
}
export async function archiveRetryTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/retry_tasks/${taskKey}:archive`,
url: `${BASE_URL}/queues/${qname}/retry_tasks/${taskId}:archive`,
});
}
export async function deleteRetryTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "delete",
url: `${BASE_URL}/queues/${qname}/retry_tasks/${taskKey}`,
url: `${BASE_URL}/queues/${qname}/retry_tasks/${taskId}`,
});
}
export async function batchDeleteRetryTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchDeleteTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/retry_tasks:batch_delete`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -693,13 +692,13 @@ export async function deleteAllRetryTasks(
export async function batchRunRetryTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchRunTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/retry_tasks:batch_run`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -714,13 +713,13 @@ export async function runAllRetryTasks(qname: string): Promise<void> {
export async function batchArchiveRetryTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchArchiveTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/retry_tasks:batch_archive`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -735,33 +734,33 @@ export async function archiveAllRetryTasks(qname: string): Promise<void> {
export async function runArchivedTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/archived_tasks/${taskKey}:run`,
url: `${BASE_URL}/queues/${qname}/archived_tasks/${taskId}:run`,
});
}
export async function deleteArchivedTask(
qname: string,
taskKey: string
taskId: string
): Promise<void> {
await axios({
method: "delete",
url: `${BASE_URL}/queues/${qname}/archived_tasks/${taskKey}`,
url: `${BASE_URL}/queues/${qname}/archived_tasks/${taskId}`,
});
}
export async function batchDeleteArchivedTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchDeleteTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/archived_tasks:batch_delete`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;
@ -779,13 +778,13 @@ export async function deleteAllArchivedTasks(
export async function batchRunArchivedTasks(
qname: string,
taskKeys: string[]
taskIds: string[]
): Promise<BatchRunTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/archived_tasks:batch_run`,
data: {
task_keys: taskKeys,
task_ids: taskIds,
},
});
return resp.data;

View File

@ -91,7 +91,7 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
const { pollInterval, listArchivedTasksAsync, queue, pageSize } = props;
const classes = useStyles();
const [page, setPage] = useState(0);
const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
const [selectedIds, setSelectedIds] = useState<string[]>([]);
const [activeTaskId, setActiveTaskId] = useState<string>("");
const handleChangePage = (
@ -110,10 +110,10 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
const handleSelectAllClick = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.checked) {
const newSelected = props.tasks.map((t) => t.key);
setSelectedKeys(newSelected);
const newSelected = props.tasks.map((t) => t.id);
setSelectedIds(newSelected);
} else {
setSelectedKeys([]);
setSelectedIds([]);
}
};
@ -127,14 +127,14 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
const handleBatchRunClick = () => {
props
.batchRunArchivedTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchRunArchivedTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const handleBatchDeleteClick = () => {
props
.batchDeleteArchivedTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchDeleteArchivedTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const fetchData = useCallback(() => {
@ -171,7 +171,7 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
];
const rowCount = props.tasks.length;
const numSelected = selectedKeys.length;
const numSelected = selectedIds.length;
return (
<div>
<TableActions
@ -239,23 +239,21 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
<TableBody>
{props.tasks.map((task) => (
<Row
key={task.key}
key={task.id}
task={task}
isSelected={selectedKeys.includes(task.key)}
isSelected={selectedIds.includes(task.id)}
onSelectChange={(checked: boolean) => {
if (checked) {
setSelectedKeys(selectedKeys.concat(task.key));
setSelectedIds(selectedIds.concat(task.id));
} else {
setSelectedKeys(
selectedKeys.filter((key) => key !== task.key)
);
setSelectedIds(selectedIds.filter((id) => id !== task.id));
}
}}
onRunClick={() => {
props.runArchivedTaskAsync(queue, task.key);
props.runArchivedTaskAsync(queue, task.id);
}}
onDeleteClick={() => {
props.deleteArchivedTaskAsync(queue, task.key);
props.deleteArchivedTaskAsync(queue, task.id);
}}
allActionPending={props.allActionPending}
onActionCellEnter={() => setActiveTaskId(task.id)}

View File

@ -1,388 +0,0 @@
import React, { useCallback, useState } from "react";
import clsx from "clsx";
import { connect, ConnectedProps } from "react-redux";
import { makeStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import Checkbox from "@material-ui/core/Checkbox";
import TableContainer from "@material-ui/core/TableContainer";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import Tooltip from "@material-ui/core/Tooltip";
import Paper from "@material-ui/core/Paper";
import Box from "@material-ui/core/Box";
import Collapse from "@material-ui/core/Collapse";
import IconButton from "@material-ui/core/IconButton";
import PlayArrowIcon from "@material-ui/icons/PlayArrow";
import DeleteIcon from "@material-ui/icons/Delete";
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
import KeyboardArrowUpIcon from "@material-ui/icons/KeyboardArrowUp";
import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown";
import Typography from "@material-ui/core/Typography";
import TableFooter from "@material-ui/core/TableFooter";
import TablePagination from "@material-ui/core/TablePagination";
import Alert from "@material-ui/lab/Alert";
import AlertTitle from "@material-ui/lab/AlertTitle";
import SyntaxHighlighter from "./SyntaxHighlighter";
import { AppState } from "../store";
import {
batchDeleteArchivedTasksAsync,
batchRunArchivedTasksAsync,
deleteArchivedTaskAsync,
deleteAllArchivedTasksAsync,
listArchivedTasksAsync,
runArchivedTaskAsync,
runAllArchivedTasksAsync,
} from "../actions/tasksActions";
import TablePaginationActions, {
defaultPageSize,
rowsPerPageOptions,
} from "./TablePaginationActions";
import TableActions from "./TableActions";
import { timeAgo, uuidPrefix } from "../utils";
import { usePolling } from "../hooks";
import { ArchivedTaskExtended } from "../reducers/tasksReducer";
import { TableColumn } from "../types/table";
const useStyles = makeStyles({
table: {
minWidth: 650,
},
});
const useRowStyles = makeStyles({
root: {
"& > *": {
borderBottom: "unset",
},
},
actionCell: {
width: "96px",
},
activeActionCell: {
display: "flex",
justifyContent: "space-between",
},
});
function mapStateToProps(state: AppState) {
return {
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 = {
listArchivedTasksAsync,
runArchivedTaskAsync,
runAllArchivedTasksAsync,
deleteArchivedTaskAsync,
deleteAllArchivedTasksAsync,
batchRunArchivedTasksAsync,
batchDeleteArchivedTasksAsync,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
type ReduxProps = ConnectedProps<typeof connector>;
interface Props {
queue: string; // name of the queue.
totalTaskCount: number; // totoal number of archived tasks.
}
function ArchivedTasksTable(props: Props & ReduxProps) {
const { pollInterval, listArchivedTasksAsync, queue } = props;
const classes = useStyles();
const [page, setPage] = useState(0);
const [pageSize, setPageSize] = useState(defaultPageSize);
const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
const [activeTaskId, setActiveTaskId] = useState<string>("");
const handleChangePage = (
event: React.MouseEvent<HTMLButtonElement> | null,
newPage: number
) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (
event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
) => {
setPageSize(parseInt(event.target.value, 10));
setPage(0);
};
const handleSelectAllClick = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.checked) {
const newSelected = props.tasks.map((t) => t.key);
setSelectedKeys(newSelected);
} else {
setSelectedKeys([]);
}
};
const handleRunAllClick = () => {
props.runAllArchivedTasksAsync(queue);
};
const handleDeleteAllClick = () => {
props.deleteAllArchivedTasksAsync(queue);
};
const handleBatchRunClick = () => {
props
.batchRunArchivedTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
};
const handleBatchDeleteClick = () => {
props
.batchDeleteArchivedTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
};
const fetchData = useCallback(() => {
const pageOpts = { page: page + 1, size: pageSize };
listArchivedTasksAsync(queue, pageOpts);
}, [page, pageSize, queue, listArchivedTasksAsync]);
usePolling(fetchData, pollInterval);
if (props.tasks.length === 0) {
return (
<Alert severity="info">
<AlertTitle>Info</AlertTitle>
No archived tasks at this time.
</Alert>
);
}
const columns: TableColumn[] = [
{ key: "icon", label: "", align: "left" },
{ key: "id", label: "ID", align: "left" },
{ key: "type", label: "Type", align: "left" },
{ key: "last_failed", label: "Last Failed", align: "left" },
{ key: "last_error", label: "Last Error", align: "left" },
{ key: "actions", label: "Actions", align: "center" },
];
const rowCount = props.tasks.length;
const numSelected = selectedKeys.length;
return (
<div>
<TableActions
showIconButtons={numSelected > 0}
iconButtonActions={[
{
tooltip: "Delete",
icon: <DeleteIcon />,
onClick: handleBatchDeleteClick,
disabled: props.batchActionPending,
},
{
tooltip: "Run",
icon: <PlayArrowIcon />,
onClick: handleBatchRunClick,
disabled: props.batchActionPending,
},
]}
menuItemActions={[
{
label: "Delete All",
onClick: handleDeleteAllClick,
disabled: props.allActionPending,
},
{
label: "Run All",
onClick: handleRunAllClick,
disabled: props.allActionPending,
},
]}
/>
<TableContainer component={Paper}>
<Table
stickyHeader={true}
className={classes.table}
aria-label="archived tasks table"
size="small"
>
<TableHead>
<TableRow>
<TableCell padding="checkbox">
<Checkbox
indeterminate={numSelected > 0 && numSelected < rowCount}
checked={rowCount > 0 && numSelected === rowCount}
onChange={handleSelectAllClick}
inputProps={{
"aria-label": "select all tasks shown in the table",
}}
/>
</TableCell>
{columns.map((col) => (
<TableCell key={col.key} align={col.align}>
{col.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{props.tasks.map((task) => (
<Row
key={task.key}
task={task}
isSelected={selectedKeys.includes(task.key)}
onSelectChange={(checked: boolean) => {
if (checked) {
setSelectedKeys(selectedKeys.concat(task.key));
} else {
setSelectedKeys(
selectedKeys.filter((key) => key !== task.key)
);
}
}}
onRunClick={() => {
props.runArchivedTaskAsync(queue, task.key);
}}
onDeleteClick={() => {
props.deleteArchivedTaskAsync(queue, task.key);
}}
allActionPending={props.allActionPending}
onActionCellEnter={() => setActiveTaskId(task.id)}
onActionCellLeave={() => setActiveTaskId("")}
showActions={activeTaskId === task.id}
/>
))}
</TableBody>
<TableFooter>
<TableRow>
<TablePagination
rowsPerPageOptions={rowsPerPageOptions}
colSpan={columns.length + 1 /* checkbox col */}
count={props.totalTaskCount}
rowsPerPage={pageSize}
page={page}
SelectProps={{
inputProps: { "aria-label": "rows per page" },
native: true,
}}
onChangePage={handleChangePage}
onChangeRowsPerPage={handleChangeRowsPerPage}
ActionsComponent={TablePaginationActions}
/>
</TableRow>
</TableFooter>
</Table>
</TableContainer>
</div>
);
}
interface RowProps {
task: ArchivedTaskExtended;
isSelected: boolean;
onSelectChange: (checked: boolean) => void;
onRunClick: () => void;
onDeleteClick: () => void;
allActionPending: boolean;
showActions: boolean;
onActionCellEnter: () => void;
onActionCellLeave: () => void;
}
function Row(props: RowProps) {
const { task } = props;
const [open, setOpen] = useState(false);
const classes = useRowStyles();
return (
<React.Fragment>
<TableRow
key={task.id}
className={classes.root}
selected={props.isSelected}
>
<TableCell padding="checkbox">
<Checkbox
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
props.onSelectChange(event.target.checked)
}
checked={props.isSelected}
/>
</TableCell>
<TableCell>
<Tooltip title={open ? "Hide Details" : "Show Details"}>
<IconButton
aria-label="expand row"
size="small"
onClick={() => setOpen(!open)}
>
{open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
</IconButton>
</Tooltip>
</TableCell>
<TableCell component="th" scope="row">
{uuidPrefix(task.id)}
</TableCell>
<TableCell>{task.type}</TableCell>
<TableCell>{timeAgo(task.last_failed_at)}</TableCell>
<TableCell>{task.error_message}</TableCell>
<TableCell
align="center"
className={clsx(
classes.actionCell,
props.showActions && classes.activeActionCell
)}
onMouseEnter={props.onActionCellEnter}
onMouseLeave={props.onActionCellLeave}
>
{props.showActions ? (
<React.Fragment>
<Tooltip title="Delete">
<IconButton
onClick={props.onDeleteClick}
disabled={task.requestPending || props.allActionPending}
size="small"
>
<DeleteIcon fontSize="small" />
</IconButton>
</Tooltip>
<Tooltip title="Run">
<IconButton
onClick={props.onRunClick}
disabled={task.requestPending || props.allActionPending}
size="small"
>
<PlayArrowIcon fontSize="small" />
</IconButton>
</Tooltip>
</React.Fragment>
) : (
<IconButton size="small" onClick={props.onActionCellEnter}>
<MoreHorizIcon fontSize="small" />
</IconButton>
)}
</TableCell>
</TableRow>
<TableRow selected={props.isSelected}>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={7}>
<Collapse in={open} timeout="auto" unmountOnExit>
<Box margin={1}>
<Typography variant="h6" gutterBottom component="div">
Payload
</Typography>
<SyntaxHighlighter language="json">
{JSON.stringify(task.payload, null, 2)}
</SyntaxHighlighter>
</Box>
</Collapse>
</TableCell>
</TableRow>
</React.Fragment>
);
}
export default connector(ArchivedTasksTable);

View File

@ -91,7 +91,7 @@ function PendingTasksTable(props: Props & ReduxProps) {
const { pollInterval, listPendingTasksAsync, queue, pageSize } = props;
const classes = useStyles();
const [page, setPage] = useState(0);
const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
const [selectedIds, setSelectedIds] = useState<string[]>([]);
const [activeTaskId, setActiveTaskId] = useState<string>("");
const handleChangePage = (
@ -110,10 +110,10 @@ function PendingTasksTable(props: Props & ReduxProps) {
const handleSelectAllClick = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.checked) {
const newSelected = props.tasks.map((t) => t.key);
setSelectedKeys(newSelected);
const newSelected = props.tasks.map((t) => t.id);
setSelectedIds(newSelected);
} else {
setSelectedKeys([]);
setSelectedIds([]);
}
};
@ -127,14 +127,14 @@ function PendingTasksTable(props: Props & ReduxProps) {
const handleBatchDeleteClick = () => {
props
.batchDeletePendingTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchDeletePendingTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const handleBatchArchiveClick = () => {
props
.batchArchivePendingTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchArchivePendingTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const fetchData = useCallback(() => {
@ -171,7 +171,7 @@ function PendingTasksTable(props: Props & ReduxProps) {
];
const rowCount = props.tasks.length;
const numSelected = selectedKeys.length;
const numSelected = selectedIds.length;
return (
<div>
<TableActions
@ -243,22 +243,20 @@ function PendingTasksTable(props: Props & ReduxProps) {
<Row
key={task.id}
task={task}
isSelected={selectedKeys.includes(task.key)}
isSelected={selectedIds.includes(task.id)}
onSelectChange={(checked: boolean) => {
if (checked) {
setSelectedKeys(selectedKeys.concat(task.key));
setSelectedIds(selectedIds.concat(task.id));
} else {
setSelectedKeys(
selectedKeys.filter((key) => key !== task.key)
);
setSelectedIds(selectedIds.filter((id) => id !== task.id));
}
}}
allActionPending={props.allActionPending}
onDeleteClick={() =>
props.deletePendingTaskAsync(queue, task.key)
props.deletePendingTaskAsync(queue, task.id)
}
onArchiveClick={() => {
props.archivePendingTaskAsync(queue, task.key);
props.archivePendingTaskAsync(queue, task.id);
}}
onActionCellEnter={() => setActiveTaskId(task.id)}
onActionCellLeave={() => setActiveTaskId("")}

View File

@ -98,7 +98,7 @@ function RetryTasksTable(props: Props & ReduxProps) {
const { pollInterval, listRetryTasksAsync, queue, pageSize } = props;
const classes = useStyles();
const [page, setPage] = useState(0);
const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
const [selectedIds, setSelectedIds] = useState<string[]>([]);
const [activeTaskId, setActiveTaskId] = useState<string>("");
const handleChangePage = (
@ -117,10 +117,10 @@ function RetryTasksTable(props: Props & ReduxProps) {
const handleSelectAllClick = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.checked) {
const newSelected = props.tasks.map((t) => t.key);
setSelectedKeys(newSelected);
const newSelected = props.tasks.map((t) => t.id);
setSelectedIds(newSelected);
} else {
setSelectedKeys([]);
setSelectedIds([]);
}
};
@ -138,20 +138,20 @@ function RetryTasksTable(props: Props & ReduxProps) {
const handleBatchRunClick = () => {
props
.batchRunRetryTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchRunRetryTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const handleBatchDeleteClick = () => {
props
.batchDeleteRetryTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchDeleteRetryTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const handleBatchArchiveClick = () => {
props
.batchArchiveRetryTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchArchiveRetryTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const fetchData = useCallback(() => {
@ -190,7 +190,7 @@ function RetryTasksTable(props: Props & ReduxProps) {
];
const rowCount = props.tasks.length;
const numSelected = selectedKeys.length;
const numSelected = selectedIds.length;
return (
<div>
<TableActions
@ -272,24 +272,22 @@ function RetryTasksTable(props: Props & ReduxProps) {
key={task.id}
task={task}
allActionPending={props.allActionPending}
isSelected={selectedKeys.includes(task.key)}
isSelected={selectedIds.includes(task.id)}
onSelectChange={(checked: boolean) => {
if (checked) {
setSelectedKeys(selectedKeys.concat(task.key));
setSelectedIds(selectedIds.concat(task.id));
} else {
setSelectedKeys(
selectedKeys.filter((key) => key !== task.key)
);
setSelectedIds(selectedIds.filter((id) => id !== task.id));
}
}}
onRunClick={() => {
props.runRetryTaskAsync(task.queue, task.key);
props.runRetryTaskAsync(task.queue, task.id);
}}
onDeleteClick={() => {
props.deleteRetryTaskAsync(task.queue, task.key);
props.deleteRetryTaskAsync(task.queue, task.id);
}}
onArchiveClick={() => {
props.archiveRetryTaskAsync(task.queue, task.key);
props.archiveRetryTaskAsync(task.queue, task.id);
}}
onActionCellEnter={() => setActiveTaskId(task.id)}
onActionCellLeave={() => setActiveTaskId("")}

View File

@ -98,7 +98,7 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
const { pollInterval, listScheduledTasksAsync, queue, pageSize } = props;
const classes = useStyles();
const [page, setPage] = useState(0);
const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
const [selectedIds, setSelectedIds] = useState<string[]>([]);
const [activeTaskId, setActiveTaskId] = useState<string>("");
const handleChangePage = (
@ -117,10 +117,10 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
const handleSelectAllClick = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.checked) {
const newSelected = props.tasks.map((t) => t.key);
setSelectedKeys(newSelected);
const newSelected = props.tasks.map((t) => t.id);
setSelectedIds(newSelected);
} else {
setSelectedKeys([]);
setSelectedIds([]);
}
};
@ -138,20 +138,20 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
const handleBatchRunClick = () => {
props
.batchRunScheduledTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchRunScheduledTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const handleBatchDeleteClick = () => {
props
.batchDeleteScheduledTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchDeleteScheduledTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const handleBatchArchiveClick = () => {
props
.batchArchiveScheduledTasksAsync(queue, selectedKeys)
.then(() => setSelectedKeys([]));
.batchArchiveScheduledTasksAsync(queue, selectedIds)
.then(() => setSelectedIds([]));
};
const fetchData = useCallback(() => {
@ -187,7 +187,7 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
];
const rowCount = props.tasks.length;
const numSelected = selectedKeys.length;
const numSelected = selectedIds.length;
return (
<div>
<TableActions
@ -269,24 +269,22 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
key={task.id}
task={task}
allActionPending={props.allActionPending}
isSelected={selectedKeys.includes(task.key)}
isSelected={selectedIds.includes(task.id)}
onSelectChange={(checked: boolean) => {
if (checked) {
setSelectedKeys(selectedKeys.concat(task.key));
setSelectedIds(selectedIds.concat(task.id));
} else {
setSelectedKeys(
selectedKeys.filter((key) => key !== task.key)
);
setSelectedIds(selectedIds.filter((id) => id !== task.id));
}
}}
onRunClick={() => {
props.runScheduledTaskAsync(queue, task.key);
props.runScheduledTaskAsync(queue, task.id);
}}
onDeleteClick={() => {
props.deleteScheduledTaskAsync(queue, task.key);
props.deleteScheduledTaskAsync(queue, task.id);
}}
onArchiveClick={() => {
props.archiveScheduledTaskAsync(queue, task.key);
props.archiveScheduledTaskAsync(queue, task.id);
}}
onActionCellEnter={() => setActiveTaskId(task.id)}
onActionCellLeave={() => setActiveTaskId("")}

View File

@ -273,19 +273,19 @@ function Row(props: RowProps) {
</TableHead>
<TableBody>
{server.active_workers.map((worker) => (
<TableRow key={worker.task.id}>
<TableRow key={worker.task_id}>
<TableCell component="th" scope="row">
{uuidPrefix(worker.task.id)}
{uuidPrefix(worker.task_id)}
</TableCell>
<TableCell>
<SyntaxHighlighter
language="json"
customStyle={{ margin: 0 }}
>
{JSON.stringify(worker.task.payload)}
{JSON.stringify(worker.task_payload)}
</SyntaxHighlighter>
</TableCell>
<TableCell>{worker.task.queue}</TableCell>
<TableCell>{worker.queue}</TableCell>
<TableCell>{timeAgo(worker.start_time)}</TableCell>
</TableRow>
))}

View File

@ -319,10 +319,10 @@ function queuesReducer(
...queueInfo.currentStats,
archived:
queueInfo.currentStats.archived +
action.payload.archived_keys.length,
action.payload.archived_ids.length,
pending:
queueInfo.currentStats.pending -
action.payload.archived_keys.length,
action.payload.archived_ids.length,
},
};
});
@ -339,10 +339,10 @@ function queuesReducer(
currentStats: {
...queueInfo.currentStats,
size:
queueInfo.currentStats.size - action.payload.deleted_keys.length,
queueInfo.currentStats.size - action.payload.deleted_ids.length,
pending:
queueInfo.currentStats.pending -
action.payload.deleted_keys.length,
action.payload.deleted_ids.length,
},
};
});
@ -395,10 +395,10 @@ function queuesReducer(
...queueInfo.currentStats,
pending:
queueInfo.currentStats.pending +
action.payload.pending_keys.length,
action.payload.pending_ids.length,
scheduled:
queueInfo.currentStats.scheduled -
action.payload.pending_keys.length,
action.payload.pending_ids.length,
},
};
});
@ -416,10 +416,10 @@ function queuesReducer(
...queueInfo.currentStats,
archived:
queueInfo.currentStats.archived +
action.payload.archived_keys.length,
action.payload.archived_ids.length,
scheduled:
queueInfo.currentStats.scheduled -
action.payload.archived_keys.length,
action.payload.archived_ids.length,
},
};
});
@ -436,10 +436,10 @@ function queuesReducer(
currentStats: {
...queueInfo.currentStats,
size:
queueInfo.currentStats.size - action.payload.deleted_keys.length,
queueInfo.currentStats.size - action.payload.deleted_ids.length,
scheduled:
queueInfo.currentStats.scheduled -
action.payload.deleted_keys.length,
action.payload.deleted_ids.length,
},
};
});
@ -528,9 +528,9 @@ function queuesReducer(
...queueInfo.currentStats,
pending:
queueInfo.currentStats.pending +
action.payload.pending_keys.length,
action.payload.pending_ids.length,
retry:
queueInfo.currentStats.retry - action.payload.pending_keys.length,
queueInfo.currentStats.retry - action.payload.pending_ids.length,
},
};
});
@ -548,10 +548,10 @@ function queuesReducer(
...queueInfo.currentStats,
archived:
queueInfo.currentStats.pending +
action.payload.archived_keys.length,
action.payload.archived_ids.length,
retry:
queueInfo.currentStats.retry -
action.payload.archived_keys.length,
action.payload.archived_ids.length,
},
};
});
@ -568,9 +568,9 @@ function queuesReducer(
currentStats: {
...queueInfo.currentStats,
size:
queueInfo.currentStats.size - action.payload.deleted_keys.length,
queueInfo.currentStats.size - action.payload.deleted_ids.length,
retry:
queueInfo.currentStats.retry - action.payload.deleted_keys.length,
queueInfo.currentStats.retry - action.payload.deleted_ids.length,
},
};
});
@ -658,10 +658,10 @@ function queuesReducer(
...queueInfo.currentStats,
pending:
queueInfo.currentStats.pending +
action.payload.pending_keys.length,
action.payload.pending_ids.length,
archived:
queueInfo.currentStats.archived -
action.payload.pending_keys.length,
action.payload.pending_ids.length,
},
};
});
@ -678,10 +678,10 @@ function queuesReducer(
currentStats: {
...queueInfo.currentStats,
size:
queueInfo.currentStats.size - action.payload.deleted_keys.length,
queueInfo.currentStats.size - action.payload.deleted_ids.length,
archived:
queueInfo.currentStats.archived -
action.payload.deleted_keys.length,
action.payload.deleted_ids.length,
},
};
});

View File

@ -126,7 +126,7 @@ function snackbarReducer(
};
case BATCH_RUN_SCHEDULED_TASKS_SUCCESS: {
const n = action.payload.pending_keys.length;
const n = action.payload.pending_ids.length;
return {
isOpen: true,
message: `${n} scheduled ${
@ -136,7 +136,7 @@ function snackbarReducer(
}
case BATCH_ARCHIVE_PENDING_TASKS_SUCCESS: {
const n = action.payload.archived_keys.length;
const n = action.payload.archived_ids.length;
return {
isOpen: true,
message: `${n} pending ${
@ -146,7 +146,7 @@ function snackbarReducer(
}
case BATCH_DELETE_PENDING_TASKS_SUCCESS: {
const n = action.payload.deleted_keys.length;
const n = action.payload.deleted_ids.length;
return {
isOpen: true,
message: `${n} pending ${n === 1 ? "task" : "tasks"} deleted`,
@ -154,7 +154,7 @@ function snackbarReducer(
}
case BATCH_ARCHIVE_SCHEDULED_TASKS_SUCCESS: {
const n = action.payload.archived_keys.length;
const n = action.payload.archived_ids.length;
return {
isOpen: true,
message: `${n} scheduled ${
@ -164,7 +164,7 @@ function snackbarReducer(
}
case BATCH_DELETE_SCHEDULED_TASKS_SUCCESS: {
const n = action.payload.deleted_keys.length;
const n = action.payload.deleted_ids.length;
return {
isOpen: true,
message: `${n} scheduled ${n === 1 ? "task" : "tasks"} deleted`,
@ -208,7 +208,7 @@ function snackbarReducer(
};
case BATCH_RUN_RETRY_TASKS_SUCCESS: {
const n = action.payload.pending_keys.length;
const n = action.payload.pending_ids.length;
return {
isOpen: true,
message: `${n} retry ${n === 1 ? "task is" : "tasks are"} now pending`,
@ -216,7 +216,7 @@ function snackbarReducer(
}
case BATCH_ARCHIVE_RETRY_TASKS_SUCCESS: {
const n = action.payload.archived_keys.length;
const n = action.payload.archived_ids.length;
return {
isOpen: true,
message: `${n} retry ${n === 1 ? "task is" : "tasks are"} now archived`,
@ -224,7 +224,7 @@ function snackbarReducer(
}
case BATCH_DELETE_RETRY_TASKS_SUCCESS: {
const n = action.payload.deleted_keys.length;
const n = action.payload.deleted_ids.length;
return {
isOpen: true,
message: `${n} retry ${n === 1 ? "task" : "tasks"} deleted`,
@ -256,7 +256,7 @@ function snackbarReducer(
};
case BATCH_RUN_ARCHIVED_TASKS_SUCCESS: {
const n = action.payload.pending_keys.length;
const n = action.payload.pending_ids.length;
return {
isOpen: true,
message: `${n} archived ${
@ -266,7 +266,7 @@ function snackbarReducer(
}
case BATCH_DELETE_ARCHIVED_TASKS_SUCCESS: {
const n = action.payload.deleted_keys.length;
const n = action.payload.deleted_ids.length;
return {
isOpen: true,
message: `${n} archived ${n === 1 ? "task" : "tasks"} deleted`,

View File

@ -560,7 +560,7 @@ function tasksReducer(
pendingTasks: {
...state.pendingTasks,
data: state.pendingTasks.data.map((task) => {
if (task.key !== action.taskKey) {
if (task.id !== action.taskId) {
return task;
}
return { ...task, requestPending: true };
@ -575,7 +575,7 @@ function tasksReducer(
pendingTasks: {
...state.pendingTasks,
data: state.pendingTasks.data.filter(
(task) => task.key !== action.taskKey
(task) => task.id !== action.taskId
),
},
};
@ -587,7 +587,7 @@ function tasksReducer(
pendingTasks: {
...state.pendingTasks,
data: state.pendingTasks.data.map((task) => {
if (task.key !== action.taskKey) {
if (task.id !== action.taskId) {
return task;
}
return { ...task, requestPending: false };
@ -634,7 +634,7 @@ function tasksReducer(
...state.pendingTasks,
batchActionPending: true,
data: state.pendingTasks.data.map((task) => {
if (!action.taskKeys.includes(task.key)) {
if (!action.taskIds.includes(task.id)) {
return task;
}
return {
@ -647,7 +647,7 @@ function tasksReducer(
case BATCH_ARCHIVE_PENDING_TASKS_SUCCESS: {
const newData = state.pendingTasks.data.filter(
(task) => !action.payload.archived_keys.includes(task.key)
(task) => !action.payload.archived_ids.includes(task.id)
);
return {
...state,
@ -661,7 +661,7 @@ function tasksReducer(
case BATCH_DELETE_PENDING_TASKS_SUCCESS: {
const newData = state.pendingTasks.data.filter(
(task) => !action.payload.deleted_keys.includes(task.key)
(task) => !action.payload.deleted_ids.includes(task.id)
);
return {
...state,
@ -681,7 +681,7 @@ function tasksReducer(
...state.pendingTasks,
batchActionPending: false,
data: state.pendingTasks.data.map((task) => {
if (!action.taskKeys.includes(task.key)) {
if (!action.taskIds.includes(task.id)) {
return task;
}
return {
@ -700,7 +700,7 @@ function tasksReducer(
scheduledTasks: {
...state.scheduledTasks,
data: state.scheduledTasks.data.map((task) => {
if (task.key !== action.taskKey) {
if (task.id !== action.taskId) {
return task;
}
return { ...task, requestPending: true };
@ -716,7 +716,7 @@ function tasksReducer(
scheduledTasks: {
...state.scheduledTasks,
data: state.scheduledTasks.data.filter(
(task) => task.key !== action.taskKey
(task) => task.id !== action.taskId
),
},
};
@ -729,7 +729,7 @@ function tasksReducer(
scheduledTasks: {
...state.scheduledTasks,
data: state.scheduledTasks.data.map((task) => {
if (task.key !== action.taskKey) {
if (task.id !== action.taskId) {
return task;
}
return { ...task, requestPending: false };
@ -780,7 +780,7 @@ function tasksReducer(
...state.scheduledTasks,
batchActionPending: true,
data: state.scheduledTasks.data.map((task) => {
if (!action.taskKeys.includes(task.key)) {
if (!action.taskIds.includes(task.id)) {
return task;
}
return {
@ -793,7 +793,7 @@ function tasksReducer(
case BATCH_RUN_SCHEDULED_TASKS_SUCCESS: {
const newData = state.scheduledTasks.data.filter(
(task) => !action.payload.pending_keys.includes(task.key)
(task) => !action.payload.pending_ids.includes(task.id)
);
return {
...state,
@ -807,7 +807,7 @@ function tasksReducer(
case BATCH_ARCHIVE_SCHEDULED_TASKS_SUCCESS: {
const newData = state.scheduledTasks.data.filter(
(task) => !action.payload.archived_keys.includes(task.key)
(task) => !action.payload.archived_ids.includes(task.id)
);
return {
...state,
@ -821,7 +821,7 @@ function tasksReducer(
case BATCH_DELETE_SCHEDULED_TASKS_SUCCESS: {
const newData = state.scheduledTasks.data.filter(
(task) => !action.payload.deleted_keys.includes(task.key)
(task) => !action.payload.deleted_ids.includes(task.id)
);
return {
...state,
@ -842,7 +842,7 @@ function tasksReducer(
...state.scheduledTasks,
batchActionPending: false,
data: state.scheduledTasks.data.map((task) => {
if (!action.taskKeys.includes(task.key)) {
if (!action.taskIds.includes(task.id)) {
return task;
}
return {
@ -861,7 +861,7 @@ function tasksReducer(
retryTasks: {
...state.retryTasks,
data: state.retryTasks.data.map((task) => {
if (task.key !== action.taskKey) {
if (task.id !== action.taskId) {
return task;
}
return { ...task, requestPending: true };
@ -877,7 +877,7 @@ function tasksReducer(
retryTasks: {
...state.retryTasks,
data: state.retryTasks.data.filter(
(task) => task.key !== action.taskKey
(task) => task.id !== action.taskId
),
},
};
@ -890,7 +890,7 @@ function tasksReducer(
retryTasks: {
...state.retryTasks,
data: state.retryTasks.data.map((task) => {
if (task.key !== action.taskKey) {
if (task.id !== action.taskId) {
return task;
}
return { ...task, requestPending: false };
@ -941,7 +941,7 @@ function tasksReducer(
...state.retryTasks,
batchActionPending: true,
data: state.retryTasks.data.map((task) => {
if (!action.taskKeys.includes(task.key)) {
if (!action.taskIds.includes(task.id)) {
return task;
}
return {
@ -954,7 +954,7 @@ function tasksReducer(
case BATCH_RUN_RETRY_TASKS_SUCCESS: {
const newData = state.retryTasks.data.filter(
(task) => !action.payload.pending_keys.includes(task.key)
(task) => !action.payload.pending_ids.includes(task.id)
);
return {
...state,
@ -968,7 +968,7 @@ function tasksReducer(
case BATCH_ARCHIVE_RETRY_TASKS_SUCCESS: {
const newData = state.retryTasks.data.filter(
(task) => !action.payload.archived_keys.includes(task.key)
(task) => !action.payload.archived_ids.includes(task.id)
);
return {
...state,
@ -982,7 +982,7 @@ function tasksReducer(
case BATCH_DELETE_RETRY_TASKS_SUCCESS: {
const newData = state.retryTasks.data.filter(
(task) => !action.payload.deleted_keys.includes(task.key)
(task) => !action.payload.deleted_ids.includes(task.id)
);
return {
...state,
@ -1003,7 +1003,7 @@ function tasksReducer(
...state.retryTasks,
batchActionPending: false,
data: state.retryTasks.data.map((task) => {
if (!action.taskKeys.includes(task.key)) {
if (!action.taskIds.includes(task.id)) {
return task;
}
return {
@ -1021,7 +1021,7 @@ function tasksReducer(
archivedTasks: {
...state.archivedTasks,
data: state.archivedTasks.data.map((task) => {
if (task.key !== action.taskKey) {
if (task.id !== action.taskId) {
return task;
}
return { ...task, requestPending: true };
@ -1036,7 +1036,7 @@ function tasksReducer(
archivedTasks: {
...state.archivedTasks,
data: state.archivedTasks.data.filter(
(task) => task.key !== action.taskKey
(task) => task.id !== action.taskId
),
},
};
@ -1048,7 +1048,7 @@ function tasksReducer(
archivedTasks: {
...state.archivedTasks,
data: state.archivedTasks.data.map((task) => {
if (task.key !== action.taskKey) {
if (task.id !== action.taskId) {
return task;
}
return { ...task, requestPending: false };
@ -1095,7 +1095,7 @@ function tasksReducer(
...state.archivedTasks,
batchActionPending: true,
data: state.archivedTasks.data.map((task) => {
if (!action.taskKeys.includes(task.key)) {
if (!action.taskIds.includes(task.id)) {
return task;
}
return {
@ -1108,7 +1108,7 @@ function tasksReducer(
case BATCH_RUN_ARCHIVED_TASKS_SUCCESS: {
const newData = state.archivedTasks.data.filter(
(task) => !action.payload.pending_keys.includes(task.key)
(task) => !action.payload.pending_ids.includes(task.id)
);
return {
...state,
@ -1122,7 +1122,7 @@ function tasksReducer(
case BATCH_DELETE_ARCHIVED_TASKS_SUCCESS: {
const newData = state.archivedTasks.data.filter(
(task) => !action.payload.deleted_keys.includes(task.key)
(task) => !action.payload.deleted_ids.includes(task.id)
);
return {
...state,
@ -1142,7 +1142,7 @@ function tasksReducer(
...state.archivedTasks,
batchActionPending: false,
data: state.archivedTasks.data.map((task) => {
if (!action.taskKeys.includes(task.key)) {
if (!action.taskIds.includes(task.id)) {
return task;
}
return {