{# Reusable Jinja macros for paginated + sortable tables on /ui/. Ported from bty's ``ui/_table_macros.html`` so the nbdmux operator UI shares the same header-sort + inline pagination shape bty uses. Callers pass a ``SortState`` + ``PageState`` from ``nbdmux._table_state`` plus a ``preserved`` query-param dict so an active filter survives a header-click or pagination click. #} {% macro sort_header(label, column, sort, preserved, th_attrs='') %} {% set qs = build_query_string( preserved, {'sort': column, 'dir': sort.next_direction(column), 'page': None} ) %}