Lots of Bugfixes (#2960)

Co-authored-by: Samuel Martins <s@smartins.ch>
Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
Joe Milazzo 2024-05-22 06:58:23 -05:00 committed by GitHub
parent 97ffdd0975
commit b50fa0fd1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 563 additions and 282 deletions

View file

@ -134,6 +134,10 @@ public static class MessageFactory
/// A Theme was updated and UI should refresh to get the latest version
/// </summary>
public const string SiteThemeUpdated = "SiteThemeUpdated";
/// <summary>
/// A Progress event when a smart collection is synchronizing
/// </summary>
public const string SmartCollectionSync = "SmartCollectionSync";
public static SignalRMessage DashboardUpdateEvent(int userId)
{
@ -425,6 +429,31 @@ public static class MessageFactory
};
}
/// <summary>
/// Represents a file being scanned by Kavita for processing and grouping
/// </summary>
/// <remarks>Does not have a progress as it's unknown how many files there are. Instead sends -1 to represent indeterminate</remarks>
/// <param name="folderPath"></param>
/// <param name="libraryName"></param>
/// <param name="eventType"></param>
/// <returns></returns>
public static SignalRMessage SmartCollectionProgressEvent(string collectionName, string seriesName, int currentItems, int totalItems, string eventType)
{
return new SignalRMessage()
{
Name = SmartCollectionSync,
Title = $"Synchronizing {collectionName}",
SubTitle = seriesName,
EventType = eventType,
Progress = ProgressType.Determinate,
Body = new
{
Progress = float.Min((currentItems / (totalItems * 1.0f)), 100f),
EventTime = DateTime.Now
}
};
}
/// <summary>
/// This informs the UI with details about what is being processed by the Scanner
/// </summary>