From 8a8b88af13bb86fc8391e80cd7bcf9a035d2fbd1 Mon Sep 17 00:00:00 2001 From: Marc Hannappel Date: Wed, 21 Dec 2016 09:44:24 +0100 Subject: [PATCH 1/3] Fix folders doesn't get listed when performing a filtering in file section, issue #1667 --- src/octoprint/static/js/app/viewmodels/files.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index 24695b2d..2563ebe8 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -708,11 +708,12 @@ $(function() { return false; } - if (entry["type"] == "folder" && entry["children"]) { + var success = entry["name"].toLocaleLowerCase().indexOf(query) > -1; + if (!success && entry["type"] == "folder" && entry["children"]) { return _.any(entry["children"], recursiveSearch); - } else { - return entry["name"].toLocaleLowerCase().indexOf(query) > -1; } + + return success; }; self.listHelper.changeSearchFunction(recursiveSearch); From bcb74d01b63ba18ddf071320ed1007c1a4ef9da8 Mon Sep 17 00:00:00 2001 From: Marc Hannappel Date: Wed, 21 Dec 2016 10:51:19 +0100 Subject: [PATCH 2/3] Added active tab using hash from URL feature, as requested in issue #203 --- src/octoprint/static/js/app/main.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/octoprint/static/js/app/main.js b/src/octoprint/static/js/app/main.js index 86221ca4..d762f1e5 100644 --- a/src/octoprint/static/js/app/main.js +++ b/src/octoprint/static/js/app/main.js @@ -478,6 +478,15 @@ $(function() { // reload overlay $("#reloadui_overlay_reload").click(function() { location.reload(); }); + var changeTab = function() + { + var hashtag = window.location.hash; + + var tab = $('#tabs a[href="' + hashtag + '"]'); + tab.tab("show"); + onTabChange(hashtag); + } + //~~ view model binding var bindViewModels = function() { @@ -566,6 +575,15 @@ $(function() { callViewModels(allViewModels, "onBrowserTabVisibilityChange", [status]); }); + $(window).on("hashchange", function() { + changeTab(); + }); + + if (window.location.hash != "") + { + changeTab(); + } + log.info("Application startup complete"); }; From b3f35c579b37bbfd7e02671a7572e26289fe2f2c Mon Sep 17 00:00:00 2001 From: Marc Hannappel Date: Wed, 21 Dec 2016 10:56:11 +0100 Subject: [PATCH 3/3] Little update to the active tab using hash from URL, forgot to add a check if the hash is valid, fixed this now --- src/octoprint/static/js/app/main.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/octoprint/static/js/app/main.js b/src/octoprint/static/js/app/main.js index d762f1e5..80b1701e 100644 --- a/src/octoprint/static/js/app/main.js +++ b/src/octoprint/static/js/app/main.js @@ -481,10 +481,12 @@ $(function() { var changeTab = function() { var hashtag = window.location.hash; - var tab = $('#tabs a[href="' + hashtag + '"]'); - tab.tab("show"); - onTabChange(hashtag); + if (tab.length) + { + tab.tab("show"); + onTabChange(hashtag); + } } //~~ view model binding