feat(accounts): add Usage/Quota column to Groups, show unlimited as ∞

Groups have real usedDiskQuota/quotas fields, same as Users, but the
Groups list schema doesn't expose usage as a column any more than the
Accounts list did — extend the existing account-quota-usage-column
deviation to x:Account/Group too (SCHEMA_DEVIATIONS.md updated).

The isAccountsList gate that resolved/rendered quotaUsage was hardcoded
to viewName === 'x:Account/User', so it silently no-oped for Groups.
Replaced with hasQuotaUsageColumn, derived from whether the resolved
list's own columns include the synthetic quotaUsage column — works for
any list withAccountListColumns patches, not just a hardcoded pair of
view names.

Also: "Unlimited" (no quota configured) now renders as "∞" instead of
the word, matching the size formatting style used elsewhere in the
column.
This commit is contained in:
Steven RYDELL
2026-08-01 20:02:10 +02:00
parent 09910a7bf9
commit 0aa92c394c
4 changed files with 33 additions and 22 deletions
+21 -14
View File
@@ -15,22 +15,29 @@ import type { Schema } from '@/types/schema';
* 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.
*
* 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.
*/
export function withAccountListColumns(schema: Schema): Schema {
const list = schema.lists['x:Account/User'];
if (!list) return schema;
let lists = schema.lists;
const columns = [
...list.columns.filter((c) => c.name !== 'createdAt'),
{ name: 'roles', label: 'Role' },
{ name: 'quotaUsage', label: 'Usage / Quota' },
];
const userList = lists['x:Account/User'];
if (userList) {
const columns = [
...userList.columns.filter((c) => c.name !== 'createdAt'),
{ name: 'roles', label: 'Role' },
{ name: 'quotaUsage', label: 'Usage / Quota' },
];
lists = { ...lists, 'x:Account/User': { ...userList, columns } };
}
return {
...schema,
lists: {
...schema.lists,
'x:Account/User': { ...list, columns },
},
};
const groupList = lists['x:Account/Group'];
if (groupList) {
const columns = [...groupList.columns, { name: 'quotaUsage', label: 'Usage / Quota' }];
lists = { ...lists, 'x:Account/Group': { ...groupList, columns } };
}
return { ...schema, lists };
}