feat(lists): make the most relevant columns sortable on the new tables
Mailing Lists, Roles, and Domains got new/existing columns in prior commits but no way to sort them — the account-client-sort mechanism was only wired up in accountColumns.ts. Extracted its one-line clientSortable() column tagger into schemaDeviationTypes.ts (shared, same intersection-type pattern) and used it in all four column-patch files: - Mailing Lists: Email Address, Description, Aliases - Roles: Description, Enabled Permissions, Disabled Permissions - Domains: Domain Name, Enabled, Aliases Re-verified server sort support live, per list this time rather than just Accounts: every property tried returns unsupportedSort except one surprise — x:Domain/query actually accepts sort by "name", despite the schema not declaring it. Documented in SCHEMA_DEVIATIONS.md and deliberately routed through the same client-sort path as everything else instead of adding a one-off "trust an undeclared sort" mechanism for that single case. Verified in the running dev server: sort indicators appear on the intended columns for all three lists, clicking reorders rows correctly (alphabetical on Mailing Lists' Email Address, numeric on Roles' Enabled Permissions: 1 -> 3 -> 50 -> 229 -> 244 -> 452), Domains sorts without error. No regression on Accounts/Groups.
This commit is contained in:
+10
-3
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import type { Schema } from '@/types/schema';
|
||||
import { clientSortable } from './schemaDeviationTypes';
|
||||
|
||||
/**
|
||||
* SCHEMA-DEVIATION: role-permission-count-columns (see SCHEMA_DEVIATIONS.md)
|
||||
@@ -14,6 +15,12 @@ import type { Schema } from '@/types/schema';
|
||||
* synthetic columns — DynamicList's generic count-column handling
|
||||
* resolves them from the real `enabledPermissions`/`disabledPermissions`
|
||||
* set properties and renders their entry counts.
|
||||
*
|
||||
* SCHEMA-DEVIATION: account-client-sort (see SCHEMA_DEVIATIONS.md)
|
||||
*
|
||||
* Description and both permission-count columns are tagged
|
||||
* `clientSortable` — same reasoning as Accounts/Groups: the server
|
||||
* doesn't support sorting on any `x:Role` property either.
|
||||
*/
|
||||
export function withRoleListColumns(schema: Schema): Schema {
|
||||
const list = schema.lists['x:Role'];
|
||||
@@ -26,9 +33,9 @@ export function withRoleListColumns(schema: Schema): Schema {
|
||||
'x:Role': {
|
||||
...list,
|
||||
columns: [
|
||||
...list.columns,
|
||||
{ name: 'enabledPermissionCount', label: 'Enabled Permissions' },
|
||||
{ name: 'disabledPermissionCount', label: 'Disabled Permissions' },
|
||||
...list.columns.map((c) => (c.name === 'description' ? clientSortable(c) : c)),
|
||||
clientSortable({ name: 'enabledPermissionCount', label: 'Enabled Permissions' }),
|
||||
clientSortable({ name: 'disabledPermissionCount', label: 'Disabled Permissions' }),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user