feat(accounts): add Aliases count column to Accounts and Groups
Same pattern as the existing quotaUsage deviation: neither list's schema exposes an alias count as a column, only the full `aliases` objectList on the detail view. Added a synthetic `aliasCount` column (SCHEMA-DEVIATION: account-alias-count-column, documented in SCHEMA_DEVIATIONS.md) that DynamicList resolves by fetching the real `aliases` property and counting its entries. Verified against a live test server: adding a real alias to an account correctly bumps its Aliases count from 0 to 1 in the list.
This commit is contained in:
@@ -19,6 +19,12 @@ import type { Schema } from '@/types/schema';
|
||||
* The Groups list gets the same `quotaUsage` column (groups have their own
|
||||
* `usedDiskQuota`/`quotas`, same as users), but not `roles` — that column
|
||||
* is specific to the Users list.
|
||||
*
|
||||
* SCHEMA-DEVIATION: account-alias-count-column (see SCHEMA_DEVIATIONS.md)
|
||||
*
|
||||
* Both lists also get a synthetic `aliasCount` column — DynamicList
|
||||
* resolves it from the real `aliases` objectList property (an id-keyed
|
||||
* map, per JMAP's objectList wire format) and renders its entry count.
|
||||
*/
|
||||
export function withAccountListColumns(schema: Schema): Schema {
|
||||
let lists = schema.lists;
|
||||
@@ -29,13 +35,18 @@ export function withAccountListColumns(schema: Schema): Schema {
|
||||
...userList.columns.filter((c) => c.name !== 'createdAt'),
|
||||
{ name: 'roles', label: 'Role' },
|
||||
{ name: 'quotaUsage', label: 'Usage / Quota' },
|
||||
{ name: 'aliasCount', label: 'Aliases' },
|
||||
];
|
||||
lists = { ...lists, 'x:Account/User': { ...userList, columns } };
|
||||
}
|
||||
|
||||
const groupList = lists['x:Account/Group'];
|
||||
if (groupList) {
|
||||
const columns = [...groupList.columns, { name: 'quotaUsage', label: 'Usage / Quota' }];
|
||||
const columns = [
|
||||
...groupList.columns,
|
||||
{ name: 'quotaUsage', label: 'Usage / Quota' },
|
||||
{ name: 'aliasCount', label: 'Aliases' },
|
||||
];
|
||||
lists = { ...lists, 'x:Account/Group': { ...groupList, columns } };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user