Skip to content

The file view's columns sort the folder, of an indexed volume - #245

Merged
djthorpe merged 12 commits into
mainfrom
djt/1123/sort-ui
Nov 23, 2026
Merged

djthorpe merged 12 commits into
mainfrom
djt/1123/sort-ui

Conversation

@djthorpe

@djthorpe djthorpe commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Refs #218. Stacked on #244 (server-side sort), merged in. Needs @mutablelogic/go-server v1.8.31 (mutablelogic/go-server#242), which frontend/package.json now requires. This is the UI half: clicking a column header sorts the folder, for volumes whose files are indexed.

Which volumes: volumeSortable(volume) is true when the volume's index mode includes files (objects, metadata or artwork) and its status is ready. A rescan of a ready index stays ready, so sorting keeps working through rescans.

Which columns:

Column Server sort First click
Name title ascending
File name ascending
Kind kind ascending
Format type ascending
Size size descending (largest first)
Modified modified descending (newest first)

Every column can be sorted.

How

  • Headers: gs-table sorts on header clicks once a column has sort and sortFirst. Clicking calls ListController.setSort, which reloads from the top.
  • Paging: FolderController's list() passes the sort as sort=-size and so on, still paging by start_after from the last loaded file.
  • Remembered per volume: the chosen sort is saved in localStorage (gf-file-view-sort:<volume>), next to the columns. Opening a volume restores its sort when the volume is sortable, otherwise it isn't sorted.
  • Kept while unsortable: a volume that can't be sorted right now, such as while it's being re-indexed, keeps its saved sort for later (FolderController.unsorted). Only sorts the user picks are saved.
  • Hiding the sorted column sorts by Name, the first column, and saves that.
  • At least one column: the last visible column can't be hidden; its settings item is disabled (TableSetting.disabled). A saved "all hidden" falls back to the defaults.
  • Switching volume loads the new volume's folder in its own sort, waiting for the list to load rather than calling refresh() again, which would load the first page twice.

djthorpe and others added 2 commits November 23, 2026 18:02
ListObjectsRequest has Sort: name, size, modified or type, with - before
it for descending, which a volume whose files are indexed lists from its
index, as the backend can't, even while work is queued, so its order
doesn't change meanwhile. The store sorts by the value, and the key, of
the same, after start_after's object's value and key, so paging is the
same. A volume whose files aren't indexed, or aren't yet, is
ErrNotImplemented. The HTTP API, the client and the CLI have sort.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… volume

Of a volume whose files are indexed, and ready, File, Format, Size and
Modified sort the folder, by the server's listing's sort, when their
headers are clicked: File and Format ascending first, and Size and
Modified descending. The folder controller's listing passes the sort,
and another volume's folder, or a volume which can't be sorted any more,
isn't sorted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 17:06
…unsorts it

The order which is chosen of a volume is remembered in the browser, as
its columns are, and is its folders' order when it's opened again, when
it can be sorted. A volume which can't be sorted, for now, isn't, and
its order is kept until it can be. Hiding the column it's sorted by sorts
it of the first column's order, of the objects' names, which is
remembered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved sorting regressions can trigger 501 errors during index upgrades, prematurely close open file panels, and reset the chosen order when returning to the same volume’s root.

3 open issues
What changed in this PR

Adds the file-view UI for server-side folder sorting introduced in #244, addressing the sorting portion of #218 for indexed volumes.

Changes:

  • Enables sortable File, Format, Size, and Modified headers with column-specific initial directions.
  • Passes sorting through paginated requests and clears it when switching volumes or losing sorting eligibility.
  • Adds controller and eligibility tests, plus file-view documentation.
File Description
frontend/​test/​folder.test.ts Tests sort requests, pagination, volume switching, and eligibility.
frontend/​src/​volumes/​view.ts Passes volume sorting eligibility to the file view.
frontend/​src/​folder/​view.ts Configures sortable headers and clears unsupported sorting.
frontend/​src/​folder/​format.ts Defines server sort keys and initial directions.
frontend/​src/​folder/​controller.ts Sends sort parameters and resets sorting across volumes.
frontend/​src/​filer/​schema.ts Adds the sort query field and eligibility helper.
frontend/​README.md Documents sortable columns and their behavior.

Review effort: Balanced

Comment thread frontend/src/filer/schema.ts Resolved
Comment thread frontend/src/folder/controller.ts Resolved
Comment thread frontend/src/folder/view.ts Resolved
djthorpe and others added 4 commits November 23, 2026 18:15
The sorts of a listing of the index have title, of an object's dc:title,
a task's rather than the backend's, or else its name, in any case, and
kind, of its metadata:kind, or else its media type's major type, when it
says what it is, as the web UI shows them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Name sorts by the server's title, and Kind by its kind, ascending first,
and hiding the column the folder is sorted by sorts it by Name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The last column which is shown can't be hidden, of the settings menu,
whose item is disabled, and columns which were all hidden are the
defaults. Needs go-server's disabled settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@djthorpe
djthorpe marked this pull request as draft November 23, 2026 17:18
djthorpe and others added 3 commits November 23, 2026 18:23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…path, and its sort first

Sorting by modified is of the seconds since the epoch, to the
millisecond, rather than the stored text, whose fractions and offsets
aren't in order. A sorted listing of a file's path is the file, alone,
of the index, and a path with a / after it is the folder's. A sort which
isn't one is a bad request, before a volume which isn't indexed is said
to be unable to sort.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@djthorpe
djthorpe marked this pull request as ready for review November 23, 2026 17:25
Base automatically changed from djt/1123/sort to main November 23, 2026 17:36
djthorpe and others added 2 commits November 23, 2026 18:36
… and sorting keeps the panel open

A volume's index has sortable, of whether its files are indexed, of its
last scan which finished, so a volume whose index is raised to its files
isn't sortable until they're scanned, as the server checks, and the web
UI's headers are sortable of it. The folder controller keeps the volume
which was last opened, so a volume whose root is found, which closes its
folder, is still sorted. A file's panel isn't closed while its folder is
loaded again, such as once it's sorted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@djthorpe djthorpe self-assigned this Nov 23, 2026
@djthorpe
djthorpe merged commit 9479b6d into main Nov 23, 2026
8 checks passed
@djthorpe
djthorpe deleted the djt/1123/sort-ui branch November 23, 2026 17:45
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