CBL Import Rework (#1862)
* Fixed a typo in a log * Invalid XML files now "validate" correctly by sending back a failure. * Cleaned up messaging on backend and frontend to provide some linking on series name when collision, handle corrupt xml files, etc. * When reading list conflict occurs, show the reading list name that's conflicting. Started refactoring the code to allow multiple files to be imported at once. * Started adding new CBL elements for some enhancements I have planned with maintainers. * Default to empty string for IpAddress to allow to fallback into existing experience * Tweaked the layout of reading list page (not complete), moved some not used much controls to page extras and reordered the buttons for reading list * Edit Reading Lists now allows selection of cover image from existing items * Fixed a bug where cover chooser base64 to image would fail to write webp files. * Refactored the validate step to now handle multiple files in one go. * Clean up code * Don't show CBL name if there were xml errors that prevented showing it * Don't allow user to go prev step after they perform the import. * Cleaned up the heading code for accordions * Fixed a bug with import keeping failed items * Sort the failures to the bottom of result windows * CBL import is pretty solid. Need one pass from Robbie on Reading List Page
This commit is contained in:
parent
c846b36047
commit
b55d9e3994
30 changed files with 609 additions and 249 deletions
|
|
@ -367,9 +367,11 @@ public class ReadingListService : IReadingListService
|
|||
// Is there another reading list with the same name?
|
||||
if (await _unitOfWork.ReadingListRepository.ReadingListExists(cblReading.Name))
|
||||
{
|
||||
importSummary.Success = CblImportResult.Fail;
|
||||
importSummary.Results.Add(new CblBookResult()
|
||||
{
|
||||
Reason = CblImportReason.NameConflict
|
||||
Reason = CblImportReason.NameConflict,
|
||||
ReadingListName = cblReading.Name
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -391,24 +393,16 @@ public class ReadingListService : IReadingListService
|
|||
if (!conflicts.Any()) return importSummary;
|
||||
|
||||
importSummary.Success = CblImportResult.Fail;
|
||||
if (conflicts.Count == cblReading.Books.Book.Count)
|
||||
foreach (var conflict in conflicts)
|
||||
{
|
||||
importSummary.Results.Add(new CblBookResult()
|
||||
{
|
||||
Reason = CblImportReason.AllChapterMissing,
|
||||
Reason = CblImportReason.SeriesCollision,
|
||||
Series = conflict.Name,
|
||||
LibraryId = conflict.LibraryId,
|
||||
SeriesId = conflict.Id,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var conflict in conflicts)
|
||||
{
|
||||
importSummary.Results.Add(new CblBookResult()
|
||||
{
|
||||
Reason = CblImportReason.SeriesCollision,
|
||||
Series = conflict.Name
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return importSummary;
|
||||
}
|
||||
|
|
@ -484,6 +478,7 @@ public class ReadingListService : IReadingListService
|
|||
importSummary.Results.Add(new CblBookResult(book)
|
||||
{
|
||||
Reason = CblImportReason.VolumeMissing,
|
||||
LibraryId = bookSeries.LibraryId,
|
||||
Order = i
|
||||
});
|
||||
continue;
|
||||
|
|
@ -499,6 +494,7 @@ public class ReadingListService : IReadingListService
|
|||
importSummary.Results.Add(new CblBookResult(book)
|
||||
{
|
||||
Reason = CblImportReason.ChapterMissing,
|
||||
LibraryId = bookSeries.LibraryId,
|
||||
Order = i
|
||||
});
|
||||
continue;
|
||||
|
|
@ -523,11 +519,16 @@ public class ReadingListService : IReadingListService
|
|||
importSummary.Success = CblImportResult.Fail;
|
||||
}
|
||||
|
||||
await CalculateReadingListAgeRating(readingList);
|
||||
|
||||
if (dryRun) return importSummary;
|
||||
|
||||
if (!_unitOfWork.HasChanges()) return importSummary;
|
||||
await CalculateReadingListAgeRating(readingList);
|
||||
if (!string.IsNullOrEmpty(readingList.Summary?.Trim()))
|
||||
{
|
||||
readingList.Summary = readingList.Summary?.Trim();
|
||||
}
|
||||
|
||||
// If there are no items, don't create a blank list
|
||||
if (!_unitOfWork.HasChanges() || !readingList.Items.Any()) return importSummary;
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue