+
+
+
- {JSON.stringify(libraryQueueResults, null, 2)}
+ {libraryQueueResults}
-
-
-
-
- {!isImportQueuePaused ? pauseIconText : playIconText}
-
-
+
+
+
+
+ {failedImportJobCount}
+
+
+
+
+
+
+
+
+ {!isImportQueuePaused ? pauseIconText : playIconText}
+
diff --git a/src/client/constants/action-types.ts b/src/client/constants/action-types.ts
index 38bca16..2093bc1 100644
--- a/src/client/constants/action-types.ts
+++ b/src/client/constants/action-types.ts
@@ -105,7 +105,7 @@ export const AIRDCPP_SEARCH_RESULTS_UPDATED = "AIRDCPP_SEARCH_RESULTS_UPDATED";
export const AIRDCPP_SEARCH_COMPLETE = "AIRDCPP_SEARCH_COMPLETE";
// AirDC++ related library query for issues with bundles associated with them
-export const LIBRARY_ISSUE_BUNDLES = "LIBRARY_ISSUE_BUNDLES";
+export const LIBRARY_ISSUE_BUNDLES = "LIBRARY_ISSUE_BUNDLES";
export const AIRDCPP_HUB_SEARCHES_SENT = "AIRDCPP_HUB_SEARCHES_SENT";
export const AIRDCPP_RESULT_DOWNLOAD_INITIATED =
@@ -127,6 +127,7 @@ export const WANTED_COMICS_FETCHED = "WANTED_COMICS_FETCHED";
// LIBRARY SOCKET ENDPOINT
export const LS_IMPORT = "LS_IMPORT";
export const LS_COVER_EXTRACTED = "LS_COVER_EXTRACTED";
+export const LS_COVER_EXTRACTION_FAILED = "LS_COVER_EXTRACTION_FAILED";
export const LS_COMIC_ADDED = "LS_COMIC_ADDED";
// Settings
diff --git a/src/client/reducers/fileops.reducer.ts b/src/client/reducers/fileops.reducer.ts
index 1443d7c..4585734 100644
--- a/src/client/reducers/fileops.reducer.ts
+++ b/src/client/reducers/fileops.reducer.ts
@@ -18,6 +18,7 @@ import {
IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS,
LS_IMPORT,
LS_COVER_EXTRACTED,
+ LS_COVER_EXTRACTION_FAILED,
LS_QUEUE_DRAINED,
LS_COMIC_ADDED,
IMG_ANALYSIS_CALL_IN_PROGRESS,
@@ -58,6 +59,7 @@ const initialState = {
volumes: [],
librarySearchResultsFormatted: [],
librarySearchResultCount: 0,
+ failedJobCount: 0,
libraryQueueResults: [],
librarySearchError: {},
libraryServiceStatus: {},
@@ -160,8 +162,16 @@ function fileOpsReducer(state = initialState, action) {
}
return {
...state,
- librarySearchResultCount: state.librarySearchResultCount + 1,
- recentComics: [...state.recentComics, action.result.data.importResult],
+ librarySearchResultCount: action.completedJobCount,
+ recentComics: [...state.recentComics, action.importResult],
+ };
+ }
+
+ case LS_COVER_EXTRACTION_FAILED: {
+ console.log("FAILED", action);
+ return {
+ ...state,
+ failedImportJobCount: action.failedJobCount,
};
}
--
2.49.1
From 8c6890a0445272dabe4f2a8b025adc1667438ee6 Mon Sep 17 00:00:00 2001
From: Rishi Ghan
Date: Fri, 18 Aug 2023 23:37:35 -0400
Subject: [PATCH 07/21] =?UTF-8?q?=F0=9F=93=9D=20Added=20more=20details=20t?=
=?UTF-8?q?o=20import=20statuses?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/client/components/Import.tsx | 82 ++++++++++++++++----------
src/client/reducers/fileops.reducer.ts | 2 +
2 files changed, 54 insertions(+), 30 deletions(-)
diff --git a/src/client/components/Import.tsx b/src/client/components/Import.tsx
index 73ca758..ce47bbf 100644
--- a/src/client/components/Import.tsx
+++ b/src/client/components/Import.tsx
@@ -6,6 +6,7 @@ import {
} from "../actions/fileops.actions";
import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
import Loader from "react-loader-spinner";
+import { isUndefined } from "lodash";
interface IProps {
matches?: unknown;
@@ -35,6 +36,10 @@ export const Import = (props: IProps): ReactElement => {
const failedImportJobCount = useSelector(
(state: RootState) => state.fileOps.failedImportJobCount,
);
+
+ const lastQueueJob = useSelector(
+ (state: RootState) => state.fileOps.lastQueueJob,
+ );
const libraryQueueImportStatus = useSelector(
(state: RootState) => state.fileOps.IMSCallInProgress,
);
@@ -55,12 +60,12 @@ export const Import = (props: IProps): ReactElement => {
}, [isImportQueuePaused]);
const pauseIconText = (
<>
- Pause Import
+ Pause
>
);
const playIconText = (
<>
- Resume Import
+ Resume
>
);
return (
@@ -100,35 +105,52 @@ export const Import = (props: IProps): ReactElement => {
Start Import
-
-
-
-
- {libraryQueueResults}
-
-
-
-
-
-
- {failedImportJobCount}
-
-
-
+
+
+
+
+ Completed Jobs
+
+ Failed Jobs
+
+ Queue Controls
+
+
+
-
-
-
-
- {!isImportQueuePaused ? pauseIconText : playIconText}
-
-
-
-
-
+
+
+
+
+
+ {libraryQueueResults}
+
+
+
+
+ {!isUndefined(failedImportJobCount) && (
+
+
+ {failedImportJobCount}
+
+
+ )}
+
+
+
+
+
+ {!isImportQueuePaused ? pauseIconText : playIconText}
+
+
+
+
+
+
+ Imported
{lastQueueJob}
);
diff --git a/src/client/reducers/fileops.reducer.ts b/src/client/reducers/fileops.reducer.ts
index 4585734..c161f3e 100644
--- a/src/client/reducers/fileops.reducer.ts
+++ b/src/client/reducers/fileops.reducer.ts
@@ -58,6 +58,7 @@ const initialState = {
libraryComics: [],
volumes: [],
librarySearchResultsFormatted: [],
+ lastQueueJob: "",
librarySearchResultCount: 0,
failedJobCount: 0,
libraryQueueResults: [],
@@ -163,6 +164,7 @@ function fileOpsReducer(state = initialState, action) {
return {
...state,
librarySearchResultCount: action.completedJobCount,
+ lastQueueJob: action.importResult.rawFileDetails.name,
recentComics: [...state.recentComics, action.importResult],
};
}
--
2.49.1
From 0c2cbb6937c6810ac4f3c8bb518d6637e5e06852 Mon Sep 17 00:00:00 2001
From: Rishi Ghan
Date: Mon, 21 Aug 2023 17:55:26 -0400
Subject: [PATCH 08/21] =?UTF-8?q?=F0=9F=90=82=20Queue=20pause/resume=20fun?=
=?UTF-8?q?ctionality?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/client/actions/fileops.actions.tsx | 2 +-
src/client/components/Import.tsx | 8 ++++----
src/client/reducers/fileops.reducer.ts | 4 ++++
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/client/actions/fileops.actions.tsx b/src/client/actions/fileops.actions.tsx
index facb635..e46f537 100644
--- a/src/client/actions/fileops.actions.tsx
+++ b/src/client/actions/fileops.actions.tsx
@@ -40,7 +40,7 @@ import { success } from "react-notification-system-redux";
import { isNil, map } from "lodash";
-export const getServiceStatus = (serviceName?: string) => async dispatch => {
+export const getServiceStatus = (serviceName?: string) => async (dispatch) => {
axios
.request({
url: `${LIBRARY_SERVICE_BASE_URI}/getHealthInformation`,
diff --git a/src/client/components/Import.tsx b/src/client/components/Import.tsx
index ce47bbf..79a4d37 100644
--- a/src/client/components/Import.tsx
+++ b/src/client/components/Import.tsx
@@ -43,7 +43,7 @@ export const Import = (props: IProps): ReactElement => {
const libraryQueueImportStatus = useSelector(
(state: RootState) => state.fileOps.IMSCallInProgress,
);
- const [isImportQueuePaused, setImportQueueStatus] = useState(false);
+ const [isImportQueuePaused, setImportQueueStatus] = useState(undefined);
const initiateImport = useCallback(() => {
if (typeof props.path !== "undefined") {
dispatch(fetchComicBookMetadata(props.path));
@@ -52,9 +52,9 @@ export const Import = (props: IProps): ReactElement => {
const toggleImport = useCallback(() => {
setImportQueueStatus(!isImportQueuePaused);
- if (isImportQueuePaused === false) {
+ if (isImportQueuePaused === true) {
dispatch(toggleImportQueueStatus({ action: "resume" }));
- } else if (isImportQueuePaused === true) {
+ } else if (isImportQueuePaused === false) {
dispatch(toggleImportQueueStatus({ action: "pause" }));
}
}, [isImportQueuePaused]);
@@ -143,7 +143,7 @@ export const Import = (props: IProps): ReactElement => {
className="button is-warning is-light"
onClick={toggleImport}
>
- {!isImportQueuePaused ? pauseIconText : playIconText}
+ {isImportQueuePaused ? pauseIconText : playIconText}
diff --git a/src/client/reducers/fileops.reducer.ts b/src/client/reducers/fileops.reducer.ts
index c161f3e..7eb77a8 100644
--- a/src/client/reducers/fileops.reducer.ts
+++ b/src/client/reducers/fileops.reducer.ts
@@ -177,6 +177,10 @@ function fileOpsReducer(state = initialState, action) {
};
}
+ case "LS_IMPORT_QUEUE_DRAINED": {
+ console.log("Queue drained");
+ }
+
case COMICBOOK_EXTRACTION_SUCCESS: {
const comicBookPages: string[] = [];
map(action.result.files, (page) => {
--
2.49.1
From b4ef0b7817d3082022864df7b6b13ecda78e26c6 Mon Sep 17 00:00:00 2001
From: Rishi Ghan
Date: Tue, 22 Aug 2023 05:20:41 -0400
Subject: [PATCH 09/21] =?UTF-8?q?=F0=9F=90=82=20Queue=20drain=20event=20re?=
=?UTF-8?q?ducer?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/client/reducers/fileops.reducer.ts | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/client/reducers/fileops.reducer.ts b/src/client/reducers/fileops.reducer.ts
index 7eb77a8..24b2b4d 100644
--- a/src/client/reducers/fileops.reducer.ts
+++ b/src/client/reducers/fileops.reducer.ts
@@ -179,6 +179,9 @@ function fileOpsReducer(state = initialState, action) {
case "LS_IMPORT_QUEUE_DRAINED": {
console.log("Queue drained");
+ return {
+ ...state,
+ };
}
case COMICBOOK_EXTRACTION_SUCCESS: {
--
2.49.1
From debd9a20bff805f01389963befd2fbea6153af28 Mon Sep 17 00:00:00 2001
From: Rishi Ghan
Date: Tue, 22 Aug 2023 22:07:33 -0500
Subject: [PATCH 10/21] =?UTF-8?q?=F0=9F=90=82=20Queue=20controls?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/client/actions/fileops.actions.tsx | 16 +--
src/client/components/App.tsx | 3 -
src/client/components/Downloads/Downloads.tsx | 116 +++++++++++-------
src/client/components/Header.tsx | 30 +++--
src/client/components/Import.tsx | 99 +++++++++------
src/client/constants/action-types.ts | 2 +
src/client/reducers/fileops.reducer.ts | 28 ++++-
7 files changed, 183 insertions(+), 111 deletions(-)
diff --git a/src/client/actions/fileops.actions.tsx b/src/client/actions/fileops.actions.tsx
index e46f537..486530d 100644
--- a/src/client/actions/fileops.actions.tsx
+++ b/src/client/actions/fileops.actions.tsx
@@ -35,6 +35,7 @@ import {
VOLUMES_FETCHED,
CV_WEEKLY_PULLLIST_FETCHED,
LIBRARY_SERVICE_HEALTH,
+ LS_SET_QUEUE_STATUS,
} from "../constants/action-types";
import { success } from "react-notification-system-redux";
@@ -96,13 +97,14 @@ export const fetchComicBookMetadata = () => async (dispatch) => {
data: {},
});
};
-export const toggleImportQueueStatus = (options) => async (dispatch) => {
- dispatch({
- type: LS_TOGGLE_IMPORT_QUEUE,
- meta: { remote: true },
- data: { manjhul: "jigyadam", action: options.action },
- });
-};
+export const setQueueControl =
+ (queueAction: string, queueStatus: string) => async (dispatch) => {
+ dispatch({
+ type: LS_SET_QUEUE_STATUS,
+ meta: { remote: true },
+ data: { queueAction, queueStatus },
+ });
+ };
/**
* Fetches comic book metadata for various types
* @return metadata for the comic book object categories
diff --git a/src/client/components/App.tsx b/src/client/components/App.tsx
index 264b8d2..71e5f9b 100644
--- a/src/client/components/App.tsx
+++ b/src/client/components/App.tsx
@@ -108,9 +108,6 @@ export const App = (): ReactElement => {
meta: { remote: true },
session: { sessionId },
});
- socketIOConnectionInstance.on("yelaveda", (data) => {
- console.log(data);
- });
} else {
// Inititalize the session and persist the sessionId to localStorage
socketIOConnectionInstance.on("sessionInitialized", (sessionId) => {
diff --git a/src/client/components/Downloads/Downloads.tsx b/src/client/components/Downloads/Downloads.tsx
index a18eafe..3c619ed 100644
--- a/src/client/components/Downloads/Downloads.tsx
+++ b/src/client/components/Downloads/Downloads.tsx
@@ -1,4 +1,10 @@
-import React, { ReactElement, useCallback, useContext, useEffect, useState } from "react";
+import React, {
+ ReactElement,
+ useCallback,
+ useContext,
+ useEffect,
+ useState,
+} from "react";
import { getTransfers } from "../../actions/airdcpp.actions";
import { useDispatch, useSelector } from "react-redux";
import { AirDCPPSocketContext } from "../../context/AirDCPPSocket";
@@ -20,7 +26,9 @@ export const Downloads = (props: IDownloadsProps): ReactElement => {
const airDCPPTransfers = useSelector(
(state: RootState) => state.airdcpp.transfers,
);
- const issueBundles = useSelector((state: RootState) => state.airdcpp.issue_bundles);
+ const issueBundles = useSelector(
+ (state: RootState) => state.airdcpp.issue_bundles,
+ );
const [bundles, setBundles] = useState([]);
// Make the call to get all transfers from AirDC++
useEffect(() => {
@@ -37,18 +45,26 @@ export const Downloads = (props: IDownloadsProps): ReactElement => {
useEffect(() => {
if (!isUndefined(issueBundles)) {
const foo = issueBundles.data.map((bundle) => {
- const { rawFileDetails, inferredMetadata, acquisition: { directconnect: { downloads } }, sourcedMetadata: { locg, comicvine } } = bundle;
+ const {
+ rawFileDetails,
+ inferredMetadata,
+ acquisition: {
+ directconnect: { downloads },
+ },
+ sourcedMetadata: { locg, comicvine },
+ } = bundle;
const { issueName, url } = determineCoverFile({
- rawFileDetails, comicvine, locg,
+ rawFileDetails,
+ comicvine,
+ locg,
});
- return { ...bundle, issueName, url }
-
- })
+ return { ...bundle, issueName, url };
+ });
setBundles(foo);
}
- }, [issueBundles])
+ }, [issueBundles]);
- return !isNil(bundles) ?
+ return !isNil(bundles) ? (
Downloads
@@ -56,45 +72,59 @@ export const Downloads = (props: IDownloadsProps): ReactElement => {
{bundles.map((bundle, idx) => {
console.log(bundle);
- return
-
+ return (
+
+
-
-
-
- Name
- Size
- Type
- Bundle ID
-
-
-
- {bundle.acquisition.directconnect.downloads.map((bundle, idx) => {
- return (
- {bundle.name}
- {bundle.size}
- {bundle.type.str}
- {bundle.bundleId}
- )
- })}
-
-
- {/*
{JSON.stringify(bundle.acquisition.directconnect.downloads, null, 2)} */}
-
+
+
+
+ Name
+ Size
+ Type
+ Bundle ID
+
+
+
+ {bundle.acquisition.directconnect.downloads.map(
+ (bundle, idx) => {
+ return (
+
+ {bundle.name}
+ {bundle.size}
+ {bundle.type.str}
+
+
+ {bundle.bundleId}
+
+
+
+ );
+ },
+ )}
+
+
+ {/*
{JSON.stringify(bundle.acquisition.directconnect.downloads, null, 2)} */}
+
+ );
})}
- :
There are no downloads.
;
+
+ ) : (
+
There are no downloads.
+ );
};
export default Downloads;
diff --git a/src/client/components/Header.tsx b/src/client/components/Header.tsx
index af76c39..1b5c97d 100644
--- a/src/client/components/Header.tsx
+++ b/src/client/components/Header.tsx
@@ -1,22 +1,20 @@
import React, { ReactElement } from "react";
type IHeaderProps = {
- headerContent: string;
- subHeaderContent: string;
- iconClassNames: string;
-}
+ headerContent: string;
+ subHeaderContent: string;
+ iconClassNames: string;
+};
export const Header = (props: IHeaderProps): ReactElement => {
+ return (
+ <>
+
+ {props.headerContent}
+
+
{props.subHeaderContent}
+ >
+ );
+};
- return (<>
-
- {props.headerContent}
-
-
- {props.subHeaderContent}
-
- >)
-
-}
-
-export default Header;
\ No newline at end of file
+export default Header;
diff --git a/src/client/components/Import.tsx b/src/client/components/Import.tsx
index 79a4d37..50cc147 100644
--- a/src/client/components/Import.tsx
+++ b/src/client/components/Import.tsx
@@ -2,11 +2,15 @@ import React, { ReactElement, useCallback, useContext, useState } from "react";
import { useSelector, useDispatch } from "react-redux";
import {
fetchComicBookMetadata,
- toggleImportQueueStatus,
+ setQueueControl,
} from "../actions/fileops.actions";
import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
import Loader from "react-loader-spinner";
import { isUndefined } from "lodash";
+import {
+ LS_IMPORT_CALL_IN_PROGRESS,
+ LS_SET_QUEUE_STATUS,
+} from "../constants/action-types";
interface IProps {
matches?: unknown;
@@ -34,40 +38,62 @@ export const Import = (props: IProps): ReactElement => {
(state: RootState) => state.fileOps.librarySearchResultCount,
);
const failedImportJobCount = useSelector(
- (state: RootState) => state.fileOps.failedImportJobCount,
+ (state: RootState) => state.fileOps.failedJobCount,
);
const lastQueueJob = useSelector(
(state: RootState) => state.fileOps.lastQueueJob,
);
const libraryQueueImportStatus = useSelector(
- (state: RootState) => state.fileOps.IMSCallInProgress,
+ (state: RootState) => state.fileOps.LSQueueImportStatus,
);
- const [isImportQueuePaused, setImportQueueStatus] = useState(undefined);
+
const initiateImport = useCallback(() => {
if (typeof props.path !== "undefined") {
dispatch(fetchComicBookMetadata(props.path));
}
}, [dispatch]);
- const toggleImport = useCallback(() => {
- setImportQueueStatus(!isImportQueuePaused);
- if (isImportQueuePaused === true) {
- dispatch(toggleImportQueueStatus({ action: "resume" }));
- } else if (isImportQueuePaused === false) {
- dispatch(toggleImportQueueStatus({ action: "pause" }));
+ const toggleQueue = useCallback(
+ (queueAction: string, queueStatus: string) => {
+ dispatch(setQueueControl(queueAction, queueStatus));
+ },
+ [],
+ );
+
+ const renderQueueControls = (status: string): ReactElement | null => {
+ switch (status) {
+ case "running":
+ return (
+
+ toggleQueue("pause", "paused")}
+ >
+ Pause
+
+
+ );
+ case "paused":
+ return (
+
+ toggleQueue("resume", "running")}
+ >
+ Resume
+
+
+ );
+
+ case "drained":
+ return null;
+
+ default:
+ return null;
}
- }, [isImportQueuePaused]);
- const pauseIconText = (
- <>
-
Pause
- >
- );
- const playIconText = (
- <>
-
Resume
- >
- );
+ };
+
return (
@@ -88,14 +114,16 @@ export const Import = (props: IProps): ReactElement => {
This process could take a while, if you have a lot of comics, or
are importing over a network connection.
+ {JSON.stringify(libraryQueueImportStatus)}
@@ -121,11 +149,13 @@ export const Import = (props: IProps): ReactElement => {
-
-
- {libraryQueueResults}
-
-
+ {libraryQueueResults && (
+
+
+ {libraryQueueResults}
+
+
+ )}
{!isUndefined(failedImportJobCount) && (
@@ -137,16 +167,7 @@ export const Import = (props: IProps): ReactElement => {
)}
-
-
-
- {isImportQueuePaused ? pauseIconText : playIconText}
-
-
-
+ {renderQueueControls(libraryQueueImportStatus)}
diff --git a/src/client/constants/action-types.ts b/src/client/constants/action-types.ts
index 2093bc1..cde0b74 100644
--- a/src/client/constants/action-types.ts
+++ b/src/client/constants/action-types.ts
@@ -129,6 +129,8 @@ export const LS_IMPORT = "LS_IMPORT";
export const LS_COVER_EXTRACTED = "LS_COVER_EXTRACTED";
export const LS_COVER_EXTRACTION_FAILED = "LS_COVER_EXTRACTION_FAILED";
export const LS_COMIC_ADDED = "LS_COMIC_ADDED";
+export const LS_IMPORT_QUEUE_DRAINED = "LS_IMPORT_QUEUE_DRAINED";
+export const LS_SET_QUEUE_STATUS = "LS_SET_QUEUE_STATUS";
// Settings
export const SETTINGS_CALL_IN_PROGRESS = "SETTINGS_CALL_IN_PROGRESS";
diff --git a/src/client/reducers/fileops.reducer.ts b/src/client/reducers/fileops.reducer.ts
index 24b2b4d..2ff706f 100644
--- a/src/client/reducers/fileops.reducer.ts
+++ b/src/client/reducers/fileops.reducer.ts
@@ -33,6 +33,8 @@ import {
COMICBOOK_EXTRACTION_SUCCESS,
LIBRARY_SERVICE_HEALTH,
HEALTH_STATUS_TICK,
+ LS_IMPORT_QUEUE_DRAINED,
+ LS_SET_QUEUE_STATUS,
} from "../constants/action-types";
import { removeLeadingPeriod } from "../shared/utils/formatting.utils";
import { LIBRARY_SERVICE_HOST } from "../constants/endpoints";
@@ -43,6 +45,7 @@ const initialState = {
SSCallInProgress: false,
imageAnalysisResults: {},
comicBookExtractionInProgress: false,
+ LSQueueImportStatus: undefined,
comicBookMetadata: [],
comicVolumeGroups: [],
isSocketConnected: false,
@@ -154,6 +157,7 @@ function fileOpsReducer(state = initialState, action) {
case LS_IMPORT: {
return {
...state,
+ LSQueueImportStatus: "running",
};
}
case LS_COVER_EXTRACTED: {
@@ -173,14 +177,32 @@ function fileOpsReducer(state = initialState, action) {
console.log("FAILED", action);
return {
...state,
- failedImportJobCount: action.failedJobCount,
+ failedJobCount: action.failedJobCount,
};
}
- case "LS_IMPORT_QUEUE_DRAINED": {
- console.log("Queue drained");
+ case LS_IMPORT_QUEUE_DRAINED: {
+ console.log("drained");
return {
...state,
+ LSQueueImportStatus: "drained",
+ };
+ }
+
+ case "RESTORE_JOB_COUNTS_AFTER_SESSION_RESTORATION": {
+ console.log(action);
+ return {
+ ...state,
+ librarySearchResultCount: action.completedJobCount,
+ failedJobCount: action.failedJobCount,
+ };
+ }
+
+ case LS_SET_QUEUE_STATUS: {
+ console.log(action);
+ return {
+ ...state,
+ LSQueueImportStatus: action.data.queueStatus,
};
}
--
2.49.1
From a5c02d3fc6d3154e074d69bd08c35fa51f3fc50c Mon Sep 17 00:00:00 2001
From: Rishi Ghan
Date: Wed, 23 Aug 2023 11:48:13 -0500
Subject: [PATCH 11/21] =?UTF-8?q?=F0=9F=94=A7=20Hardening=20the=20import?=
=?UTF-8?q?=20UX?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/client/components/Import.tsx | 18 ++++++++++++------
src/client/constants/action-types.ts | 9 ++++++---
src/client/reducers/fileops.reducer.ts | 15 +++++++--------
3 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/src/client/components/Import.tsx b/src/client/components/Import.tsx
index 50cc147..25bef03 100644
--- a/src/client/components/Import.tsx
+++ b/src/client/components/Import.tsx
@@ -34,8 +34,8 @@ interface IProps {
export const Import = (props: IProps): ReactElement => {
const dispatch = useDispatch();
- const libraryQueueResults = useSelector(
- (state: RootState) => state.fileOps.librarySearchResultCount,
+ const successfulImportJobCount = useSelector(
+ (state: RootState) => state.fileOps.successfulJobCount,
);
const failedImportJobCount = useSelector(
(state: RootState) => state.fileOps.failedJobCount,
@@ -149,16 +149,16 @@ export const Import = (props: IProps): ReactElement => {
- {libraryQueueResults && (
+ {successfulImportJobCount > 0 && (
- {libraryQueueResults}
+ {successfulImportJobCount}
)}
- {!isUndefined(failedImportJobCount) && (
+ {failedImportJobCount > 0 && (
{failedImportJobCount}
@@ -171,7 +171,13 @@ export const Import = (props: IProps): ReactElement => {
- Imported {lastQueueJob}
+ {libraryQueueImportStatus !== "drained" &&
+ !isUndefined(libraryQueueImportStatus) && (
+ <>
+ Imported{" "}
+ {lastQueueJob}
+ >
+ )}
);
diff --git a/src/client/constants/action-types.ts b/src/client/constants/action-types.ts
index cde0b74..7a69fbf 100644
--- a/src/client/constants/action-types.ts
+++ b/src/client/constants/action-types.ts
@@ -51,11 +51,12 @@ export const IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS =
"IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS";
export const IMS_COMIC_BOOK_GROUPS_CALL_FAILED =
"IMS_COMIC_BOOK_GROUPS_CALL_FAILED";
-export const VOLUMES_FETCHED="VOLUMES_FETCHED";
+export const VOLUMES_FETCHED = "VOLUMES_FETCHED";
// search results from the Search service
export const SS_SEARCH_RESULTS_FETCHED = "SS_SEARCH_RESULTS_FETCHED";
-export const SS_SEARCH_RESULTS_FETCHED_SPECIAL = "SS_SEARCH_RESULTS_FETCHED_SPECIAL";
+export const SS_SEARCH_RESULTS_FETCHED_SPECIAL =
+ "SS_SEARCH_RESULTS_FETCHED_SPECIAL";
export const SS_SEARCH_IN_PROGRESS = "SS_SEARCH_IN_PROGRESS";
export const SS_SEARCH_FAILED = "SS_SEARCH_FAILED";
@@ -124,13 +125,15 @@ export const AIRDCPP_TRANSFERS_FETCHED = "AIRDCPP_TRANSFERS_FETCHED";
// Comics marked as "wanted"
export const WANTED_COMICS_FETCHED = "WANTED_COMICS_FETCHED";
-// LIBRARY SOCKET ENDPOINT
+// LIBRARY Service import queue-related action types
export const LS_IMPORT = "LS_IMPORT";
export const LS_COVER_EXTRACTED = "LS_COVER_EXTRACTED";
export const LS_COVER_EXTRACTION_FAILED = "LS_COVER_EXTRACTION_FAILED";
export const LS_COMIC_ADDED = "LS_COMIC_ADDED";
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";
// Settings
export const SETTINGS_CALL_IN_PROGRESS = "SETTINGS_CALL_IN_PROGRESS";
diff --git a/src/client/reducers/fileops.reducer.ts b/src/client/reducers/fileops.reducer.ts
index 2ff706f..7073e90 100644
--- a/src/client/reducers/fileops.reducer.ts
+++ b/src/client/reducers/fileops.reducer.ts
@@ -35,6 +35,7 @@ import {
HEALTH_STATUS_TICK,
LS_IMPORT_QUEUE_DRAINED,
LS_SET_QUEUE_STATUS,
+ RESTORE_JOB_COUNTS_AFTER_SESSION_RESTORATION,
} from "../constants/action-types";
import { removeLeadingPeriod } from "../shared/utils/formatting.utils";
import { LIBRARY_SERVICE_HOST } from "../constants/endpoints";
@@ -62,7 +63,7 @@ const initialState = {
volumes: [],
librarySearchResultsFormatted: [],
lastQueueJob: "",
- librarySearchResultCount: 0,
+ successfulJobCount: 0,
failedJobCount: 0,
libraryQueueResults: [],
librarySearchError: {},
@@ -160,21 +161,20 @@ function fileOpsReducer(state = initialState, action) {
LSQueueImportStatus: "running",
};
}
+
case LS_COVER_EXTRACTED: {
- console.log("BASH", action);
if (state.recentComics.length === 5) {
state.recentComics.pop();
}
return {
...state,
- librarySearchResultCount: action.completedJobCount,
+ successfulJobCount: action.completedJobCount,
lastQueueJob: action.importResult.rawFileDetails.name,
recentComics: [...state.recentComics, action.importResult],
};
}
case LS_COVER_EXTRACTION_FAILED: {
- console.log("FAILED", action);
return {
...state,
failedJobCount: action.failedJobCount,
@@ -182,19 +182,18 @@ function fileOpsReducer(state = initialState, action) {
}
case LS_IMPORT_QUEUE_DRAINED: {
- console.log("drained");
return {
...state,
LSQueueImportStatus: "drained",
};
}
- case "RESTORE_JOB_COUNTS_AFTER_SESSION_RESTORATION": {
- console.log(action);
+ case RESTORE_JOB_COUNTS_AFTER_SESSION_RESTORATION: {
return {
...state,
- librarySearchResultCount: action.completedJobCount,
+ successfulJobCount: action.completedJobCount,
failedJobCount: action.failedJobCount,
+ LSQueueImportStatus: action.queueStatus,
};
}
--
2.49.1
From b0282ccbb3772c1ed496fc7efc4c772f317a436a Mon Sep 17 00:00:00 2001
From: Rishi Ghan