feat: show Role and Usage/Quota columns on the Accounts list

Created At is replaced with two columns that previously required
opening each account individually: Role (badge, resolved against
x:UserRoles specifically since the list's merged User/Group field
definitions otherwise resolve `roles` against the wrong object) and
Usage / Quota (usedDiskQuota vs quotas.maxDiskQuota, "Unlimited" when
no limit is set).

Also makes renderCellValue's generic 'object' case resolve variant
labels via schema.schemas, instead of only ever printing the raw
@type string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Steven RYDELL
2026-07-30 16:47:26 +02:00
co-authored by Claude Sonnet 5
parent 3113e6309d
commit 3dda6d1527
4 changed files with 87 additions and 4 deletions
+34
View File
@@ -0,0 +1,34 @@
/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
import type { Schema } from '@/types/schema';
/**
* The Accounts list only shows Email/Full Name/Created At, hiding role and
* storage usage that otherwise require opening each account individually.
* `createdAt` is dropped to make room; `roles` is a real property so it
* renders through the normal field pipeline, but `quotaUsage` is synthetic
* (not a real server property) — DynamicList resolves it to the
* `usedDiskQuota` + `quotas.maxDiskQuota` pair and formats it specially.
*/
export function withAccountListColumns(schema: Schema): Schema {
const list = schema.lists['x:Account/User'];
if (!list) return schema;
const columns = [
...list.columns.filter((c) => c.name !== 'createdAt'),
{ name: 'roles', label: 'Role' },
{ name: 'quotaUsage', label: 'Usage / Quota' },
];
return {
...schema,
lists: {
...schema.lists,
'x:Account/User': { ...list, columns },
},
};
}