From c37f4ab7c250d5d65564fa551ec45473f3696937 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Sun, 26 Jan 2025 09:58:44 +0200 Subject: [PATCH] Adds media libraries management table --- .../Common/Models/Common/EmptyModel.cs | 6 + .../Management/LibraryManagementController.cs | 12 + .../Resources/Views/Home/Index.zh-CN.resx | 216 ++++++++++-------- .../Views/Library/Management/Index.de-DE.resx | 126 ++++++++++ .../Views/Library/Management/Index.en-US.resx | 126 ++++++++++ .../Views/Library/Management/Index.es-ES.resx | 126 ++++++++++ .../Views/Library/Management/Index.fr-FR.resx | 126 ++++++++++ .../Views/Library/Management/Index.it-IT.resx | 126 ++++++++++ .../Views/Library/Management/Index.ja-JP.resx | 126 ++++++++++ .../Views/Library/Management/Index.resx | 126 ++++++++++ .../Views/Library/Management/Index.ro-RO.resx | 126 ++++++++++ .../Views/Library/Management/Index.ru-RU.resx | 126 ++++++++++ .../Views/Library/Management/Index.zh-CN.resx | 126 ++++++++++ .../Views/Library/Management/Index.cshtml | 118 ++++++++-- .../wwwroot/css/site.css | 21 ++ 15 files changed, 1516 insertions(+), 117 deletions(-) create mode 100644 src/Lumina.Presentation.Web/Common/Models/Common/EmptyModel.cs diff --git a/src/Lumina.Presentation.Web/Common/Models/Common/EmptyModel.cs b/src/Lumina.Presentation.Web/Common/Models/Common/EmptyModel.cs new file mode 100644 index 00000000..3bd1ef69 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Models/Common/EmptyModel.cs @@ -0,0 +1,6 @@ +namespace Lumina.Presentation.Web.Common.Models.Common; + +/// +/// Record used for empty requests and responses. +/// +public record struct EmptyModel(); diff --git a/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs b/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs index 1e2f723a..5f635c73 100644 --- a/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs +++ b/src/Lumina.Presentation.Web/Controllers/Library/Management/LibraryManagementController.cs @@ -2,6 +2,7 @@ using Lumina.Presentation.Web.Common.Api; using Lumina.Presentation.Web.Common.Attributes; using Lumina.Presentation.Web.Common.Enums.Authorization; +using Lumina.Presentation.Web.Common.Models.Common; using Lumina.Presentation.Web.Common.Models.Libraries; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -112,4 +113,15 @@ public class LibraryManagementController : Controller await _apiHttpClient.DeleteAsync($"libraries/{id}", cancellationToken).ConfigureAwait(false); return Json(new { success = true }); } + + /// + /// Initiates the scan of all media libraries. + /// + /// Cancellation token that can be used to stop the execution. + [HttpPost("api-scan-libraries")] + public async Task ScanAllLibraries(CancellationToken cancellationToken = default) + { + await _apiHttpClient.PostAsync($"libraries/scan", new EmptyModel(), cancellationToken).ConfigureAwait(false); + return Json(new { success = true, data = true }); + } } diff --git a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.zh-CN.resx b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.zh-CN.resx index 4fdb1b6a..9552d9c3 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Home/Index.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Home/Index.zh-CN.resx @@ -1,101 +1,123 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 无库 + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.de-DE.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.de-DE.resx index c0d82467..15334cda 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.de-DE.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.de-DE.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Wissenschaftliche Arbeit + + + Aktionen + + + Anime + + + Hörbuch + + + Buch + + + Buchreihe + + + Scan Abbrechen + + + Comic-Heft + + + Comic-Serie + + + Konzert + + + Coverversion + Sind Sie sicher, dass Sie die ausgewählte Bibliothek löschen möchten? + + Dokumentarfilm + + + E-Buch + Bearbeiten + + Aktiviert + + + Filmfranchise + + + Filmreihe + + + Grafischer Roman + + + Interview + Bibliotheken Die Bibliothek wurde gelöscht! + + Bibliothekstyp + + + Live-Auftritt + + + Gesperrt + + + Zeitschrift + + + Manga + + + Spielfilm + + + Musik + + + Nein + Keine Bibliotheken + + Sonstige + + + Persönlich + + + Fotoalbum + + + Podcast + + + Radiosendung + + + Neuabmischung + Entfernen + + Alle Bibliotheken Scannen + + + Drehbuch + + + Notenblatt + + + Soundeffekt + + + Titel + + + Anleitung + + + Fernsehserie + + + Videoclip + + + Ja + + + YouTube + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.en-US.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.en-US.resx index 21523706..6055637b 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.en-US.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.en-US.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Academic Paper + + + Actions + + + Anime + + + Audio Book + + + Book + + + Book Series + + + Cancel Scan + + + Comic Book + + + Comic Series + + + Concert + + + Cover + Are you sure you want to delete the specified library? + + Documentary + + + E Book + Edit + + Enabled + + + Film Franchise + + + Film Series + + + Graphic Novel + + + Interview + Libraries The library has been deleted! + + Library Type + + + Live Performance + + + Locked + + + Magazine + + + Manga + + + Movie + + + Music + + + No + No libraries + + Other + + + Personal + + + Photo Album + + + Podcast + + + Radio Show + + + Remix + Remove + + Scan All Libraries + + + Screenplay + + + Sheet Music + + + Sound Effect + + + Title + + + Tutorial + + + Tv Show + + + Videoclip + + + Yes + + + YouTube + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.es-ES.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.es-ES.resx index 0de053f6..8fda5a80 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.es-ES.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.es-ES.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Artículo Académico + + + Acciones + + + Anime + + + Audiolibro + + + Libro + + + Serie de Libros + + + Cancelar Escaneo + + + Cómic + + + Serie de Cómics + + + Concierto + + + Versión + ¿Está seguro de que desea eliminar la biblioteca especificada? + + Documental + + + Libro Electrónico + Editar + + Activado + + + Franquicia Cinematográfica + + + Saga Cinematográfica + + + Novela Gráfica + + + Entrevista + Bibliotecas ¡La biblioteca ha sido eliminada! + + Tipo de Biblioteca + + + Actuación en Vivo + + + Bloqueado + + + Revista + + + Manga + + + Película + + + Música + + + No + Sin bibliotecas + + Otro + + + Personal + + + Álbum de Fotos + + + Podcast + + + Programa de Radio + + + Remezcla + Eliminar + + Escanear Todas Las Bibliotecas + + + Guión + + + Partitura Musical + + + Efecto de Sonido + + + Título + + + Tutorial + + + Serie de Televisión + + + Videoclip + + + Sí + + + YouTube + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.fr-FR.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.fr-FR.resx index 0817e439..3970a7b1 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.fr-FR.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.fr-FR.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Article Académique + + + Actions + + + Animé + + + Livre Audio + + + Livre + + + Série de Livres + + + Annuler Le Scan + + + Bande Dessinée + + + Série de Bandes Dessinées + + + Concert + + + Reprise + Êtes-vous sûr de vouloir supprimer la bibliothèque spécifiée? + + Documentaire + + + Livre Numérique + Modifier + + Activé + + + Franchise Cinématographique + + + Saga Cinématographique + + + Roman Graphique + + + Entretien + Bibliothèques La bibliothèque a été supprimée! + + Type de Bibliothèque + + + Concert Live + + + Verrouillé + + + Magazine + + + Manga + + + Film + + + Musique + + + Non + Aucune bibliothèque + + Autre + + + Personnel + + + Album Photo + + + Podcast + + + Émission Radio + + + Remixage + Supprimer + + Scanner Toutes Les Bibliothèques + + + Scénario + + + Partition Musicale + + + Effet Sonore + + + Titre + + + Tutoriel + + + Série Télévisée + + + Clip Vidéo + + + Oui + + + YouTube + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.it-IT.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.it-IT.resx index 47edc4f5..dc9edd08 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.it-IT.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.it-IT.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Articolo Accademico + + + Azioni + + + Anime + + + Audiolibro + + + Libro + + + Serie di Libri + + + Annulla Scansione + + + Fumetto + + + Serie di Fumetti + + + Concerto + + + Reinterpretazione + È sicuro di voler eliminare la libreria specificata? + + Documentario + + + E-Book + Modifica + + Attivato + + + Franchise Cinematografico + + + Saga Cinematografica + + + Romanzo Grafico + + + Intervista + Librerie La libreria è stata eliminata! + + Tipo di Libreria + + + Esibizione dal Vivo + + + Bloccato + + + Rivista + + + Manga + + + Film + + + Musica + + + No + Nessuna libreria + + Altro + + + Personale + + + Album Fotografico + + + Podcast + + + Programma Radiofonico + + + Remissaggio + Rimuovere + + Scansiona Tutte Le Librerie + + + Sceneggiatura + + + Spartito Musicale + + + Effetto Sonoro + + + Titolo + + + Tutorial + + + Serie Televisiva + + + Videoclip + + + Sì + + + YouTube + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ja-JP.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ja-JP.resx index 3984906d..162efdf0 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ja-JP.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ja-JP.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 学術論文 + + + アクション + + + アニメ + + + オーディオブック + + + 本 + + + 本シリーズ + + + スキャンを中止 + + + 漫画 + + + 漫画シリーズ + + + コンサート + + + カバー曲 + 指定されたライブラリを削除してもよろしいですか? + + ドキュメンタリー + + + 電子書籍 + 編集 + + 有効 + + + 映画フランチャイズ + + + 映画シリーズ + + + グラフィックノベル + + + インタビュー + ライブラリ ライブラリが削除されました! + + ライブラリの種類 + + + ライブパフォーマンス + + + ロック済 + + + 雑誌 + + + 漫画 + + + 映画 + + + 音楽 + + + いいえ + ライブラリがありません + + その他 + + + 個人的な + + + フォトアルバム + + + ポッドキャスト + + + ラジオ番組 + + + リミックス + 削除 + + すべてのライブラリをスキャン + + + 脚本 + + + 楽譜 + + + 効果音 + + + タイトル + + + チュートリアル + + + テレビドラマ + + + 動画クリップ + + + はい + + + ユーチューブ + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.resx index 21523706..6055637b 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Academic Paper + + + Actions + + + Anime + + + Audio Book + + + Book + + + Book Series + + + Cancel Scan + + + Comic Book + + + Comic Series + + + Concert + + + Cover + Are you sure you want to delete the specified library? + + Documentary + + + E Book + Edit + + Enabled + + + Film Franchise + + + Film Series + + + Graphic Novel + + + Interview + Libraries The library has been deleted! + + Library Type + + + Live Performance + + + Locked + + + Magazine + + + Manga + + + Movie + + + Music + + + No + No libraries + + Other + + + Personal + + + Photo Album + + + Podcast + + + Radio Show + + + Remix + Remove + + Scan All Libraries + + + Screenplay + + + Sheet Music + + + Sound Effect + + + Title + + + Tutorial + + + Tv Show + + + Videoclip + + + Yes + + + YouTube + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ro-RO.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ro-RO.resx index 68fd180f..f9d9382e 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ro-RO.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ro-RO.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Lucrare Academică + + + Acțiuni + + + Anime + + + Carte Audio + + + Carte + + + Serie de Cărți + + + Anulează Scanarea + + + Bandă Desenată + + + Serie de Benzi Desenate + + + Concert + + + Preluare + Sunteți sigur că doriți să ștergeți biblioteca specificată? + + Documentar + + + Carte Electronică + Editează + + Activat + + + Franciză de Film + + + Serie de Filme + + + Roman Grafic + + + Interviu + Biblioteci Biblioteca a fost ștearsă! + + Tip Bibliotecă + + + Spectacol Live + + + Blocat + + + Revistă + + + Manga + + + Film + + + Muzică + + + Nu + Nicio bibliotecă + + Altceva + + + Personal + + + Album Foto + + + Podcast + + + Emisiune Radio + + + Remix + Șterge + + Scanează Toate Bibliotecile + + + Scenariu + + + Partitură Muzicală + + + Efect Sonor + + + Titlu + + + Tutorial + + + Serial TV + + + Videoclip + + + Da + + + YouTube + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ru-RU.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ru-RU.resx index 86d65aff..d174f846 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ru-RU.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.ru-RU.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Научная Статья + + + Действия + + + Аниме + + + Аудиокнига + + + Книга + + + Книжная Серия + + + Отменить Сканирование + + + Комикс + + + Серия Комиксов + + + Концерт + + + Кавер + Вы уверены, что хотите удалить указанную библиотеку? + + Документальный Фильм + + + Электронная Книга + Редактировать + + Включено + + + Кинофраншиза + + + Киносерия + + + Графический Роман + + + Интервью + Библиотеки Библиотека удалена! + + Тип Библиотеки + + + Живое Выступление + + + Заблокировано + + + Журнал + + + Манга + + + Фильм + + + Музыка + + + Нет + Нет библиотек + + Другой + + + Личный + + + Фотоальбом + + + Подкаст + + + Радиопередача + + + Ремикс + Удалить + + Сканировать Все Библиотеки + + + Сценарий + + + Нотная Запись + + + Звуковой Эффект + + + Заголовок + + + Учебник + + + Телесериал + + + Видеоролик + + + Да + + + Ютуб + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.zh-CN.resx b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.zh-CN.resx index 7c600260..e269dfe8 100644 --- a/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Resources/Views/Library/Management/Index.zh-CN.resx @@ -117,22 +117,148 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 学术论文 + + + 操作 + + + 动画 + + + 有声书 + + + 书 + + + 丛书 + + + 取消扫描 + + + 漫画 + + + 漫画系列 + + + 音乐会 + + + 翻唱 + 您确定要删除指定的库吗? + + 纪录片 + + + 电子书 + 编辑 + + 已启用 + + + 电影系列品牌 + + + 电影系列 + + + 图像小说 + + + 访谈 + 库 库已删除! + + 库类型 + + + 现场表演 + + + 已锁定 + + + 杂志 + + + 漫画 + + + 电影 + + + 音乐 + + + 否 + 无库 + + 其他 + + + 个人的 + + + 相册 + + + 播客 + + + 广播节目 + + + 混音版 + 删除 + + 扫描所有库 + + + 剧本 + + + 乐谱 + + + 音效 + + + 标题 + + + 教程 + + + 电视连续剧 + + + 视频短片 + + + 是 + + + 油管 + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Views/Library/Management/Index.cshtml b/src/Lumina.Presentation.Web/Views/Library/Management/Index.cshtml index b264ca39..b0dfaad2 100644 --- a/src/Lumina.Presentation.Web/Views/Library/Management/Index.cshtml +++ b/src/Lumina.Presentation.Web/Views/Library/Management/Index.cshtml @@ -20,16 +20,28 @@

- @(_localizer["Libraries"]) + @_localizer["Libraries"]

-
-
-
- -
-
+ + + + + + + + + + + + + + +
+ +
+

@_localizer["NoLibraries"]

@section Scripts { @@ -37,30 +49,77 @@ // create cleanup registry for this view const cleanupFunctions = []; let isInitialized = false; - + const jsLocalizedLibraryTypes = { + Book: '@_localizer["Book"]', + EBook: '@_localizer["EBook"]', + BookSeries: '@_localizer["BookSeries"]', + ComicBook: '@_localizer["ComicBook"]', + ComicSeries: '@_localizer["ComicSeries"]', + Magazine: '@_localizer["Magazine"]', + Manga: '@_localizer["Manga"]', + GraphicNovel: '@_localizer["GraphicNovel"]', + AcademicPaper: '@_localizer["AcademicPaper"]', + SheetMusic: '@_localizer["SheetMusic"]', + Screenplay: '@_localizer["Screenplay"]', + TvShow: '@_localizer["TvShow"]', + Movie: '@_localizer["Movie"]', + FilmSeries: '@_localizer["FilmSeries"]', + FilmFranchise: '@_localizer["FilmFranchise"]', + Concert: '@_localizer["Concert"]', + Documentary: '@_localizer["Documentary"]', + Tutorial: '@_localizer["Tutorial"]', + Personal: '@_localizer["Personal"]', + Anime: '@_localizer["Anime"]', + Youtube: '@_localizer["Youtube"]', + Videoclip: '@_localizer["Videoclip"]', + Music: '@_localizer["Music"]', + AudioBook: '@_localizer["AudioBook"]', + LivePerformance: '@_localizer["LivePerformance"]', + Interview: '@_localizer["Interview"]', + Cover: '@_localizer["Cover"]', + Remix: '@_localizer["Remix"]', + Soundeffect: '@_localizer["Soundeffect"]', + Podcast: '@_localizer["Podcast"]', + RadioShow: '@_localizer["RadioShow"]', + PhotoAlbum: '@_localizer["PhotoAlbum"]', + Other: '@_localizer["Other"]' + }; + const btnScanAllLibraries = document.getElementById('btn-scan-all-libraries'); + const btnCancelLibrariesScan = document.getElementById('btn-cancel-libraries-scan'); + // on view load const loadLibrariesAsync = async function() { const response = await callApiGetAsync('@_urlService.GetAbsoluteUrl("GetLibraries", "LibraryManagement")'); - const table = document.getElementById('add-media-directory-form-table'); - const container = document.getElementById('libraries-content'); + const table = document.getElementById('media-libraries-table'); + const tbody = table.querySelector('tbody') || table.appendChild(document.createElement('tbody')); + const noMediaLibrary = document.getElementById('no-media-libaries'); if (response && response.length > 0) { - table.innerHTML = response.map(library => { + table.style.display = 'table'; + noMediaLibrary.style.display = 'none'; + btnScanAllLibraries.style.display = 'block'; + tbody.innerHTML = response.map(library => { const editUrl = '@_urlService.GetAbsoluteUrl("EditLibrary", "LibraryManagement", new { id = default(Guid) })' .replace('/@(default(Guid))', `/${library.id}`); - return ` -
- ${library.title} - - @_localizer[ - - @_localizer[ -
+ + ${library.title} + ${jsLocalizedLibraryTypes[library.libraryType]} + ${library.isEnabled === true ? `@_localizer["Yes"]` : `@_localizer["No"]`} + ${library.isLocked === true ? `@_localizer["Yes"]` : `@_localizer["No"]`} + + + @_localizer[ + + @_localizer[ + + `; }).join(''); } else { - container.innerHTML = '

@_localizer["NoLibraries"]

'; + btnScanAllLibraries.style.display = 'none'; + table.style.display = 'none'; + noMediaLibrary.style.display = 'block'; } }; @@ -84,12 +143,31 @@ } }; + // on scan all libraries button click + const handleScanAllLibrariesClick = async function(e) { + const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl("ScanAllLibraries", "LibraryManagement")', {}); + if (data) { + btnScanAllLibraries.style.display = 'none'; + btnCancelLibrariesScan.style.display = 'block'; + } + }; + + // on cancel all libraries scan button click + const handleCancelLibrariesScanClick = async function(e) { + btnCancelLibrariesScan.style.display = 'none'; + btnScanAllLibraries.style.display = 'block'; + }; + // add listeners + btnScanAllLibraries.addEventListener('click', handleScanAllLibrariesClick); + btnCancelLibrariesScan.addEventListener('click', handleCancelLibrariesScanClick); document.addEventListener('click', handleDeleteLibraryClick); document.addEventListener('DOMContentLoaded', InitializeAsync); // register cleanup for these listeners cleanupFunctions.push(() => { + btnScanAllLibraries.removeEventListener('click', handleScanAllLibrariesClick); + btnCancelLibrariesScan.removeEventListener('click', handleCancelLibrariesScanClick); document.removeEventListener('click', handleDeleteLibraryClick); document.removeEventListener('DOMContentLoaded', InitializeAsync); }); diff --git a/src/Lumina.Presentation.Web/wwwroot/css/site.css b/src/Lumina.Presentation.Web/wwwroot/css/site.css index 382ad313..7d542613 100644 --- a/src/Lumina.Presentation.Web/wwwroot/css/site.css +++ b/src/Lumina.Presentation.Web/wwwroot/css/site.css @@ -355,6 +355,27 @@ main { cursor: pointer; } +table { + border-spacing: 0px; + width: 100%; +} + +th, td { + border-top: 1px solid var(--border-color-light); + border-left: 1px solid var(--border-color-light); + border-bottom: 1px solid var(--border-color-dark); + border-right: 1px solid var(--border-color-dark); + padding: 3px 8px; +} + + tr:nth-child(even) { + background-color: var(--dark-row-background); + } + + tr:nth-child(odd) { + background-color: var(--light-row-background); + } + /* Margins */ .mt-0 { margin-top: 0px;