mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 11:15:53 +08:00
Remove stale code
This commit is contained in:
parent
93e42bd9f0
commit
3d982d9a8b
@ -1,7 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
deleteQueue,
|
deleteQueue,
|
||||||
getQueue,
|
|
||||||
GetQueueResponse,
|
|
||||||
listQueues,
|
listQueues,
|
||||||
ListQueuesResponse,
|
ListQueuesResponse,
|
||||||
pauseQueue,
|
pauseQueue,
|
||||||
@ -12,9 +10,6 @@ import { Dispatch } from "redux";
|
|||||||
// List of queue related action types.
|
// List of queue related action types.
|
||||||
export const LIST_QUEUES_BEGIN = "LIST_QUEUES_BEGIN";
|
export const LIST_QUEUES_BEGIN = "LIST_QUEUES_BEGIN";
|
||||||
export const LIST_QUEUES_SUCCESS = "LIST_QUEUES_SUCCESS";
|
export const LIST_QUEUES_SUCCESS = "LIST_QUEUES_SUCCESS";
|
||||||
export const GET_QUEUE_BEGIN = "GET_QUEUE_BEGIN";
|
|
||||||
export const GET_QUEUE_SUCCESS = "GET_QUEUE_SUCCESS";
|
|
||||||
export const GET_QUEUE_ERROR = "GET_QUEUE_ERROR";
|
|
||||||
export const DELETE_QUEUE_BEGIN = "DELETE_QUEUE_BEGIN";
|
export const DELETE_QUEUE_BEGIN = "DELETE_QUEUE_BEGIN";
|
||||||
export const DELETE_QUEUE_SUCCESS = "DELETE_QUEUE_SUCCESS";
|
export const DELETE_QUEUE_SUCCESS = "DELETE_QUEUE_SUCCESS";
|
||||||
export const DELETE_QUEUE_ERROR = "DELETE_QUEUE_ERROR";
|
export const DELETE_QUEUE_ERROR = "DELETE_QUEUE_ERROR";
|
||||||
@ -34,23 +29,6 @@ interface ListQueuesSuccessAction {
|
|||||||
payload: ListQueuesResponse;
|
payload: ListQueuesResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GetQueueBeginAction {
|
|
||||||
type: typeof GET_QUEUE_BEGIN;
|
|
||||||
queue: string; // name of the queue
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GetQueueSuccessAction {
|
|
||||||
type: typeof GET_QUEUE_SUCCESS;
|
|
||||||
queue: string; // name of the queue
|
|
||||||
payload: GetQueueResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GetQueueErrorAction {
|
|
||||||
type: typeof GET_QUEUE_ERROR;
|
|
||||||
queue: string; // name of the queue
|
|
||||||
error: string; // error description
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DeleteQueueBeginAction {
|
interface DeleteQueueBeginAction {
|
||||||
type: typeof DELETE_QUEUE_BEGIN;
|
type: typeof DELETE_QUEUE_BEGIN;
|
||||||
queue: string; // name of the queue
|
queue: string; // name of the queue
|
||||||
@ -103,9 +81,6 @@ interface ResumeQueueErrorAction {
|
|||||||
export type QueuesActionTypes =
|
export type QueuesActionTypes =
|
||||||
| ListQueuesBeginAction
|
| ListQueuesBeginAction
|
||||||
| ListQueuesSuccessAction
|
| ListQueuesSuccessAction
|
||||||
| GetQueueBeginAction
|
|
||||||
| GetQueueSuccessAction
|
|
||||||
| GetQueueErrorAction
|
|
||||||
| DeleteQueueBeginAction
|
| DeleteQueueBeginAction
|
||||||
| DeleteQueueSuccessAction
|
| DeleteQueueSuccessAction
|
||||||
| DeleteQueueErrorAction
|
| DeleteQueueErrorAction
|
||||||
@ -128,27 +103,6 @@ export function listQueuesAsync() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getQueueAsync(qname: string) {
|
|
||||||
return async (dispatch: Dispatch<QueuesActionTypes>) => {
|
|
||||||
dispatch({ type: GET_QUEUE_BEGIN, queue: qname });
|
|
||||||
try {
|
|
||||||
const response = await getQueue(qname);
|
|
||||||
dispatch({
|
|
||||||
type: GET_QUEUE_SUCCESS,
|
|
||||||
queue: qname,
|
|
||||||
payload: response,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
dispatch({
|
|
||||||
type: GET_QUEUE_ERROR,
|
|
||||||
queue: qname,
|
|
||||||
error: `Could not retrieve queue data for queue: ${qname}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function deleteQueueAsync(qname: string) {
|
export function deleteQueueAsync(qname: string) {
|
||||||
return async (dispatch: Dispatch<QueuesActionTypes>) => {
|
return async (dispatch: Dispatch<QueuesActionTypes>) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -7,11 +7,6 @@ export interface ListQueuesResponse {
|
|||||||
queues: Queue[];
|
queues: Queue[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetQueueResponse {
|
|
||||||
current: Queue;
|
|
||||||
history: DailyStat[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ListActiveTasksResponse {
|
export interface ListActiveTasksResponse {
|
||||||
tasks: ActiveTask[];
|
tasks: ActiveTask[];
|
||||||
stats: Queue;
|
stats: Queue;
|
||||||
@ -158,14 +153,6 @@ export async function listQueues(): Promise<ListQueuesResponse> {
|
|||||||
return resp.data;
|
return resp.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getQueue(qname: string): Promise<GetQueueResponse> {
|
|
||||||
const resp = await axios({
|
|
||||||
method: "get",
|
|
||||||
url: `${BASE_URL}/queues/${qname}`,
|
|
||||||
});
|
|
||||||
return resp.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function deleteQueue(qname: string): Promise<void> {
|
export async function deleteQueue(qname: string): Promise<void> {
|
||||||
await axios({
|
await axios({
|
||||||
method: "delete",
|
method: "delete",
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
RESUME_QUEUE_BEGIN,
|
RESUME_QUEUE_BEGIN,
|
||||||
RESUME_QUEUE_ERROR,
|
RESUME_QUEUE_ERROR,
|
||||||
RESUME_QUEUE_SUCCESS,
|
RESUME_QUEUE_SUCCESS,
|
||||||
GET_QUEUE_SUCCESS,
|
|
||||||
DELETE_QUEUE_BEGIN,
|
DELETE_QUEUE_BEGIN,
|
||||||
DELETE_QUEUE_ERROR,
|
DELETE_QUEUE_ERROR,
|
||||||
DELETE_QUEUE_SUCCESS,
|
DELETE_QUEUE_SUCCESS,
|
||||||
@ -45,7 +44,7 @@ import {
|
|||||||
RUN_SCHEDULED_TASK_SUCCESS,
|
RUN_SCHEDULED_TASK_SUCCESS,
|
||||||
TasksActionTypes,
|
TasksActionTypes,
|
||||||
} from "../actions/tasksActions";
|
} from "../actions/tasksActions";
|
||||||
import { DailyStat, Queue } from "../api";
|
import { Queue } from "../api";
|
||||||
|
|
||||||
interface QueuesState {
|
interface QueuesState {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
@ -55,7 +54,6 @@ interface QueuesState {
|
|||||||
export interface QueueInfo {
|
export interface QueueInfo {
|
||||||
name: string; // name of the queue.
|
name: string; // name of the queue.
|
||||||
currentStats: Queue;
|
currentStats: Queue;
|
||||||
history: DailyStat[];
|
|
||||||
requestPending: boolean; // indicates pause/resume/delete action is pending on this queue
|
requestPending: boolean; // indicates pause/resume/delete action is pending on this queue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,22 +75,10 @@ function queuesReducer(
|
|||||||
data: queues.map((q: Queue) => ({
|
data: queues.map((q: Queue) => ({
|
||||||
name: q.queue,
|
name: q.queue,
|
||||||
currentStats: q,
|
currentStats: q,
|
||||||
history: [],
|
|
||||||
requestPending: false,
|
requestPending: false,
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
case GET_QUEUE_SUCCESS:
|
|
||||||
const newData = state.data
|
|
||||||
.filter((queueInfo) => queueInfo.name !== action.queue)
|
|
||||||
.concat({
|
|
||||||
name: action.queue,
|
|
||||||
currentStats: action.payload.current,
|
|
||||||
history: action.payload.history,
|
|
||||||
requestPending: false,
|
|
||||||
});
|
|
||||||
return { ...state, data: newData };
|
|
||||||
|
|
||||||
case DELETE_QUEUE_BEGIN:
|
case DELETE_QUEUE_BEGIN:
|
||||||
case PAUSE_QUEUE_BEGIN:
|
case PAUSE_QUEUE_BEGIN:
|
||||||
case RESUME_QUEUE_BEGIN: {
|
case RESUME_QUEUE_BEGIN: {
|
||||||
@ -165,7 +151,6 @@ function queuesReducer(
|
|||||||
.concat({
|
.concat({
|
||||||
name: action.queue,
|
name: action.queue,
|
||||||
currentStats: action.payload.stats,
|
currentStats: action.payload.stats,
|
||||||
history: [],
|
|
||||||
requestPending: false,
|
requestPending: false,
|
||||||
});
|
});
|
||||||
return { ...state, data: newData };
|
return { ...state, data: newData };
|
||||||
|
Loading…
Reference in New Issue
Block a user