feat(domains): add Aliases count column
Same account-alias-count-column deviation already used on Accounts, Groups, and Mailing Lists, extended to x:Domain: adds a synthetic aliasCount column resolved from the real aliases property (a `set` of alias domain names here, vs. an objectList elsewhere — same id-keyed wire format, so the existing generic COUNT_COLUMN_SOURCES handling needed no changes). Verified in the running dev server: the column renders correctly alongside the domain's existing Enabled/Certificate/DNS columns.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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';
|
||||
|
||||
/**
|
||||
* SCHEMA-DEVIATION: account-alias-count-column (see SCHEMA_DEVIATIONS.md)
|
||||
*
|
||||
* The Domains list doesn't expose alias-domain count as a column, only
|
||||
* the full `aliases` set on the detail view. Adds the same synthetic
|
||||
* `aliasCount` column already used on Accounts/Groups/Mailing Lists —
|
||||
* DynamicList's generic count-column handling picks it up with no
|
||||
* further wiring.
|
||||
*/
|
||||
export function withDomainColumns(schema: Schema): Schema {
|
||||
const list = schema.lists['x:Domain'];
|
||||
if (!list) return schema;
|
||||
|
||||
return {
|
||||
...schema,
|
||||
lists: {
|
||||
...schema.lists,
|
||||
'x:Domain': { ...list, columns: [...list.columns, { name: 'aliasCount', label: 'Aliases' }] },
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import { withClientLogFilters } from '@/lib/logFilters';
|
||||
import { withAccountListColumns } from '@/lib/accountColumns';
|
||||
import { withMailingListColumns } from '@/lib/mailingListColumns';
|
||||
import { withRoleListColumns } from '@/lib/roleColumns';
|
||||
import { withDomainColumns } from '@/lib/domainColumns';
|
||||
import { setLocale } from '@/i18n';
|
||||
import { TopBar } from '@/components/layout/TopBar';
|
||||
import { Sidebar } from '@/components/layout/Sidebar';
|
||||
@@ -152,7 +153,11 @@ export default function AdminPanel() {
|
||||
|
||||
if (cancelled) return;
|
||||
|
||||
setSchema(withRoleListColumns(withMailingListColumns(withAccountListColumns(withClientLogFilters(schemaData)))));
|
||||
setSchema(
|
||||
withDomainColumns(
|
||||
withRoleListColumns(withMailingListColumns(withAccountListColumns(withClientLogFilters(schemaData)))),
|
||||
),
|
||||
);
|
||||
|
||||
setAccountInfo(accountData.permissions, accountData.edition, accountData.locale);
|
||||
setLocale(accountData.locale);
|
||||
|
||||
Reference in New Issue
Block a user