Skip to content

feat(ui): sort columns + per-panel filter#67

Merged
VirusAlex merged 1 commit intomainfrom
feat/sort-and-filter
May 1, 2026
Merged

feat(ui): sort columns + per-panel filter#67
VirusAlex merged 1 commit intomainfrom
feat/sort-and-filter

Conversation

@VirusAlex
Copy link
Copy Markdown
Owner

Summary

Two pieces of file-manager UX both panels were missing.

Clickable sort columns

  • Click Name / Size / Modified in the column header → sort by that column ascending.
  • Click the same column again → flip to descending.
  • A small / marks the active column in accent colour.
  • The "dirs first → files → symlinks" grouping is preserved (file-manager convention) — the chosen column orders within each group. So "Sort by Size desc" gives you "all dirs alphabetically, then files biggest-first".
  • Sort state persists across breadcrumb navigation within a panel session.

Per-panel filter

A new row between the breadcrumb and the filelist with a text input.

  • Substring match (case-insensitive) on entry name.
  • 150 ms debounce so typing doesn't thrash.
  • Esc clears, × button clears.
  • Filter does NOT recurse — it operates on the current view only. Finding files deeper still needs the cross-tree comparison via /api/browse/stats, which is a separate feature.
  • Filter resets on directory navigation (stale filter from another folder is rarely what you want).

Selection semantics under filter

Action Behaviour
"Select all" (header checkbox) Toggles ONLY the visible (filtered) entries. Selecting hidden ones silently would surprise.
Selections made BEFORE filter Survive while filter is active. Toggle filter off → they reappear.
allSelected() True iff every visible entry is in the selection.

Implementation

Pure client-side: ~50 lines in browser.js (state, displayEntries(), _compareEntries, setSort, clearFilter), header markup tweaks in index.html for both panels, and .col-sortable / .col-sorted / .panel-filter styles in style.css. No API changes, no Java touched.

Test plan

  • Local mvn compile clean; mvn test -Dtest=ArchitectureTest 8/8 pass.
  • CI green.
  • Manual: navigate into a folder with mixed dirs+files+symlinks; verify dirs always come first; toggle each column header; verify the arrow glyph follows.
  • Manual: type into the filter field; verify rows filter live, ↑↓ in keyboard tests, Esc clears.
  • Manual: select some entries, then filter; check Header → "Select all" toggles only the visible ones; clear filter; verify pre-filter selections still there.
  • Manual: navigate to a different folder; verify filter resets (sort prefs persist).

🤖 Generated with Claude Code

Both panels gain two controls users coming from any file manager expect:

  - **Sort columns**: clicking the Name / Size / Modified column header
    sorts by that column ascending; clicking it again flips to descending.
    A small ▲ / ▼ glyph marks the active column in accent colour. The
    "dirs first → files → symlinks" grouping is preserved (file-manager
    convention); the chosen column orders WITHIN each group. Sort state
    persists across breadcrumb navigation but resets per panel session.

  - **Filter row** between the breadcrumb and the filelist: substring
    match (case-insensitive) on the entry name. 150 ms debounce so
    typing doesn't thrash. Esc clears, × button clears. Filter does NOT
    recurse — it operates on the current view only; finding files
    deeper still needs the cross-tree comparison via /api/browse/stats.
    Filter resets on directory navigation since a stale filter from
    another folder is rarely what the user wants.

Selection semantics under filter:
  - "Select all" (header checkbox) toggles only the visible/filtered
    entries — selecting hidden entries silently would surprise users.
  - Selections made before a filter survive while the filter is active
    (the underlying selection list isn't pruned), so toggling the filter
    off shows them again.
  - allSelected() returns true iff every visible entry is in the
    selection.

Pure client-side: no API changes, no Java touched. ~150 lines of
browser.js + index.html + style.css across both panels.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@VirusAlex VirusAlex merged commit cf4faf0 into main May 1, 2026
1 check passed
@VirusAlex VirusAlex deleted the feat/sort-and-filter branch May 1, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants