2026-04-20 22:54:19 +02:00
|
|
|
import { createListPageModule } from '../core/app-list-page-module.js';
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
import { escapeHtml } from './app-list-utils.js';
|
2026-03-05 08:26:51 +01:00
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
createListPageModule({
|
|
|
|
|
configId: 'admin-tenants-index',
|
|
|
|
|
moduleId: 'admin-tenants-index',
|
|
|
|
|
missingGridMessage: 'Tenants grid init failed: Grid.js missing',
|
|
|
|
|
initErrorMessage: 'Tenants grid init failed',
|
|
|
|
|
setup: ({ config, gridjs, appBase, initListPage }) => {
|
|
|
|
|
const filterSchema = config.filterSchema ?? [];
|
|
|
|
|
const filterChipMeta = config.filterChipMeta ?? [];
|
|
|
|
|
const labels = config.labels ?? {};
|
2026-03-05 08:26:51 +01:00
|
|
|
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
const tenantUuidIndex = 2;
|
2026-04-20 22:54:19 +02:00
|
|
|
|
|
|
|
|
const { gridConfig } = initListPage({
|
|
|
|
|
grid: {
|
|
|
|
|
gridjs,
|
|
|
|
|
container: '#tenants-grid',
|
|
|
|
|
dataUrl: 'admin/tenants/data',
|
|
|
|
|
appBase,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
name: labels.tenant || 'Tenant',
|
|
|
|
|
sort: true,
|
|
|
|
|
width: '75%',
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
formatter: (cell) => gridjs.html(escapeHtml(String(cell ?? ''))),
|
2026-03-05 11:17:42 +01:00
|
|
|
},
|
2026-04-20 22:54:19 +02:00
|
|
|
{
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
name: labels.users || 'Users',
|
2026-04-20 22:54:19 +02:00
|
|
|
sort: true,
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
width: '25%',
|
2026-04-20 22:54:19 +02:00
|
|
|
formatter: (cell) => {
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
const number = Number(cell ?? 0);
|
|
|
|
|
return gridjs.html(String(Number.isFinite(number) ? number : 0));
|
2026-04-20 22:54:19 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'UUID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
},
|
|
|
|
|
],
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
sortColumns: ['description', 'users', null],
|
2026-04-20 22:54:19 +02:00
|
|
|
paginationLimit: 10,
|
|
|
|
|
language: config.gridLang ?? {},
|
|
|
|
|
mapData: (data) => data.data.map((row) => [
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
row.description ?? '',
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
row.total_users ?? 0,
|
2026-04-20 22:54:19 +02:00
|
|
|
row.uuid,
|
|
|
|
|
]),
|
refactor(admin-tenants): simplify list to 2 columns (avatar + name, users)
Reduce tenant grid from 8 columns to 2. Remove status, theme, sso,
active/inactive users, and created columns from the list view.
All details remain accessible on the edit page.
- filter-schema: allow order by description and users only
- data endpoint: return minimal row shape (id, uuid, description,
status metadata for badge only, is_default, has_avatar, total_users)
- JS grid: 2 visible columns + hidden UUID for navigation
- CSS: add .grid-tenant-profile utility for flex avatar+name layout
Refs: TENANT-LIST-MINIMAL-001
2026-04-22 19:10:48 +02:00
|
|
|
rowInteraction: { linkColumn: 0 },
|
|
|
|
|
search: config.gridSearch ?? null,
|
2026-04-20 22:54:19 +02:00
|
|
|
filterSchema,
|
|
|
|
|
urlSync: true,
|
|
|
|
|
rowDataset: (row) => ({
|
|
|
|
|
uuid: row?.cells?.[tenantUuidIndex]?.data,
|
|
|
|
|
}),
|
|
|
|
|
rowDblClick: {
|
|
|
|
|
getUrl: (rowData) => {
|
|
|
|
|
const uuid = rowData?.cells?.[tenantUuidIndex]?.data;
|
|
|
|
|
return uuid ? new URL(`admin/tenants/edit/${uuid}`, appBase).toString() : '';
|
2026-03-05 08:26:51 +01:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
filters: {
|
|
|
|
|
mode: 'drawer',
|
|
|
|
|
chipMeta: filterChipMeta,
|
|
|
|
|
watchInputs: ['#tenant-search'],
|
|
|
|
|
},
|
2026-04-20 22:54:19 +02:00
|
|
|
}) || {};
|
2026-03-05 08:26:51 +01:00
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
return gridConfig;
|
|
|
|
|
},
|
|
|
|
|
});
|