From 75777d32ddfe4bdc9e01f91225b661c260215e02 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Sun, 27 Aug 2023 20:25:38 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A2=20Removed=20the=20useless=20LS=5FI?= =?UTF-8?q?MPORT=20event?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/actions/fileops.actions.tsx | 24 ++++++++++++++++++++---- src/client/constants/action-types.ts | 1 + src/client/constants/endpoints.ts | 7 +++++++ src/client/reducers/fileops.reducer.ts | 7 +++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/client/actions/fileops.actions.tsx b/src/client/actions/fileops.actions.tsx index 290e159..35992bf 100644 --- a/src/client/actions/fileops.actions.tsx +++ b/src/client/actions/fileops.actions.tsx @@ -5,6 +5,7 @@ import { IMAGETRANSFORMATION_SERVICE_BASE_URI, LIBRARY_SERVICE_BASE_URI, SEARCH_SERVICE_BASE_URI, + JOB_QUEUE_SERVICE_BASE_URI, } from "../constants/endpoints"; import { IMS_COMIC_BOOK_GROUPS_FETCHED, @@ -86,10 +87,24 @@ export const fetchComicBookMetadata = () => async (dispatch) => { // autoDismiss: 0, // }), // ); - dispatch({ - type: LS_IMPORT, - meta: { remote: true }, - data: {}, + const sessionId = localStorage.getItem("sessionId"); + // dispatch({ + // type: LS_IMPORT, + // meta: { remote: true }, + // data: { sessionId }, + // }); + + await axios.request({ + url: `${LIBRARY_SERVICE_BASE_URI}/newImport`, + method: "POST", + data: { sessionId }, + }); +}; + +export const getImportJobResultStatistics = () => async (dispatch) => { + await axios.request({ + url: `${JOB_QUEUE_SERVICE_BASE_URI}/getJobResultStatistics`, + method: "GET", }); }; export const setQueueControl = @@ -100,6 +115,7 @@ export const setQueueControl = data: { queueAction, queueStatus }, }); }; + /** * Fetches comic book metadata for various types * @return metadata for the comic book object categories diff --git a/src/client/constants/action-types.ts b/src/client/constants/action-types.ts index 22d8178..f2a34cf 100644 --- a/src/client/constants/action-types.ts +++ b/src/client/constants/action-types.ts @@ -133,6 +133,7 @@ export const LS_IMPORT_QUEUE_DRAINED = "LS_IMPORT_QUEUE_DRAINED"; export const LS_SET_QUEUE_STATUS = "LS_SET_QUEUE_STATUS"; export const RESTORE_JOB_COUNTS_AFTER_SESSION_RESTORATION = "RESTORE_JOB_COUNTS_AFTER_SESSION_RESTORATION"; +export const IMPORT_JOB_RESULTS_RETRIEVED = "IMPORT_JOB_RESULTS_RETRIEVED"; // Settings export const SETTINGS_CALL_IN_PROGRESS = "SETTINGS_CALL_IN_PROGRESS"; diff --git a/src/client/constants/endpoints.ts b/src/client/constants/endpoints.ts index ffb760b..734c65f 100644 --- a/src/client/constants/endpoints.ts +++ b/src/client/constants/endpoints.ts @@ -77,3 +77,10 @@ export const SOCKET_BASE_URI = hostURIBuilder({ port: "3001", apiPath: `/`, }); + +export const JOB_QUEUE_SERVICE_BASE_URI = hostURIBuilder({ + protocol: "http", + host: import.meta.env.UNDERLYING_HOSTNAME || "localhost", + port: "3000", + apiPath: `/api/jobqueue`, +}); diff --git a/src/client/reducers/fileops.reducer.ts b/src/client/reducers/fileops.reducer.ts index e47baf2..65b69b7 100644 --- a/src/client/reducers/fileops.reducer.ts +++ b/src/client/reducers/fileops.reducer.ts @@ -33,6 +33,7 @@ import { LS_IMPORT_QUEUE_DRAINED, LS_SET_QUEUE_STATUS, RESTORE_JOB_COUNTS_AFTER_SESSION_RESTORATION, + IMPORT_JOB_RESULTS_RETRIEVED, } from "../constants/action-types"; import { removeLeadingPeriod } from "../shared/utils/formatting.utils"; import { LIBRARY_SERVICE_HOST } from "../constants/endpoints"; @@ -62,6 +63,7 @@ const initialState = { lastQueueJob: "", successfulJobCount: 0, failedJobCount: 0, + importJobStatistics: [], libraryQueueResults: [], librarySearchError: {}, libraryServiceStatus: {}, @@ -230,6 +232,11 @@ function fileOpsReducer(state = initialState, action) { }; } } + case IMPORT_JOB_RESULTS_RETRIEVED: { + return { + ...state, + }; + } case LS_COMIC_ADDED: { return { ...state,