From 3d982d9a8b0743da402301d1e1643d56cae11013 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Sun, 27 Dec 2020 15:56:35 -0800 Subject: [PATCH] Remove stale code --- ui/src/actions/queuesActions.ts | 46 -------------------------------- ui/src/api.ts | 13 --------- ui/src/reducers/queuesReducer.ts | 17 +----------- 3 files changed, 1 insertion(+), 75 deletions(-) diff --git a/ui/src/actions/queuesActions.ts b/ui/src/actions/queuesActions.ts index 8462336..082c94a 100644 --- a/ui/src/actions/queuesActions.ts +++ b/ui/src/actions/queuesActions.ts @@ -1,7 +1,5 @@ import { deleteQueue, - getQueue, - GetQueueResponse, listQueues, ListQueuesResponse, pauseQueue, @@ -12,9 +10,6 @@ import { Dispatch } from "redux"; // List of queue related action types. export const LIST_QUEUES_BEGIN = "LIST_QUEUES_BEGIN"; 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_SUCCESS = "DELETE_QUEUE_SUCCESS"; export const DELETE_QUEUE_ERROR = "DELETE_QUEUE_ERROR"; @@ -34,23 +29,6 @@ interface ListQueuesSuccessAction { 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 { type: typeof DELETE_QUEUE_BEGIN; queue: string; // name of the queue @@ -103,9 +81,6 @@ interface ResumeQueueErrorAction { export type QueuesActionTypes = | ListQueuesBeginAction | ListQueuesSuccessAction - | GetQueueBeginAction - | GetQueueSuccessAction - | GetQueueErrorAction | DeleteQueueBeginAction | DeleteQueueSuccessAction | DeleteQueueErrorAction @@ -128,27 +103,6 @@ export function listQueuesAsync() { }; } -export function getQueueAsync(qname: string) { - return async (dispatch: Dispatch) => { - 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) { return async (dispatch: Dispatch) => { dispatch({ diff --git a/ui/src/api.ts b/ui/src/api.ts index a65095f..c5343e7 100644 --- a/ui/src/api.ts +++ b/ui/src/api.ts @@ -7,11 +7,6 @@ export interface ListQueuesResponse { queues: Queue[]; } -export interface GetQueueResponse { - current: Queue; - history: DailyStat[]; -} - export interface ListActiveTasksResponse { tasks: ActiveTask[]; stats: Queue; @@ -158,14 +153,6 @@ export async function listQueues(): Promise { return resp.data; } -export async function getQueue(qname: string): Promise { - const resp = await axios({ - method: "get", - url: `${BASE_URL}/queues/${qname}`, - }); - return resp.data; -} - export async function deleteQueue(qname: string): Promise { await axios({ method: "delete", diff --git a/ui/src/reducers/queuesReducer.ts b/ui/src/reducers/queuesReducer.ts index 3a327df..36021a8 100644 --- a/ui/src/reducers/queuesReducer.ts +++ b/ui/src/reducers/queuesReducer.ts @@ -8,7 +8,6 @@ import { RESUME_QUEUE_BEGIN, RESUME_QUEUE_ERROR, RESUME_QUEUE_SUCCESS, - GET_QUEUE_SUCCESS, DELETE_QUEUE_BEGIN, DELETE_QUEUE_ERROR, DELETE_QUEUE_SUCCESS, @@ -45,7 +44,7 @@ import { RUN_SCHEDULED_TASK_SUCCESS, TasksActionTypes, } from "../actions/tasksActions"; -import { DailyStat, Queue } from "../api"; +import { Queue } from "../api"; interface QueuesState { loading: boolean; @@ -55,7 +54,6 @@ interface QueuesState { export interface QueueInfo { name: string; // name of the queue. currentStats: Queue; - history: DailyStat[]; requestPending: boolean; // indicates pause/resume/delete action is pending on this queue } @@ -77,22 +75,10 @@ function queuesReducer( data: queues.map((q: Queue) => ({ name: q.queue, currentStats: q, - history: [], 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 PAUSE_QUEUE_BEGIN: case RESUME_QUEUE_BEGIN: { @@ -165,7 +151,6 @@ function queuesReducer( .concat({ name: action.queue, currentStats: action.payload.stats, - history: [], requestPending: false, }); return { ...state, data: newData };