mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 17:11:10 +00:00
Adds real time media libraries scan progress update via SignalR
This commit is contained in:
1 parent
d70b2dcaa0
commit
e0d61802df
71 files changed
+1292
-131
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Libraries;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media library scan job progress model.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("CompletedItems: {CompletedItems}; TotalItems: {TotalItems}")]
|
||||
public class LibraryScanJobProgressModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the number of completed items of the media library scan job.
|
||||
/// </summary>
|
||||
public int CompletedItems { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the total number of items of the media library scan job.
|
||||
/// </summary>
|
||||
public int TotalItems { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current operation being performed by the media library scan job.
|
||||
/// </summary>
|
||||
public string? CurrentOperation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ratio between the total number and the completed number of items, as a percentage.
|
||||
/// </summary>
|
||||
public decimal ProgressPercentage { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Libraries;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media library scan progress model.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("ScanId: {ScanId}; UserId: {UserId}; LibraryId: {LibraryId}")]
|
||||
public class LibraryScanProgressModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the media library scan.
|
||||
/// </summary>
|
||||
public Guid ScanId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the user initiating this media library scan.
|
||||
/// </summary>
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the media library that is scanned.
|
||||
/// </summary>
|
||||
public Guid LibraryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of completed jobs of the media library scan job.
|
||||
/// </summary>
|
||||
public int CompletedJobs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the total number of jobs of the media library scan job.
|
||||
/// </summary>
|
||||
public int TotalJobs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional current job progress of the media library scan.
|
||||
/// </summary>
|
||||
public LibraryScanJobProgressModel? CurrentJobProgress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the status of the media library scan.
|
||||
/// </summary>
|
||||
public string? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ratio between the total number and the completed number of jobs, as a percentage.
|
||||
/// </summary>
|
||||
public decimal OverallProgressPercentage { get; set; }
|
||||
}
|
||||
+11
@@ -114,6 +114,17 @@ public class LibraryManagementController : Controller
|
||||
return Json(new { success = true });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of ongoing media library scans.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
[HttpGet("api-get-running-library-scans")]
|
||||
public async Task<IActionResult> GetRunningLibraryScans(CancellationToken cancellationToken = default)
|
||||
{
|
||||
LibraryScanProgressModel[] response = await _apiHttpClient.GetAsync<LibraryScanProgressModel[]>($"libraries/scans/running/", cancellationToken).ConfigureAwait(false);
|
||||
return Json(new { success = true, data = response });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiates the scan of all media libraries.
|
||||
/// </summary>
|
||||
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>Anzahl der abgeschlossenen Scan-Aufträge darf die Gesamtanzahl der Scan-Aufträge nicht überschreiten!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>CORS-Origins dürfen nicht leer sein!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>Ungültiger CORS-Origin!</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>Completed scan jobs count can't exceed total scan jobs count!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>CORS origins cannot be empty!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>CORS origin is invalid!</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>¡El número de trabajos de escaneo completados no puede exceder el número total de trabajos de escaneo!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>¡Las origines CORS no pueden estar vacías!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>¡Origen CORS no válido!</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>Le nombre de tâches de scan terminées ne peut pas dépasser le nombre total de tâches de scan !</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>Les origines CORS ne peuvent pas être vides !</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>Origine CORS invalide !</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>Il numero dei lavori di scansione completati non può superare il numero totale dei lavori di scansione!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>Le origini CORS non possono essere vuote!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>Origine CORS non valida!</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>完了したスキャンジョブ数は合計スキャンジョブ数を超えることはできません!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>CORSオリジンは空ではいけません!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>CORSオリジンが無効です!</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>Completed scan jobs count can't exceed total scan jobs count!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>CORS origins cannot be empty!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>CORS origin is invalid!</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>Numărul de job-uri de scanare completate nu poate depăși numărul total de job-uri de scanare!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>Originile CORS nu pot fi goale!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>Origine CORS invalidă!</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>Количество завершенных заданий сканирования не может превышать общее количество заданий сканирования!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>Список CORS-источников не может быть пустым!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>Недействительный CORS-источник!</value>
|
||||
</data>
|
||||
</root>
|
||||
+6
@@ -585,4 +585,10 @@
|
||||
<data name="CompletedScanJobsCountCantExceedTotalScanJobsCount" xml:space="preserve">
|
||||
<value>已完成扫描任务数量不能超过扫描任务总数!</value>
|
||||
</data>
|
||||
<data name="CorsOriginsCannotBeEmpty" xml:space="preserve">
|
||||
<value>CORS来源不能为空!</value>
|
||||
</data>
|
||||
<data name="CorsOriginIsInvalid" xml:space="preserve">
|
||||
<value>CORS来源无效!</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>Buchreihe</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>Abgebrochen</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>Scan Abbrechen</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>Datei-Hashes werden verglichen...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>Abgeschlossen</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>Konzert</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>Aktiviert</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Fehlgeschlagen</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>Filmfranchise</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>Book Series</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>Canceled</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>Cancel Scan</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>Comparing file hashes...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>Completed</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>Concert</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>Enabled</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Failed</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>Film Franchise</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>Serie de Libros</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>Cancelado</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>Cancelar Escaneo</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>Se están comparando hashes de archivos...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>Completado</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>Concierto</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>Activado</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Fallido</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>Franquicia Cinematográfica</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>Série de Livres</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>Annulé</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>Annuler Le Scan</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>Comparer les hachages de fichiers...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>Terminé</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>Concert</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>Activé</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Échec</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>Franchise Cinématographique</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>Serie di Libri</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>Annullato</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>Annulla Scansione</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>Si stanno confrontando gli hash dei file...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>Completato</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>Concerto</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>Attivato</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Fallito</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>Franchise Cinematografico</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>本シリーズ</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>キャンセル済み</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>スキャンを中止</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>ファイルのハッシュを比較中...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>完了</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>コンサート</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>有効</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>失敗</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>映画フランチャイズ</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>Book Series</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>Canceled</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>Cancel Scan</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>Comparing file hashes...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>Completed</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>Concert</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>Enabled</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Failed</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>Film Franchise</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>Serie de Cărți</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>Anulat</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>Anulează Scanarea</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>Se compară hash-urile fișierelor...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>Finalizat</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>Concert</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>Activat</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Eșuat</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>Franciză de Film</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>Книжная Серия</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>Отменено</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>Отменить Сканирование</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>Сравнение хешей файлов...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>Завершено</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>Концерт</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>Включено</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Ошибка</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>Кинофраншиза</value>
|
||||
</data>
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<data name="BookSeries" xml:space="preserve">
|
||||
<value>丛书</value>
|
||||
</data>
|
||||
<data name="Canceled" xml:space="preserve">
|
||||
<value>已取消</value>
|
||||
</data>
|
||||
<data name="CancelScan" xml:space="preserve">
|
||||
<value>取消扫描</value>
|
||||
</data>
|
||||
@@ -147,6 +150,9 @@
|
||||
<data name="ComparingFileHashes" xml:space="preserve">
|
||||
<value>正在比较文件哈希值...</value>
|
||||
</data>
|
||||
<data name="Completed" xml:space="preserve">
|
||||
<value>已完成</value>
|
||||
</data>
|
||||
<data name="Concert" xml:space="preserve">
|
||||
<value>音乐会</value>
|
||||
</data>
|
||||
@@ -171,6 +177,9 @@
|
||||
<data name="Enabled" xml:space="preserve">
|
||||
<value>已启用</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>失败</value>
|
||||
</data>
|
||||
<data name="FilmFranchise" xml:space="preserve">
|
||||
<value>电影系列品牌</value>
|
||||
</data>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
@using Lumina.Presentation.Web.Common.Models.Libraries
|
||||
@using Lumina.Presentation.Web.Common.Services
|
||||
@using Microsoft.AspNetCore.Mvc.Localization
|
||||
@using System.Security.Claims
|
||||
|
||||
@{
|
||||
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
|
||||
@@ -14,6 +15,90 @@
|
||||
@inject IUrlService _urlService
|
||||
@inject IViewLocalizer _localizer
|
||||
|
||||
<style>
|
||||
/* main container */
|
||||
.td-scan {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
padding: 4px 0;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
/* text label */
|
||||
.scan-job-status {
|
||||
flex: 1;
|
||||
padding: 0 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* progress bar container */
|
||||
.scan-progress {
|
||||
flex: 0 0 80px;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 10px;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
/* progress bars */
|
||||
.scan-progress-total,
|
||||
.scan-progress-job {
|
||||
height: 50%;
|
||||
background: #ddd;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scan-progress-total > div,
|
||||
.scan-progress-job > div {
|
||||
height: 100%;
|
||||
background: #4CAF50;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.icon-groups {
|
||||
flex: 0 0 auto; /* prevent shrinking */
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-left: auto; /* push to right */
|
||||
}
|
||||
|
||||
/* status icons subgroup */
|
||||
.status-icons {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* action icons subgroup */
|
||||
.action-icons {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* icon groups */
|
||||
/* status icons (right margin group) */
|
||||
img[src*="green.png"],
|
||||
img[src*="red.png"],
|
||||
img[src*="yellow.png"] {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
/* action icons (fixed size group) */
|
||||
img[src*="stop.svg"],
|
||||
img[src*="trigger.svg"],
|
||||
img[src*="delete.svg"],
|
||||
a > img[src*="edit.svg"] {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
|
||||
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
|
||||
<div class="enlightenment-panel shadow-effect mx-auto panel w-75 mb-10" style="min-width: 320px;">
|
||||
@@ -27,10 +112,10 @@
|
||||
<thead class="text-light-two">
|
||||
<tr>
|
||||
<th class="w-30">@_localizer["Title"]</th>
|
||||
<th class="w-30">@_localizer["LibraryType"]</th>
|
||||
<th class="w-15">@_localizer["LibraryType"]</th>
|
||||
<th class="w-10">@_localizer["Enabled"]</th>
|
||||
<th class="w-10">@_localizer["Locked"]</th>
|
||||
<th class="w-20">@_localizer["Actions"]</th>
|
||||
<th class="w-35">@_localizer["Actions"]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -49,6 +134,18 @@
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
let isInitialized = false;
|
||||
const jsLocalizedLibraryScanStatuses = {
|
||||
Completed: '@_localizer["Completed"]',
|
||||
Failed: '@_localizer["Failed"]',
|
||||
Canceled: '@_localizer["Canceled"]'
|
||||
};
|
||||
const jsLocalizedLibraryScanJobsStatuses = {
|
||||
DiscoveringFiles: '@_localizer["DiscoveringFiles"]',
|
||||
RetrievingPastScanData: '@_localizer["RetrievingPastScanData"]',
|
||||
ComparingFileHashes: '@_localizer["ComparingFileHashes"]',
|
||||
GoodReadsMetadataDownload: '@_localizer["GoodReadsMetadataDownload"]',
|
||||
SavingScanData: '@_localizer["SavingScanData"]'
|
||||
};
|
||||
const jsLocalizedLibraryTypes = {
|
||||
Book: '@_localizer["Book"]',
|
||||
EBook: '@_localizer["EBook"]',
|
||||
@@ -87,7 +184,17 @@
|
||||
const btnScanAllLibraries = document.getElementById('btn-scan-all-libraries');
|
||||
const btnCancelLibrariesScan = document.getElementById('btn-cancel-libraries-scan');
|
||||
|
||||
// on view load
|
||||
// SignalR
|
||||
const signalRConnection = new signalR.HubConnectionBuilder()
|
||||
.withUrl('http://localhost:5214/scanProgressHub')
|
||||
.withAutomaticReconnect({
|
||||
nextRetryDelayInMilliseconds: retryContext =>
|
||||
Math.min(retryContext.elapsedMilliseconds * 2, 10000)
|
||||
})
|
||||
.configureLogging(signalR.LogLevel.Warning)
|
||||
.build();
|
||||
|
||||
// get media libraries
|
||||
const loadLibrariesAsync = async function() {
|
||||
const response = await callApiGetAsync('@_urlService.GetAbsoluteUrl("GetLibraries", "LibraryManagement")');
|
||||
const table = document.getElementById('media-libraries-table');
|
||||
@@ -107,13 +214,29 @@
|
||||
<td>${jsLocalizedLibraryTypes[library.libraryType]}</td>
|
||||
<td class="text-center">${library.isEnabled === true ? `@_localizer["Yes"]` : `@_localizer["No"]`}</td>
|
||||
<td class="text-center">${library.isLocked === true ? `@_localizer["Yes"]` : `@_localizer["No"]`}</td>
|
||||
<td class="text-end">
|
||||
<img src="/images/ui/stop.svg" alt="@_localizer["CancelScan"]" title="@_localizer["CancelScan"]" class="hidden remove-form-table-row-icon" />
|
||||
<img src="/images/ui/trigger.svg" alt="@_localizer["Scan"]" title="@_localizer["Scan"]" class="remove-form-table-row-icon" />
|
||||
<a href="${editUrl}">
|
||||
<img src="/images/ui/edit.svg" alt="@_localizer["Edit"]" title="@_localizer["Edit"]" class="remove-form-table-row-icon" />
|
||||
</a>
|
||||
<img src="/images/ui/delete.svg" alt="@_localizer["Remove"]" title="@_localizer["Remove"]" class="remove-form-table-row-icon" />
|
||||
<td class="td-scan">
|
||||
<span class="scan-job-status hidden">Downloading metadata</span>
|
||||
<div class="scan-progress hidden">
|
||||
<div class="scan-progress-total"><div></div></div>
|
||||
<div class="scan-progress-job"><div></div></div>
|
||||
</div>
|
||||
|
||||
<div class="icon-groups">
|
||||
<div class="status-icons">
|
||||
<img src="/images/ui/green.png" alt="@_localizer["Completed"]" title="@_localizer["Completed"]" class="hidden status-icon" />
|
||||
<img src="/images/ui/red.png" alt="@_localizer["Failed"]" title="@_localizer["Failed"]" class="hidden status-icon" />
|
||||
<img src="/images/ui/yellow.png" alt="@_localizer["Canceled"]" title="@_localizer["Canceled"]" class="hidden status-icon" />
|
||||
</div>
|
||||
|
||||
<div class="action-icons">
|
||||
<img src="/images/ui/stop.svg" alt="@_localizer["CancelScan"]" title="@_localizer["CancelScan"]" class="hidden action-icon" />
|
||||
<img src="/images/ui/trigger.svg" alt="@_localizer["Scan"]" title="@_localizer["Scan"]" class="action-icon" />
|
||||
<a href="${editUrl}">
|
||||
<img src="/images/ui/edit.svg" alt="@_localizer["Edit"]" title="@_localizer["Edit"]" class="action-icon" />
|
||||
</a>
|
||||
<img src="/images/ui/delete.svg" alt="@_localizer["Remove"]" title="@_localizer["Remove"]" class="mr-5 action-icon" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
@@ -125,6 +248,40 @@
|
||||
}
|
||||
};
|
||||
|
||||
// get which libraries have active scans
|
||||
const getRunningLibraryScansAsync = async function() {
|
||||
const response = await callApiGetAsync('@_urlService.GetAbsoluteUrl("GetRunningLibraryScans", "LibraryManagement")');
|
||||
if (response && response.length > 0) {
|
||||
await Promise.all(response.map(async scan => {
|
||||
const row = document.querySelector(`tr[data-library-id="${scan.libraryId}"]`);
|
||||
if (row) {
|
||||
// restore UI state
|
||||
const scanProgress = row.querySelector('.scan-progress');
|
||||
const totalProgressDiv = row.querySelector('.scan-progress-total > div');
|
||||
const jobProgressDiv = row.querySelector('.scan-progress-job > div');
|
||||
const statusSpan = row.querySelector('.scan-job-status');
|
||||
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
|
||||
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
|
||||
|
||||
row.setAttribute('data-scan-id', scan.scanId);
|
||||
|
||||
statusSpan.textContent = jsLocalizedLibraryScanJobsStatuses[scan.currentJobProgress.currentOperation];
|
||||
statusSpan.classList.remove('hidden');
|
||||
|
||||
scanProgress.classList.remove('hidden');
|
||||
totalProgressDiv.style.width = `${scan.overallProgressPercentage}%`;
|
||||
jobProgressDiv.style.width = `${scan.currentJobProgress.progressPercentage}%`;
|
||||
|
||||
scanIcon.classList.add('hidden');
|
||||
cancelScanIcon.classList.remove('hidden');
|
||||
|
||||
// re-subscribe to SignalR
|
||||
await signalRConnection.invoke('SubscribeToScan', scan.scanId, '@User.FindFirst(ClaimTypes.NameIdentifier)?.Value');
|
||||
}
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
// on delete library icon click
|
||||
const handleDeleteLibraryClick = async function(e) {
|
||||
if (e.target.matches('img[src*="delete.svg"]')) {
|
||||
@@ -152,15 +309,27 @@
|
||||
|
||||
// toggle icons only for libraries that had their scan started
|
||||
const tbody = document.querySelector('tbody');
|
||||
data.forEach(scan => {
|
||||
data.forEach(async scan => {
|
||||
const row = tbody.querySelector(`tr[data-library-id="${scan.libraryId}"]`);
|
||||
if (row) {
|
||||
row.setAttribute('data-scan-id', scan.scanId);
|
||||
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
|
||||
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
|
||||
const completedIdon = row.querySelector('img[src*="green.png"]');
|
||||
const failedIdon = row.querySelector('img[src*="red.png"]');
|
||||
const canceledIdon = row.querySelector('img[src*="yellow.png"]');
|
||||
|
||||
// hide scan status icons
|
||||
completedIdon.classList.add('hidden');
|
||||
failedIdon.classList.add('hidden');
|
||||
canceledIdon.classList.add('hidden');
|
||||
// toggle visibility on scan action icons
|
||||
scanIcon.classList.add('hidden');
|
||||
cancelScanIcon.classList.remove('hidden');
|
||||
|
||||
const scanId = scan.scanId;
|
||||
const userId = '@User.FindFirst(ClaimTypes.NameIdentifier)?.Value';
|
||||
await signalRConnection.invoke('SubscribeToScan', scanId, userId);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -179,9 +348,21 @@
|
||||
row.setAttribute('data-scan-id', success.scanId);
|
||||
const scanIcon = e.target;
|
||||
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
|
||||
const completedIdon = row.querySelector('img[src*="green.png"]');
|
||||
const failedIdon = row.querySelector('img[src*="red.png"]');
|
||||
const canceledIdon = row.querySelector('img[src*="yellow.png"]');
|
||||
|
||||
// hide scan status icons
|
||||
completedIdon.classList.add('hidden');
|
||||
failedIdon.classList.add('hidden');
|
||||
canceledIdon.classList.add('hidden');
|
||||
// toggle visibility on scan action icons
|
||||
scanIcon.classList.add('hidden');
|
||||
cancelScanIcon.classList.remove('hidden');
|
||||
|
||||
const scanId = success.scanId;
|
||||
const userId = '@User.FindFirst(ClaimTypes.NameIdentifier)?.Value';
|
||||
await signalRConnection.invoke('SubscribeToScan', scanId, userId);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -192,14 +373,25 @@
|
||||
btnCancelLibrariesScan.style.display = 'none';
|
||||
btnScanAllLibraries.style.display = 'block';
|
||||
|
||||
// toggle icons for all rows
|
||||
const tbody = document.querySelector('tbody');
|
||||
const allRows = tbody.querySelectorAll('tr');
|
||||
// toggle icons for all active scan rows
|
||||
const rows = document.querySelectorAll('tr[data-scan-id]');
|
||||
|
||||
allRows.forEach(row => {
|
||||
rows.forEach(row => {
|
||||
// remove the scan Id, its no longer being scanned
|
||||
row.removeAttribute('data-scan-id');
|
||||
|
||||
const statusSpan = row.querySelector('.scan-job-status');
|
||||
statusSpan.textContent = `${jsLocalizedLibraryScanStatuses['Canceled']}.`;
|
||||
const scanProgress = row.querySelector('.scan-progress');
|
||||
scanProgress.classList.add('hidden');
|
||||
|
||||
// show scan status icon
|
||||
const completedIdon = row.querySelector('img[src*="yellow.png"]');
|
||||
completedIdon.classList.remove('hidden');
|
||||
|
||||
// toggle scan action icons
|
||||
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
|
||||
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
|
||||
|
||||
scanIcon.classList.remove('hidden');
|
||||
cancelScanIcon.classList.add('hidden');
|
||||
});
|
||||
@@ -228,14 +420,140 @@
|
||||
).join('/');
|
||||
|
||||
await callApiPostAsync(finalUrl);
|
||||
|
||||
// remove the scan Id, its no longer being scanned
|
||||
row.removeAttribute('data-scan-id');
|
||||
|
||||
const statusSpan = row.querySelector('.scan-job-status');
|
||||
statusSpan.textContent = `${jsLocalizedLibraryScanStatuses['Canceled']}.`;
|
||||
const scanProgress = row.querySelector('.scan-progress');
|
||||
scanProgress.classList.add('hidden');
|
||||
|
||||
// show scan status icon
|
||||
const completedIdon = row.querySelector('img[src*="yellow.png"]');
|
||||
completedIdon.classList.remove('hidden');
|
||||
|
||||
// toggle scan action icons
|
||||
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
|
||||
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
|
||||
|
||||
scanIcon.classList.remove('hidden');
|
||||
cancelScanIcon.classList.add('hidden');
|
||||
|
||||
// toggle scan action buttons
|
||||
const hasActiveScans = document.querySelectorAll('tr[data-scan-id]').length > 0;
|
||||
btnCancelLibrariesScan.style.display = hasActiveScans ? 'block' : 'none';
|
||||
btnScanAllLibraries.style.display = hasActiveScans ? 'none' : 'block';
|
||||
}
|
||||
};
|
||||
|
||||
// handle all SignalR stuff
|
||||
function setupSignalRHandlers() {
|
||||
const onReconnecting = error => {
|
||||
console.log(error ? `SignalR reconnected with error: ${error}` : "SignalR reconnecting...");
|
||||
};
|
||||
const onReconnected = connectionId => {
|
||||
console.log('SignalR reconnected:', connectionId);
|
||||
};
|
||||
const onClose = error => {
|
||||
console.log(error ? `SignalR connection closed with error: ${error}` : "SignalR connection closed");
|
||||
};
|
||||
// progress update handler
|
||||
const progressHandler = (progress) => {
|
||||
const rows = document.querySelectorAll(`tr[data-scan-id="${progress.scanId}"]`);
|
||||
rows.forEach(row => {
|
||||
// update status text
|
||||
const statusSpan = row.querySelector('.scan-job-status');
|
||||
statusSpan.textContent = jsLocalizedLibraryScanJobsStatuses[progress.currentJobProgress.currentOperation];
|
||||
statusSpan.classList.remove('hidden');
|
||||
|
||||
// update progress bars
|
||||
const scanProgress = row.querySelector('.scan-progress');
|
||||
const totalProgressDiv = row.querySelector('.scan-progress-total > div');
|
||||
const jobProgressDiv = row.querySelector('.scan-progress-job > div');
|
||||
scanProgress.classList.remove('hidden');
|
||||
totalProgressDiv.style.width = `${progress.overallProgressPercentage}%`;
|
||||
jobProgressDiv.style.width = `${progress.currentJobProgress.progressPercentage}%`;
|
||||
|
||||
// toggle scan action icons
|
||||
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
|
||||
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
|
||||
scanIcon.classList.add('hidden');
|
||||
cancelScanIcon.classList.remove('hidden');
|
||||
});
|
||||
};
|
||||
|
||||
// scan completion handler
|
||||
const completionHandler = (progress) => {
|
||||
const rows = document.querySelectorAll(`tr[data-scan-id="${progress.scanId}"]`);
|
||||
rows.forEach(row => {
|
||||
// remove the scan Id, its no longer being scanned
|
||||
row.removeAttribute('data-scan-id');
|
||||
|
||||
const statusSpan = row.querySelector('.scan-job-status');
|
||||
statusSpan.textContent = `${jsLocalizedLibraryScanStatuses[progress.status]}.`;
|
||||
const scanProgress = row.querySelector('.scan-progress');
|
||||
scanProgress.classList.add('hidden');
|
||||
|
||||
// show scan status icon
|
||||
const completedIdon = row.querySelector('img[src*="green.png"]');
|
||||
completedIdon.classList.remove('hidden');
|
||||
|
||||
// toggle scan action icons
|
||||
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
|
||||
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
|
||||
scanIcon.classList.remove('hidden');
|
||||
cancelScanIcon.classList.add('hidden');
|
||||
});
|
||||
const hasActiveScans = document.querySelectorAll('tr[data-scan-id]').length > 0;
|
||||
btnCancelLibrariesScan.style.display = hasActiveScans ? 'block' : 'none';
|
||||
btnScanAllLibraries.style.display = hasActiveScans ? 'none' : 'block';
|
||||
};
|
||||
|
||||
// scan failure handler
|
||||
const failureHandler = (progress) => {
|
||||
const rows = document.querySelectorAll(`tr[data-scan-id="${progress.scanId}"]`);
|
||||
rows.forEach(row => {
|
||||
// remove the scan Id, its no longer being scanned
|
||||
row.removeAttribute('data-scan-id');
|
||||
|
||||
const statusSpan = row.querySelector('.scan-job-status');
|
||||
statusSpan.textContent = `${jsLocalizedLibraryScanStatuses[progress.status]}.`;
|
||||
const scanProgress = row.querySelector('.scan-progress');
|
||||
scanProgress.classList.add('hidden');
|
||||
|
||||
// show scan status icon
|
||||
const completedIdon = row.querySelector('img[src*="red.png"]');
|
||||
completedIdon.classList.remove('hidden');
|
||||
|
||||
// toggle scan action icons
|
||||
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
|
||||
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
|
||||
scanIcon.classList.remove('hidden');
|
||||
cancelScanIcon.classList.add('hidden');
|
||||
});
|
||||
const hasActiveScans = document.querySelectorAll('tr[data-scan-id]').length > 0;
|
||||
btnCancelLibrariesScan.style.display = hasActiveScans ? 'block' : 'none';
|
||||
btnScanAllLibraries.style.display = hasActiveScans ? 'none' : 'block';
|
||||
};
|
||||
|
||||
// subscribe to events
|
||||
signalRConnection.on("libraryScanProgressUpdateEvent", progressHandler);
|
||||
signalRConnection.on("libraryScanFinishedEvent", completionHandler);
|
||||
signalRConnection.on("libraryScanFailedEvent", failureHandler);
|
||||
signalRConnection.onclose(onClose);
|
||||
signalRConnection.onreconnecting(onReconnecting);
|
||||
signalRConnection.onreconnected(onReconnected);
|
||||
// add to cleanup
|
||||
cleanupFunctions.push(() => {
|
||||
signalRConnection.off("libraryScanProgressUpdateEvent", progressHandler);
|
||||
signalRConnection.off("libraryScanFinishedEvent", completionHandler);
|
||||
signalRConnection.off("libraryScanFailedEvent", failureHandler);
|
||||
signalRConnection.off("close", onClose);
|
||||
signalRConnection.off("reconnecting", onReconnecting);
|
||||
signalRConnection.off("reconnected", onReconnected);
|
||||
});
|
||||
}
|
||||
|
||||
// add listeners
|
||||
btnScanAllLibraries.addEventListener('click', handleScanAllLibrariesClick);
|
||||
btnCancelLibrariesScan.addEventListener('click', handleCancelLibrariesScanClick);
|
||||
@@ -245,7 +563,11 @@
|
||||
document.addEventListener('DOMContentLoaded', InitializeAsync);
|
||||
|
||||
// register cleanup for these listeners
|
||||
cleanupFunctions.push(() => {
|
||||
cleanupFunctions.push(() => {
|
||||
// proper connection stop
|
||||
if (signalRConnection.state === 'Connected')
|
||||
signalRConnection.stop().then(() => console.log('SignalR connection stopped'));
|
||||
|
||||
btnScanAllLibraries.removeEventListener('click', handleScanAllLibrariesClick);
|
||||
btnCancelLibrariesScan.removeEventListener('click', handleCancelLibrariesScanClick);
|
||||
document.removeEventListener('click', handleDeleteLibraryClick);
|
||||
@@ -265,7 +587,14 @@
|
||||
if (isInitialized)
|
||||
return;
|
||||
isInitialized = true;
|
||||
await loadLibrariesAsync();
|
||||
try {
|
||||
await loadLibrariesAsync();
|
||||
await signalRConnection.start();
|
||||
setupSignalRHandlers();
|
||||
await getRunningLibraryScansAsync();
|
||||
} catch (err) {
|
||||
console.error('SignalR connection failed:', err);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Loaded @scriptId`);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
};
|
||||
|
||||
</script>
|
||||
<script src="~/libs/microsoft-signalr/signalr.min.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/notifications.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/dialogs.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/site.js" asp-append-version="true"></script>
|
||||
|
||||
@@ -53,5 +53,12 @@
|
||||
"ApiVersion": 1,
|
||||
"BaseAddress": "http://localhost",
|
||||
"Port": 5214
|
||||
},
|
||||
"Kestrel": {
|
||||
"Endpoints": {
|
||||
"Http": {
|
||||
"Url": "http://localhost:5012"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,2 @@
|
||||
var t, e; t = self, e = function () { return (() => { var t = { d: (e, s) => { for (var n in s) t.o(s, n) && !t.o(e, n) && Object.defineProperty(e, n, { enumerable: !0, get: s[n] }) } }; t.g = function () { if ("object" == typeof globalThis) return globalThis; try { return this || new Function("return this")() } catch (t) { if ("object" == typeof window) return window } }(), t.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e), t.r = t => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "t", { value: !0 }) }; var e, s = {}; t.r(s), t.d(s, { AbortError: () => r, DefaultHttpClient: () => H, HttpClient: () => d, HttpError: () => n, HttpResponse: () => u, HttpTransportType: () => W, HubConnection: () => L, HubConnectionBuilder: () => Q, HubConnectionState: () => R, JsonHubProtocol: () => G, LogLevel: () => e, MessageType: () => A, NullLogger: () => f, Subject: () => U, TimeoutError: () => i, TransferFormat: () => O, VERSION: () => p }); class n extends Error { constructor(t, e) { const s = new.target.prototype; super(`${t}: Status code '${e}'`), this.statusCode = e, this.__proto__ = s } } class i extends Error { constructor(t = "A timeout occurred.") { const e = new.target.prototype; super(t), this.__proto__ = e } } class r extends Error { constructor(t = "An abort occurred.") { const e = new.target.prototype; super(t), this.__proto__ = e } } class o extends Error { constructor(t, e) { const s = new.target.prototype; super(t), this.transport = e, this.errorType = "UnsupportedTransportError", this.__proto__ = s } } class h extends Error { constructor(t, e) { const s = new.target.prototype; super(t), this.transport = e, this.errorType = "DisabledTransportError", this.__proto__ = s } } class c extends Error { constructor(t, e) { const s = new.target.prototype; super(t), this.transport = e, this.errorType = "FailedToStartTransportError", this.__proto__ = s } } class a extends Error { constructor(t) { const e = new.target.prototype; super(t), this.errorType = "FailedToNegotiateWithServerError", this.__proto__ = e } } class l extends Error { constructor(t, e) { const s = new.target.prototype; super(t), this.innerErrors = e, this.__proto__ = s } } class u { constructor(t, e, s) { this.statusCode = t, this.statusText = e, this.content = s } } class d { get(t, e) { return this.send({ ...e, method: "GET", url: t }) } post(t, e) { return this.send({ ...e, method: "POST", url: t }) } delete(t, e) { return this.send({ ...e, method: "DELETE", url: t }) } getCookieString(t) { return "" } } !function (t) { t[t.Trace = 0] = "Trace", t[t.Debug = 1] = "Debug", t[t.Information = 2] = "Information", t[t.Warning = 3] = "Warning", t[t.Error = 4] = "Error", t[t.Critical = 5] = "Critical", t[t.None = 6] = "None" }(e || (e = {})); class f { constructor() { } log(t, e) { } } f.instance = new f; const p = "6.0.1"; class w { static isRequired(t, e) { if (null == t) throw new Error(`The '${e}' argument is required.`) } static isNotEmpty(t, e) { if (!t || t.match(/^\s*$/)) throw new Error(`The '${e}' argument should not be empty.`) } static isIn(t, e, s) { if (!(t in e)) throw new Error(`Unknown ${s} value: ${t}.`) } } class g { static get isBrowser() { return "object" == typeof window } static get isWebWorker() { return "object" == typeof self && "importScripts" in self } static get isNode() { return !this.isBrowser && !this.isWebWorker } } function m(t, e) { let s = ""; return y(t) ? (s = `Binary data of length ${t.byteLength}`, e && (s += `. Content: '${function (t) { const e = new Uint8Array(t); let s = ""; return e.forEach((t => { s += `0x${t < 16 ? "0" : ""}${t.toString(16)} ` })), s.substr(0, s.length - 1) }(t)}'`)) : "string" == typeof t && (s = `String data of length ${t.length}`, e && (s += `. Content: '${t}'`)), s } function y(t) { return t && "undefined" != typeof ArrayBuffer && (t instanceof ArrayBuffer || t.constructor && "ArrayBuffer" === t.constructor.name) } async function b(t, s, n, i, r, o, h) { let c = {}; if (r) { const t = await r(); t && (c = { Authorization: `Bearer ${t}` }) } const [a, l] = $(); c[a] = l, t.log(e.Trace, `(${s} transport) sending data. ${m(o, h.logMessageContent)}.`); const u = y(o) ? "arraybuffer" : "text", d = await n.post(i, { content: o, headers: { ...c, ...h.headers }, responseType: u, timeout: h.timeout, withCredentials: h.withCredentials }); t.log(e.Trace, `(${s} transport) request complete. Response status: ${d.statusCode}.`) } class v { constructor(t, e) { this.i = t, this.h = e } dispose() { const t = this.i.observers.indexOf(this.h); t > -1 && this.i.observers.splice(t, 1), 0 === this.i.observers.length && this.i.cancelCallback && this.i.cancelCallback().catch((t => { })) } } class E { constructor(t) { this.l = t, this.out = console } log(t, s) { if (t >= this.l) { const n = `[${(new Date).toISOString()}] ${e[t]}: ${s}`; switch (t) { case e.Critical: case e.Error: this.out.error(n);
Line truncated
|
||||
//# sourceMappingURL=signalr.js.map
|
||||
@@ -0,0 +1 @@
|
||||
var t, e; t = self, e = function () { return (() => { var t = { d: (e, n) => { for (var o in n) t.o(n, o) && !t.o(e, o) && Object.defineProperty(e, o, { enumerable: !0, get: n[o] }) } }; t.g = function () { if ("object" == typeof globalThis) return globalThis; try { return this || new Function("return this")() } catch (t) { if ("object" == typeof window) return window } }(), t.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e), t.r = t => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "t", { value: !0 }) }; var e, n = {}; t.r(n), t.d(n, { AbortError: () => s, DefaultHttpClient: () => q, HttpClient: () => d, HttpError: () => o, HttpResponse: () => u, HttpTransportType: () => O, HubConnection: () => j, HubConnectionBuilder: () => Z, HubConnectionState: () => W, JsonHubProtocol: () => G, LogLevel: () => e, MessageType: () => H, NullLogger: () => p, Subject: () => L, TimeoutError: () => r, TransferFormat: () => _, VERSION: () => g }); class o extends Error { constructor(t, e) { const n = new.target.prototype; super(`${t}: Status code '${e}'`), this.statusCode = e, this.__proto__ = n } } class r extends Error { constructor(t = "A timeout occurred.") { const e = new.target.prototype; super(t), this.__proto__ = e } } class s extends Error { constructor(t = "An abort occurred.") { const e = new.target.prototype; super(t), this.__proto__ = e } } class i extends Error { constructor(t, e) { const n = new.target.prototype; super(t), this.transport = e, this.errorType = "UnsupportedTransportError", this.__proto__ = n } } class c extends Error { constructor(t, e) { const n = new.target.prototype; super(t), this.transport = e, this.errorType = "DisabledTransportError", this.__proto__ = n } } class a extends Error { constructor(t, e) { const n = new.target.prototype; super(t), this.transport = e, this.errorType = "FailedToStartTransportError", this.__proto__ = n } } class h extends Error { constructor(t) { const e = new.target.prototype; super(t), this.errorType = "FailedToNegotiateWithServerError", this.__proto__ = e } } class l extends Error { constructor(t, e) { const n = new.target.prototype; super(t), this.innerErrors = e, this.__proto__ = n } } class u { constructor(t, e, n) { this.statusCode = t, this.statusText = e, this.content = n } } class d { get(t, e) { return this.send({ ...e, method: "GET", url: t }) } post(t, e) { return this.send({ ...e, method: "POST", url: t }) } delete(t, e) { return this.send({ ...e, method: "DELETE", url: t }) } getCookieString(t) { return "" } } !function (t) { t[t.Trace = 0] = "Trace", t[t.Debug = 1] = "Debug", t[t.Information = 2] = "Information", t[t.Warning = 3] = "Warning", t[t.Error = 4] = "Error", t[t.Critical = 5] = "Critical", t[t.None = 6] = "None" }(e || (e = {})); class p { constructor() { } log(t, e) { } } p.instance = new p; const g = "6.0.1"; class f { static isRequired(t, e) { if (null == t) throw new Error(`The '${e}' argument is required.`) } static isNotEmpty(t, e) { if (!t || t.match(/^\s*$/)) throw new Error(`The '${e}' argument should not be empty.`) } static isIn(t, e, n) { if (!(t in e)) throw new Error(`Unknown ${n} value: ${t}.`) } } class w { static get isBrowser() { return "object" == typeof window } static get isWebWorker() { return "object" == typeof self && "importScripts" in self } static get isNode() { return !this.isBrowser && !this.isWebWorker } } function m(t, e) { let n = ""; return b(t) ? (n = `Binary data of length ${t.byteLength}`, e && (n += `. Content: '${function (t) { const e = new Uint8Array(t); let n = ""; return e.forEach((t => { n += `0x${t < 16 ? "0" : ""}${t.toString(16)} ` })), n.substr(0, n.length - 1) }(t)}'`)) : "string" == typeof t && (n = `String data of length ${t.length}`, e && (n += `. Content: '${t}'`)), n } function b(t) { return t && "undefined" != typeof ArrayBuffer && (t instanceof ArrayBuffer || t.constructor && "ArrayBuffer" === t.constructor.name) } async function y(t, n, o, r, s, i, c) { let a = {}; if (s) { const t = await s(); t && (a = { Authorization: `Bearer ${t}` }) } const [h, l] = S(); a[h] = l, t.log(e.Trace, `(${n} transport) sending data. ${m(i, c.logMessageContent)}.`); const u = b(i) ? "arraybuffer" : "text", d = await o.post(r, { content: i, headers: { ...a, ...c.headers }, responseType: u, timeout: c.timeout, withCredentials: c.withCredentials }); t.log(e.Trace, `(${n} transport) request complete. Response status: ${d.statusCode}.`) } class v { constructor(t, e) { this.i = t, this.h = e } dispose() { const t = this.i.observers.indexOf(this.h); t > -1 && this.i.observers.splice(t, 1), 0 === this.i.observers.length && this.i.cancelCallback && this.i.cancelCallback().catch((t => { })) } } class C { constructor(t) { this.l = t, this.out = console } log(t, n) { if (t >= this.l) { const o = `[${(new Date).toISOString()}] ${e[t]}: ${n}`; switch (t) { case e.Critical: case e.Error: this.out.error(o);
Line truncated
|
||||
Reference in new issue
Block a user