From a2ae4ce79d1d3ccc44f3d8f0306bbda816adeeb2 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Fri, 18 Aug 2023 11:38:37 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Refactoring=20the=20Import=20Pag?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/components/Dashboard/Dashboard.tsx | 36 ++++------ src/client/components/Import.tsx | 66 ++++++++++--------- src/client/constants/action-types.ts | 3 +- src/client/reducers/fileops.reducer.ts | 14 +++- 4 files changed, 61 insertions(+), 58 deletions(-) diff --git a/src/client/components/Dashboard/Dashboard.tsx b/src/client/components/Dashboard/Dashboard.tsx index 1ded75e..433e850 100644 --- a/src/client/components/Dashboard/Dashboard.tsx +++ b/src/client/components/Dashboard/Dashboard.tsx @@ -44,7 +44,7 @@ export const Dashboard = (): ReactElement => { }, []); const recentComics = useSelector( - (state: RootState) => state.fileOps.recentComics + (state: RootState) => state.fileOps.recentComics, ); const wantedComics = useSelector( (state: RootState) => state.fileOps.wantedComics, @@ -67,42 +67,30 @@ export const Dashboard = (): ReactElement => { <>
-
+ iconClassNames="fa-solid fa-file-invoice mr-2" + />
- + - - - - - - - - - + - - - - - - - - -
Pos + Pos + TeamPldWDLGFGAGDPtsQualification or relegation + Pld +
1Leicester City (C) - 38231236836+3281Qualification for the Champions League group stage
@@ -137,4 +125,4 @@ export const Dashboard = (): ReactElement => { ); }; -export default Dashboard; \ No newline at end of file +export default Dashboard; diff --git a/src/client/components/Import.tsx b/src/client/components/Import.tsx index 63a8fa1..73ca758 100644 --- a/src/client/components/Import.tsx +++ b/src/client/components/Import.tsx @@ -32,6 +32,9 @@ export const Import = (props: IProps): ReactElement => { const libraryQueueResults = useSelector( (state: RootState) => state.fileOps.librarySearchResultCount, ); + const failedImportJobCount = useSelector( + (state: RootState) => state.fileOps.failedImportJobCount, + ); const libraryQueueImportStatus = useSelector( (state: RootState) => state.fileOps.IMSCallInProgress, ); @@ -63,22 +66,22 @@ export const Import = (props: IProps): ReactElement => { return (
-

Import

+

Import Comics

- Import Only + Import Comics - will add comics identified from the mapped folder into the local - db. + will add comics identified from the mapped folder into ThreeTwo's + database.

- - Import and Tag - - will scan the ComicVine, shortboxed APIs and import comics from - the mapped folder with the additional metadata. + Metadata from ComicInfo.xml, if present, will also be extracted. +

+

+ This process could take a while, if you have a lot of comics, or + are importing over a network connection.

@@ -94,33 +97,34 @@ export const Import = (props: IProps): ReactElement => { - Import Only - - -

-
-
-
+
+
+
- {JSON.stringify(libraryQueueResults, null, 2)} + {libraryQueueResults}
-
-
-
- -
+
+
+
+ + {failedImportJobCount} + +
+
+ +
+
+
+
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, }; }