diff --git a/src/main/resources/static/js/plex_libraries.js b/src/main/resources/static/js/plex_libraries.js index c84f72d..b9c2045 100644 --- a/src/main/resources/static/js/plex_libraries.js +++ b/src/main/resources/static/js/plex_libraries.js @@ -47,8 +47,24 @@ function setPreloaderVisibility(bool) { $("#progressBar").toggle(bool); } +function setSearchEnabled(bool) { + if(bool) { + $("#search").css("waves-effect waves-light btn"); + } else { + $("#search").css("waves-effect waves-light btn disabled"); + } +} + +function clearLibrariesAndErrors() { + $("#libraryException").html(''); + $("#libraryCheckboxes").html(''); +} + function getLibraries() { + setSearchEnabled(false); + clearLibrariesAndErrors(); + let obj = JSON.parse(document.cookie); let token = obj.plex_token; let port = obj.port; @@ -73,7 +89,12 @@ function getLibraries() { success: function (data) { allLibraries = data; setPreloaderVisibility(false); + setSearchEnabled(true); generateLibrariesCheckbox(data); + }, error: function (data) { + setPreloaderVisibility(false); + setSearchEnabled(false); + setErrorMessage(); } }); } @@ -85,6 +106,10 @@ function encodeQueryData(data) { return ret.join('&'); } +function setErrorMessage() { + $('#libraryCheckboxes').html('

Something went wrong. Please make sure your connection to Plex is correct. You can navigate back in the title bar and retry. Check the browser and Docker logs for more information.

'); +} + function generateLibrariesCheckbox() { let obj = JSON.parse(document.cookie); let selectedLibraries = obj.libraries || []; diff --git a/src/main/resources/static/plex_libraries.html b/src/main/resources/static/plex_libraries.html index 1583fea..8fb6188 100644 --- a/src/main/resources/static/plex_libraries.html +++ b/src/main/resources/static/plex_libraries.html @@ -62,12 +62,14 @@
+
+
Back
- Search + Search