Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -2,7 +2,7 @@ import { describe, expect, test } from "vitest";
|
||||
|
||||
import { createSubframePlaceholder } from "./index.js";
|
||||
|
||||
describe("@toolctrl/ui-subframe", () => {
|
||||
describe("@hivegrid/ui-subframe", () => {
|
||||
test("exports an empty subframe placeholder contract", () => {
|
||||
expect(createSubframePlaceholder()).toEqual({ status: "empty" });
|
||||
});
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
import type { DataTableModel, FileBrowserModel, TaskListModel } from "@toolctrl/view-models";
|
||||
import type {
|
||||
AuditListModel,
|
||||
IntegrationCatalogModel,
|
||||
DataTableModel,
|
||||
FileBrowserModel,
|
||||
MembersListModel,
|
||||
NotificationCenterModel,
|
||||
RolesListModel,
|
||||
SelectTenantModel,
|
||||
SessionListModel,
|
||||
TaskListModel,
|
||||
} from "@hivegrid/view-models";
|
||||
|
||||
export const uiSubframeRegistry = [] as const;
|
||||
|
||||
@@ -68,6 +79,152 @@ export function renderTaskList(model: TaskListModel): string {
|
||||
return `<section data-ui-impl="subframe" data-ui-id="ui.tasks.list" data-row-count="${model.rowCount}"><h2 data-i18n-key="${escapeHtml(model.titleKey)}"></h2><ul>${body}</ul></section>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Real Subframe render implementation for the session device list (R-P2a,
|
||||
* Settings > Security). Semantic list with per-row data-attributes; the device
|
||||
* label is data, the bucketed last-seen + i18n fallback travel as attributes so
|
||||
* the host resolves copy at hydration time.
|
||||
*/
|
||||
export function renderSessionList(model: SessionListModel): string {
|
||||
const body =
|
||||
model.rowCount === 0
|
||||
? `<li data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></li>`
|
||||
: model.rows
|
||||
.map((row) => {
|
||||
const label = row.deviceLabel
|
||||
? `<span data-device>${escapeHtml(row.deviceLabel)}</span>`
|
||||
: `<span data-device data-i18n-key="${escapeHtml(row.deviceLabelFallbackKey ?? "")}"></span>`;
|
||||
const count = row.lastSeenCount === null ? "" : ` data-last-seen-count="${row.lastSeenCount}"`;
|
||||
return `<li data-row-id="${escapeHtml(row.id)}" data-current="${row.isCurrent}" data-trusted="${row.trusted}" data-can-revoke="${row.canRevoke}" data-last-seen-bucket="${escapeHtml(row.lastSeenBucket)}"${count}>${label}<time datetime="${escapeHtml(row.lastSeenIso)}"></time></li>`;
|
||||
})
|
||||
.join("");
|
||||
|
||||
return `<section data-ui-impl="subframe" data-ui-id="ui.settings.security.sessions" data-row-count="${model.rowCount}"><h2 data-i18n-key="${escapeHtml(model.titleKey)}"></h2><ul>${body}</ul></section>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Real Subframe render implementation for the tenant/workspace picker (R-P2a,
|
||||
* "Workspace-Auswahl"). Semantic list with per-row data-attributes; the tenant
|
||||
* name/initials are data, the role label travels as an i18n key + tone literal.
|
||||
*/
|
||||
export function renderSelectTenant(model: SelectTenantModel): string {
|
||||
const body =
|
||||
model.rowCount === 0
|
||||
? `<li data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></li>`
|
||||
: model.rows
|
||||
.map((row) => {
|
||||
const role = row.roleLabelKey
|
||||
? `<span data-role data-tone="${escapeHtml(row.roleTone ?? "")}" data-i18n-key="${escapeHtml(row.roleLabelKey)}"></span>`
|
||||
: "";
|
||||
return `<li data-row-id="${escapeHtml(row.id)}" data-slug="${escapeHtml(row.slug)}" data-current="${row.isCurrent}" data-avatar-color="${escapeHtml(row.avatarColor)}"><span data-initials>${escapeHtml(row.avatarInitials)}</span><span data-name>${escapeHtml(row.name)}</span>${role}</li>`;
|
||||
})
|
||||
.join("");
|
||||
|
||||
return `<section data-ui-impl="subframe" data-ui-id="ui.auth.selectTenant" data-row-count="${model.rowCount}"><h2 data-i18n-key="${escapeHtml(model.titleKey)}"></h2><ul>${body}</ul></section>`;
|
||||
}
|
||||
|
||||
function escapeHtml(value: string): string {
|
||||
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
||||
}
|
||||
|
||||
/**
|
||||
* Real Subframe render implementation for the Audit-Viewer list (AK-P3).
|
||||
* Semantic table rows with per-row data-attributes; the persisted summary is
|
||||
* data, derived summary keys and actor-kind markers travel as i18n keys so the
|
||||
* host resolves copy at hydration time (M015/M017 swap contract).
|
||||
*/
|
||||
export function renderAuditList(model: AuditListModel): string {
|
||||
const body =
|
||||
model.rowCount === 0
|
||||
? `<li data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></li>`
|
||||
: model.rows
|
||||
.map((row) => {
|
||||
const summary = row.summaryText
|
||||
? `<span data-summary>${escapeHtml(row.summaryText)}</span>`
|
||||
: `<span data-summary data-i18n-key="${escapeHtml(row.summaryKey)}"></span>`;
|
||||
return `<li data-row-id="${escapeHtml(row.id)}" data-actor-kind-key="${escapeHtml(row.actorKindLabelKey)}" data-outcome="${escapeHtml(row.outcome)}" data-diff-count="${row.diffCount}" data-has-detail="${row.hasDetail}"><time datetime="${escapeHtml(row.createdAtIso)}"></time><span data-actor>${escapeHtml(row.actorLabel)}</span><code data-action>${escapeHtml(row.action)}</code>${summary}</li>`;
|
||||
})
|
||||
.join("");
|
||||
|
||||
return `<section data-ui-impl="subframe" data-ui-id="ui.audit.list" data-row-count="${model.rowCount}" data-page="${model.page}" data-total-pages="${model.totalPages}" data-can-export="${model.canExport}"><h2 data-i18n-key="${escapeHtml(model.titleKey)}"></h2><ul>${body}</ul></section>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Real Subframe render implementation for the Notification-Center list (AK-P3).
|
||||
* Message/status/category travel as i18n keys, the validated deeplink as an
|
||||
* anchor; read-state + bounce keys ride as data-attributes (M015/M017).
|
||||
*/
|
||||
export function renderNotificationCenter(model: NotificationCenterModel): string {
|
||||
const body =
|
||||
model.totalCount === 0
|
||||
? `<li data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></li>`
|
||||
: model.items
|
||||
.map((item) => {
|
||||
const message = item.deeplinkHref
|
||||
? `<a href="${escapeHtml(item.deeplinkHref)}" data-message data-i18n-key="${escapeHtml(item.messageKey)}"></a>`
|
||||
: `<span data-message data-i18n-key="${escapeHtml(item.messageKey)}"></span>`;
|
||||
const bounce = item.bounceKey ? `<span data-bounce data-i18n-key="${escapeHtml(item.bounceKey)}"></span>` : "";
|
||||
return `<li data-row-id="${escapeHtml(item.id)}" data-read="${item.isRead}" data-status-key="${escapeHtml(item.statusKey)}" data-category-key="${escapeHtml(item.categoryKey)}">${message}${bounce}</li>`;
|
||||
})
|
||||
.join("");
|
||||
|
||||
return `<section data-ui-impl="subframe" data-ui-id="ui.notifications.center" data-row-count="${model.totalCount}" data-unread-count="${model.unreadCount}"><h2 data-i18n-key="${escapeHtml(model.titleKey)}"></h2><ul>${body}</ul></section>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Real Subframe render implementation for the members admin list (R-P2b,
|
||||
* D-P2 Admin RBAC S01). Semantic list with per-row data-attributes; name/email
|
||||
* are data, status labels + role names travel as keys/data so the host resolves
|
||||
* copy at hydration time (M015/M017 swap contract).
|
||||
*/
|
||||
export function renderMembersList(model: MembersListModel): string {
|
||||
const body =
|
||||
model.rowCount === 0
|
||||
? `<li data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></li>`
|
||||
: model.rows
|
||||
.map(
|
||||
(row) =>
|
||||
`<li data-row-id="${escapeHtml(row.tenantUserId)}" data-status-key="${escapeHtml(row.statusLabelKey)}" data-mfa="${row.mfaEnabled}" data-can-deactivate="${row.canDeactivate}" data-can-reactivate="${row.canReactivate}"><span data-name>${escapeHtml(row.name)}</span><span data-email>${escapeHtml(row.email)}</span><span data-roles>${escapeHtml(row.roleNames.join(", "))}</span></li>`
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `<section data-ui-impl="subframe" data-ui-id="ui.settings.members.table" data-row-count="${model.rowCount}" data-can-invite="${model.canInvite}"><h2 data-i18n-key="${escapeHtml(model.titleKey)}"></h2><ul>${body}</ul></section>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Real Subframe render implementation for the merged roles list (R-P2b,
|
||||
* D-P2 Admin RBAC S02). Role names are data, type labels travel as i18n keys;
|
||||
* mutation capabilities + the D03 in-use delete blocker ride as attributes.
|
||||
*/
|
||||
export function renderRolesList(model: RolesListModel): string {
|
||||
const body =
|
||||
model.rowCount === 0
|
||||
? `<li data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></li>`
|
||||
: model.rows
|
||||
.map(
|
||||
(row) =>
|
||||
`<li data-row-id="${escapeHtml(row.id)}" data-type-key="${escapeHtml(row.typeLabelKey)}" data-member-count="${row.memberCount}" data-permission-count="${row.permissionCount}" data-can-edit="${row.canEdit}" data-can-delete="${row.canDelete}" data-delete-blocked="${row.deleteBlockedInUse}"><span data-name>${escapeHtml(row.name)}</span></li>`
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `<section data-ui-impl="subframe" data-ui-id="ui.settings.rolesAndPermissions.roles" data-row-count="${model.rowCount}" data-can-create="${model.canCreate}"><h2 data-i18n-key="${escapeHtml(model.titleKey)}"></h2><ul>${body}</ul></section>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Real Subframe render implementation for the integrations catalog (R-P5,
|
||||
* D-P5 A6). App titles/categories travel as i18n keys; the per-app connection
|
||||
* count (status light) and detail href ride as data-attributes (M015/M017).
|
||||
*/
|
||||
export function renderIntegrationsCatalog(model: IntegrationCatalogModel): string {
|
||||
const body =
|
||||
model.rowCount === 0
|
||||
? `<li data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></li>`
|
||||
: model.rows
|
||||
.map(
|
||||
(row) =>
|
||||
`<li data-row-id="${escapeHtml(row.key)}" data-title-key="${escapeHtml(row.titleKey)}" data-category-key="${escapeHtml(row.categoryKey)}" data-connection-type="${escapeHtml(row.connectionType)}" data-connection-count="${row.connectionCount}"><a href="${escapeHtml(row.detailHref)}" data-i18n-key="${escapeHtml(row.titleKey)}"></a></li>`
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `<section data-ui-impl="subframe" data-ui-id="ui.integrations.catalog" data-row-count="${model.rowCount}" data-connected-count="${model.connectedCount}" data-can-connect="${model.canConnect}"><h2 data-i18n-key="${escapeHtml(model.titleKey)}"></h2><ul>${body}</ul></section>`;
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import type { DataTableModel } from "@toolctrl/view-models";
|
||||
import type { DataTableModel } from "@hivegrid/view-models";
|
||||
|
||||
import { renderDataTable } from "./index.js";
|
||||
|
||||
|
||||
Reference in new issue
Block a user