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
@@ -1,4 +1,17 @@
|
||||
import type { DataTableModel, FileBrowserModel, ShellRegistries, TaskListModel, VMState } from "@toolctrl/view-models";
|
||||
import type {
|
||||
AuditListModel,
|
||||
IntegrationCatalogModel,
|
||||
DataTableModel,
|
||||
FileBrowserModel,
|
||||
MembersListModel,
|
||||
NotificationCenterModel,
|
||||
RolesListModel,
|
||||
SelectTenantModel,
|
||||
SessionListModel,
|
||||
ShellRegistries,
|
||||
TaskListModel,
|
||||
VMState,
|
||||
} from "@hivegrid/view-models";
|
||||
|
||||
export type MockPage<T = unknown> = {
|
||||
readonly id: string;
|
||||
@@ -109,7 +122,7 @@ export function generateMockPageHtml<T>(page: MockPage<T>): string {
|
||||
`<body data-ui-mock-route="${escapeAttribute(page.route)}" data-ui-mock-status="${escapeAttribute(page.state.status)}">`,
|
||||
` <div class="mock-shell" data-ui-mock-page="${escapeAttribute(page.id)}">`,
|
||||
` <nav class="mock-nav" aria-label="${escapeAttribute(translateMockText("mock.ui.sidebarAria", "Mock sidebar"))}">`,
|
||||
` <div class="mock-brand">${escapeHtml(translateMockText("mock.ui.brand", "Toolctrl mock"))}</div>`,
|
||||
` <div class="mock-brand">${escapeHtml(translateMockText("mock.ui.brand", "HiveGrid mock"))}</div>`,
|
||||
...sidebarItems.map(
|
||||
(item) =>
|
||||
` <a class="mock-link" data-active="${item.href === page.route ? "true" : "false"}" href="${escapeAttribute(item.href)}">${escapeHtml(translateMockText(item.labelKey, item.labelKey))}</a>`
|
||||
@@ -176,7 +189,7 @@ const defaultMockTranslations: Record<string, string> = {
|
||||
"mock.phase-c.hot-swap.activity.registrySwap": "Registry swap",
|
||||
"mock.ui.documentTitle": "UI Mock",
|
||||
"mock.ui.sidebarAria": "Mock sidebar",
|
||||
"mock.ui.brand": "Toolctrl mock",
|
||||
"mock.ui.brand": "HiveGrid mock",
|
||||
"mock.ui.metricsAria": "Mock metrics",
|
||||
"mock.ui.activityAria": "Mock activity",
|
||||
"mock.ui.stateAria": "Mock state payload",
|
||||
@@ -327,6 +340,44 @@ export function renderTaskListMock(model: TaskListModel): string {
|
||||
return `<div data-ui-impl="mock" data-ui-id="ui.tasks.list" data-row-count="${model.rowCount}"><div data-row="head" data-i18n-key="${escapeHtml(model.titleKey)}"></div>${rows}</div>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock render implementation for the session device list. Same normalized
|
||||
* {@link SessionListModel} data as the real Subframe impl, deliberately different
|
||||
* minimal chrome — proves the renderer is swappable (hot-swap drill, M017).
|
||||
*/
|
||||
export function renderSessionListMock(model: SessionListModel): string {
|
||||
const rows =
|
||||
model.rowCount === 0
|
||||
? `<div data-row="empty" data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></div>`
|
||||
: model.rows
|
||||
.map((row) => {
|
||||
const label = row.deviceLabel ? escapeHtml(row.deviceLabel) : "";
|
||||
return `<div data-row="body" data-row-id="${escapeHtml(row.id)}" data-current="${row.isCurrent}" data-trusted="${row.trusted}" data-last-seen-bucket="${escapeHtml(row.lastSeenBucket)}">${label}</div>`;
|
||||
})
|
||||
.join("");
|
||||
|
||||
return `<div data-ui-impl="mock" data-ui-id="ui.settings.security.sessions" data-row-count="${model.rowCount}"><div data-row="head" data-i18n-key="${escapeHtml(model.titleKey)}"></div>${rows}</div>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock render implementation for the tenant/workspace picker. Same normalized
|
||||
* {@link SelectTenantModel} data as the real Subframe impl, deliberately different
|
||||
* minimal chrome — proves the renderer is swappable (hot-swap drill, M017).
|
||||
*/
|
||||
export function renderSelectTenantMock(model: SelectTenantModel): string {
|
||||
const rows =
|
||||
model.rowCount === 0
|
||||
? `<div data-row="empty" data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></div>`
|
||||
: model.rows
|
||||
.map(
|
||||
(row) =>
|
||||
`<div data-row="body" data-row-id="${escapeHtml(row.id)}" data-slug="${escapeHtml(row.slug)}" data-current="${row.isCurrent}">${escapeHtml(row.name)}</div>`
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `<div data-ui-impl="mock" data-ui-id="ui.auth.selectTenant" data-row-count="${model.rowCount}"><div data-row="head" data-i18n-key="${escapeHtml(model.titleKey)}"></div>${rows}</div>`;
|
||||
}
|
||||
|
||||
function isHotSwapDrillData(value: unknown): value is HotSwapDrillData {
|
||||
if (!value || typeof value !== "object") return false;
|
||||
const candidate = value as Partial<HotSwapDrillData>;
|
||||
@@ -381,3 +432,98 @@ function escapeHtml(value: string): string {
|
||||
function escapeAttribute(value: string): string {
|
||||
return escapeHtml(value).replaceAll("'", "'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock render implementation for the Audit-Viewer list (AK-P3). Same
|
||||
* normalized {@link AuditListModel} data as the real Subframe impl,
|
||||
* deliberately different minimal chrome (M017 hot-swap drill proof).
|
||||
*/
|
||||
export function renderAuditListMock(model: AuditListModel): string {
|
||||
const rows =
|
||||
model.rowCount === 0
|
||||
? `<div data-row="empty" data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></div>`
|
||||
: model.rows
|
||||
.map((row) => {
|
||||
const summary = row.summaryText ? escapeHtml(row.summaryText) : "";
|
||||
return `<div data-row="body" 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}">${escapeHtml(row.actorLabel)} ${escapeHtml(row.action)} ${summary}</div>`;
|
||||
})
|
||||
.join("");
|
||||
|
||||
return `<div data-ui-impl="mock" data-ui-id="ui.audit.list" data-row-count="${model.rowCount}" data-page="${model.page}" data-can-export="${model.canExport}"><div data-row="head" data-i18n-key="${escapeHtml(model.titleKey)}"></div>${rows}</div>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock render implementation for the Notification-Center list (AK-P3). Same
|
||||
* normalized {@link NotificationCenterModel} data, minimal div chrome; labels
|
||||
* stay i18n keys (no hardcoded copy in the mock).
|
||||
*/
|
||||
export function renderNotificationCenterMock(model: NotificationCenterModel): string {
|
||||
const rows =
|
||||
model.totalCount === 0
|
||||
? `<div data-row="empty" data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></div>`
|
||||
: model.items
|
||||
.map(
|
||||
(item) =>
|
||||
`<div data-row="body" data-row-id="${escapeHtml(item.id)}" data-read="${item.isRead}" data-status-key="${escapeHtml(item.statusKey)}" data-category-key="${escapeHtml(item.categoryKey)}" data-i18n-key="${escapeHtml(item.messageKey)}"${item.deeplinkHref ? ` data-deeplink="${escapeHtml(item.deeplinkHref)}"` : ""}${item.bounceKey ? ` data-bounce-key="${escapeHtml(item.bounceKey)}"` : ""}></div>`
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `<div data-ui-impl="mock" data-ui-id="ui.notifications.center" data-row-count="${model.totalCount}" data-unread-count="${model.unreadCount}"><div data-row="head" data-i18n-key="${escapeHtml(model.titleKey)}"></div>${rows}</div>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock render implementation for the members admin list (R-P2b). Same
|
||||
* normalized {@link MembersListModel} data as the real Subframe impl,
|
||||
* deliberately different minimal chrome (M017 hot-swap drill proof).
|
||||
*/
|
||||
export function renderMembersListMock(model: MembersListModel): string {
|
||||
const rows =
|
||||
model.rowCount === 0
|
||||
? `<div data-row="empty" data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></div>`
|
||||
: model.rows
|
||||
.map(
|
||||
(row) =>
|
||||
`<div data-row="body" 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}">${escapeHtml(row.name)} ${escapeHtml(row.email)} ${escapeHtml(row.roleNames.join(", "))}</div>`
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `<div data-ui-impl="mock" data-ui-id="ui.settings.members.table" data-row-count="${model.rowCount}" data-can-invite="${model.canInvite}"><div data-row="head" data-i18n-key="${escapeHtml(model.titleKey)}"></div>${rows}</div>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock render implementation for the merged roles list (R-P2b). Same
|
||||
* normalized {@link RolesListModel} data, minimal div chrome; type labels stay
|
||||
* i18n keys, capabilities + the D03 delete blocker ride as data-attributes.
|
||||
*/
|
||||
export function renderRolesListMock(model: RolesListModel): string {
|
||||
const rows =
|
||||
model.rowCount === 0
|
||||
? `<div data-row="empty" data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></div>`
|
||||
: model.rows
|
||||
.map(
|
||||
(row) =>
|
||||
`<div data-row="body" 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}">${escapeHtml(row.name)}</div>`
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `<div data-ui-impl="mock" data-ui-id="ui.settings.rolesAndPermissions.roles" data-row-count="${model.rowCount}" data-can-create="${model.canCreate}"><div data-row="head" data-i18n-key="${escapeHtml(model.titleKey)}"></div>${rows}</div>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock render implementation for the integrations catalog (R-P5). Same
|
||||
* normalized {@link IntegrationCatalogModel} data, minimal div chrome; titles
|
||||
* and categories stay i18n keys, connection counts ride as data-attributes.
|
||||
*/
|
||||
export function renderIntegrationsCatalogMock(model: IntegrationCatalogModel): string {
|
||||
const rows =
|
||||
model.rowCount === 0
|
||||
? `<div data-row="empty" data-empty="true" data-i18n-key="${escapeHtml(model.emptyHeadlineKey)}"></div>`
|
||||
: model.rows
|
||||
.map(
|
||||
(row) =>
|
||||
`<div data-row="body" 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}" data-detail-href="${escapeHtml(row.detailHref)}"></div>`
|
||||
)
|
||||
.join("");
|
||||
|
||||
return `<div data-ui-impl="mock" data-ui-id="ui.integrations.catalog" data-row-count="${model.rowCount}" data-connected-count="${model.connectedCount}" data-can-connect="${model.canConnect}"><div data-row="head" data-i18n-key="${escapeHtml(model.titleKey)}"></div>${rows}</div>`;
|
||||
}
|
||||
Reference in new issue
Block a user