mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-23 14:56:13 +08:00
Show error alert when data is not available
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
DELETE_QUEUE_BEGIN,
|
||||
DELETE_QUEUE_ERROR,
|
||||
DELETE_QUEUE_SUCCESS,
|
||||
LIST_QUEUES_ERROR,
|
||||
} from "../actions/queuesActions";
|
||||
import {
|
||||
BATCH_DELETE_DEAD_TASKS_SUCCESS,
|
||||
@@ -49,6 +50,7 @@ import { Queue } from "../api";
|
||||
interface QueuesState {
|
||||
loading: boolean;
|
||||
data: QueueInfo[];
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface QueueInfo {
|
||||
@@ -57,7 +59,7 @@ export interface QueueInfo {
|
||||
requestPending: boolean; // indicates pause/resume/delete action is pending on this queue
|
||||
}
|
||||
|
||||
const initialState: QueuesState = { data: [], loading: false };
|
||||
const initialState: QueuesState = { data: [], loading: false, error: "" };
|
||||
|
||||
function queuesReducer(
|
||||
state = initialState,
|
||||
@@ -72,6 +74,7 @@ function queuesReducer(
|
||||
return {
|
||||
...state,
|
||||
loading: false,
|
||||
error: "",
|
||||
data: queues.map((q: Queue) => ({
|
||||
name: q.queue,
|
||||
currentStats: q,
|
||||
@@ -79,6 +82,13 @@ function queuesReducer(
|
||||
})),
|
||||
};
|
||||
|
||||
case LIST_QUEUES_ERROR:
|
||||
return {
|
||||
...state,
|
||||
loading: false,
|
||||
error: action.error,
|
||||
};
|
||||
|
||||
case DELETE_QUEUE_BEGIN:
|
||||
case PAUSE_QUEUE_BEGIN:
|
||||
case RESUME_QUEUE_BEGIN: {
|
||||
|
Reference in New Issue
Block a user