Skip to content

Commit e54c732

Browse files
committed
Use hide mode as default
1 parent 5a46a4c commit e54c732

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

app/javascript/controllers/wunderbaum_controller.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default class extends Controller {
1010
currentFilterPredicate = null;
1111
currentFilterOpts = null;
1212
currentQuery = "";
13-
filterMode = "dim";
13+
filterMode = "hide";
1414
folderCache = new Map();
1515
assetCache = new Map();
1616
loadedFolders = new Set();
@@ -527,18 +527,15 @@ export default class extends Controller {
527527
_updateFilterModeButton() {
528528
const btn = document.getElementById("filter-mode-toggle");
529529
if (!btn) return;
530-
const hasActiveFilter = Boolean(this.currentFilterPredicate);
531-
btn.disabled = !hasActiveFilter;
532-
btn.classList.toggle("active", hasActiveFilter && this.filterMode === "hide");
533-
btn.setAttribute("title", this.filterMode === "hide" ? "Hide unmatched nodes" : "Dim unmatched nodes");
534530
const icon = btn.querySelector("i");
531+
const isHideMode = this.filterMode === "hide";
532+
533+
btn.classList.toggle("active", isHideMode);
534+
btn.setAttribute("title", isHideMode ? "Hide unmatched nodes" : "Dim unmatched nodes");
535+
535536
if (icon) {
536537
icon.classList.remove("bi-filter-square", "bi-filter-square-fill");
537-
if (this.filterMode === "hide") {
538-
icon.classList.add("bi-filter-square-fill");
539-
} else {
540538
icon.classList.add("bi-filter-square");
541-
}
542539
}
543540
}
544541

spec/system/file_tree_column_filter_spec.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,20 @@
5959
expect(page).to have_selector(".wb-popup", count: 1)
6060
end
6161

62-
it "allows switching between dim and hide filter modes" do
63-
expect(page).to have_selector("#filter-mode-toggle[disabled]")
62+
it "allows switching between hide and dim filter modes" do
63+
expect(page).to have_no_selector("#filter-mode-toggle[disabled]")
6464

6565
fill_in "tree-filter", with: match_asset.isilon_name
6666

67-
expect(page).to have_selector("#tree.wb-ext-filter-dim")
68-
expect(page).to have_no_selector("#filter-mode-toggle[disabled]", wait: 10)
69-
70-
find("#filter-mode-toggle").click
7167
expect(page).to have_selector("#tree.wb-ext-filter-hide")
72-
expect(page).to have_selector("#filter-mode-toggle.active")
7368

7469
find("#filter-mode-toggle").click
75-
expect(page).to have_no_selector("#tree.wb-ext-filter-hide")
7670
expect(page).to have_selector("#tree.wb-ext-filter-dim")
71+
expect(page).to have_no_selector("#filter-mode-toggle.active")
72+
73+
find("#filter-mode-toggle").click
74+
expect(page).to have_selector("#tree.wb-ext-filter-hide")
75+
expect(page).to have_no_selector("#tree.wb-ext-filter-dim")
7776
end
7877

7978
it "clears column filter indicators when clearing all filters at once" do
@@ -94,7 +93,7 @@
9493
click_button "Clear All Filters"
9594

9695
expect(page).to have_no_selector(".wb-header [data-command='filter'].wb-helper-invalid", wait: 10)
97-
expect(page).to have_selector("#filter-mode-toggle[disabled]", wait: 10)
96+
expect(page).to have_no_selector("#filter-mode-toggle[disabled]", wait: 10)
9897
expect(page).to have_no_selector("#tree.wb-ext-filter-dim", wait: 10)
9998
end
10099
end

0 commit comments

Comments
 (0)