12 Native v2 BlockModels
The @latticedx/plugin-dxos-blocks plugin implements 12 declarative Dxos*BlockModel classes built on NocoBase 2.2.50 FlowEngine v2 (@nocobase/client-v2). All 12 models are registered on the client via registerDxosBlockModels(client, React, antd, clientV2, flowEngine, app) (src/client/block-models.js) and allowlisted on the server in ALLOWED_DXOS_BLOCK_USES (portal-composer.js) and ALLOWED_FLOW_MODEL_USES (solution-bundle.js).
Every block queries tenant-scoped data (organizationId), inheriting application ACL rules and PostgreSQL 16 FORCE ROW LEVEL SECURITY enforcement.
Shared Architecture: dxosBlockSettings, Grid Placement, and 8 Foundation Blocks
All 12 Dxos*BlockModel classes extend BaseBlockModel (clientV2?.BlockModel || flowEngine?.getModelClass?.('BlockModel')) and share three core runtime mechanisms:
| Mechanism | Symbol / Hook | Runtime Behavior |
|---|---|---|
| Settings flow | dxosBlockSettings (on: 'beforeRender') | Opens a scrollable config dialog (uiMode: { type: 'dialog' }, top: 24px, maxHeight: '78vh'). Saving invokes ctx.model.setProps(params) and notifyModelListeners(ctx.model). |
| Config precedence | readModelConfig(model, defaults, liveConfig) | Merges `{ ...defaults, ...(model?.props |
| Grid placement | FlowEngine Grid (PortalPageModel / RootPageModel) | Supports side-by-side multi-column gridSettings via placeBesideOrInsertBlock. |
| Dynamic metadata | dxosBlocks:collectionsMeta | Fetches user-accessible business and latticeCustom* collections while filtering 70+ internal tables (META_EXCLUDED_COLLECTIONS) and sensitive columns (password, secret, token, apiKey, privateKey, hash, salt, embedding, searchVector). |
Distinction from the 8 Foundation Context BlockModels
Separate from the 12 DX-OS Native v2 Dxos*BlockModel classes, @latticedx/plugin-lattice-foundation (src/client/index.js) registers 8 foundation context BlockModels bound via the latticeBinding flow (latticeApps:list): LatticeFormBlockModel, LatticeListBlockModel, LatticeTaskInboxBlockModel, LatticeApprovalBlockModel, LatticeAttachmentBlockModel, LatticeActivityTimelineBlockModel, LatticeContextEntityBlockModel, and LatticeWorkflowFormBlockModel.
Catalog of All 12 Dxos*BlockModel Classes
| # | Class Name | UI Label | Primary Data Bindings / API Calls |
|---|---|---|---|
| 1 | DxosPortalHeroBlockModel | DX-OS Portal Hero & Quick Actions | Client navigation via filterHeroActions & isSafeAppPath |
| 2 | DxosKpiMetricBlockModel | DX-OS KPI Metric Grid | GET ${m.collection}:list (pageSize: 1, reads meta.count) |
| 3 | DxosContextTelemetryBlockModel | DX-OS NGSI-LD Context & Telemetry | POST dxosBlocks:contextTelemetry |
| 4 | DxosAiProposalBlockModel | DX-OS AI Proposal & Evidence | POST dxosBlocks:proposals, POST dxosBlocks:decideProposal |
| 5 | DxosWorkflowTasksBlockModel | DX-OS Workflow & My Tasks | GET workflowManualTasks:list, POST workflowManualTasks:submit |
| 6 | DxosParaVaultBlockModel | DX-OS P.A.R.A. Knowledge Vault | latticeParaDocuments:list, latticeParaDocuments:create |
| 7 | DxosCreativeStudioBlockModel | DX-OS Creative Studio Micro-App | Declarative query runner (collection, telemetry, tasks, timeseries) |
| 8 | DxosRecordWorkbenchBlockModel | DX-OS Chatter, Chứng từ & Xuất báo cáo | latticeChatter:list/post, dxosBlocks:exportReport, dxosWms:printVoucher |
| 9 | DxosWebGisBlockModel | DX-OS Bản đồ Giám sát WebGIS [D] | dxosBlocks:twinShadow, dxosBlocks:twinSetDesired |
| 10 | DxosKanbanScheduleBlockModel | DX-OS Bảng Kanban & Lịch [H] | ${collection}:list / :update |
| 11 | DxosWmsOpsBlockModel | DX-OS Vận hành Kho FEFO & Bulk Import [W] | dxosWms:*, dxosBlocks:bulkImportDryRun, dxosBlocks:bulkImportCommit |
| 12 | DxosBiChartBlockModel | DX-OS Biểu đồ & Phân tích BI [D] | POST dxosBlocks:aggregateQuery |
BlockModel Reference
1. DxosPortalHeroBlockModel
Renders the portal header banner with a context badge, hex accent color, and role-filtered quick-action buttons. filterHeroActions(actionsJson, perms) strips any action failing isSafeAppPath (blocking javascript:, external origins, or studio paths for operational roles).
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Không gian Điều hành Doanh nghiệp DX-OS | Primary hero heading. |
subtitle | string | Nền mở NocoBase 2.2.50 cho H–P–D–I | Secondary description displayed beneath the title. |
badge | string | DX-OS | Short context pill rendered next to the heading. |
accentColor | string | #1677ff | Hex accent color applied to the banner trim and primary CTA. |
actionsJson | string (JSON) | DEFAULT_HERO_ACTIONS | JSON array of [{ label, path, primary? }] button definitions. |
2. DxosKpiMetricBlockModel
Renders a responsive 1–4 column KPI grid (columns clamped to 1..4). Each card defined in metricsJson executes GET ${m.collection}:list (pageSize: 1) to display meta.count and navigates to targetPath on click.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Chỉ số vận hành | Section heading for the KPI grid. |
columns | number | 4 | Grid column count, clamped to 1..4. |
metricsJson | string (JSON) | DEFAULT_KPI_METRICS | JSON array of [{ label, collection, filter?, color, targetPath }] metric cards. |
3. DxosContextTelemetryBlockModel
Queries POST dxosBlocks:contextTelemetry to display FIWARE Orion-LD NGSI-LD entity context, live sensor readings, and latticeContextOutbox delivery status. Numeric attributes exceeding warningThreshold are highlighted.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Ngữ cảnh NGSI-LD & Cảm biến | Block header title. |
assetEntityId | string | '' | Asset code or NGSI-LD URN; leaves auto-selection active when empty. |
warningThreshold | string | 80 | Numeric threshold used to flag elevated readings. |
showSyncStatus | boolean | true | Displays pending and synced outbox counts. |
4. DxosAiProposalBlockModel
Displays AI-generated operational proposals via POST dxosBlocks:proposals and submits human decisions (approve, review, reject) through POST dxosBlocks:decideProposal. Self-approval is blocked (SELF_APPROVAL_FORBIDDEN).
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Đề xuất AI & Bằng chứng | Block header title. |
targetCollection | enum | latticeIncidentCases | Allowlisted collection: latticeIncidentCases, latticeAssets, latticeRequests, latticeOrders, or latticeServiceTickets. |
state | all | proposed | reviewed | all | Proposal lifecycle filter. |
pageSize | number | 5 | Maximum rows per page. |
showEvidence | boolean | true | Renders supporting evidence snippets on each proposal card. |
5. DxosWorkflowTasksBlockModel
Lists manual human tasks assigned to the authenticated user via GET workflowManualTasks:list and submits completions through POST workflowManualTasks:submit.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Hộp việc Quy trình Poka-yoke | Task inbox title. |
statusFilter | pending | resolved | all | pending | Task status filter. |
pageSize | number | 6 | Maximum tasks displayed per page. |
6. DxosParaVaultBlockModel
Browses and creates P.A.R.A. knowledge records (latticeParaDocuments:list and :create). Reads ?paraDocId= from the browser query string to deep-link directly to a specific document.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Kho tri thức P.A.R.A. | Vault block heading. |
paraSpace | all | projects | areas | resources | archives | all | Default P.A.R.A. space filter. |
pageSize | number | 6 | Documents per page (1..25). |
enableQuickCreate | boolean | true | Enables inline Markdown document creation. |
defaultOrganizationId | string | '' | Default organization ID override for root administrators. |
7. DxosCreativeStudioBlockModel
Renders a declarative micro-app cockpit from blueprintJson (defaulting to DEFAULT_CREATIVE_BLUEPRINT) with zero eval() or new Function(). The parseCreativeBlueprint parser (creative-studio-block.js) caps blueprints at 6 queries, 12 widgets, and 1..4 grid columns.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Buồng Điều hành Thông minh | Outer block title. |
blueprintJson | string (JSON) | DEFAULT_CREATIVE_BLUEPRINT | Declarative DSL JSON containing title, subtitle, theme, columns, queries, and widgets. |
CreativeStudio Capabilities: 4 Query Kinds, 11 Widget Types, and 5 Themes
| DSL Group | Constant | Supported Values |
|---|---|---|
Query kinds (4) | VALID_QUERY_KINDS | collection (max limit: 50), telemetry, tasks, timeseries (max limit: 200). |
Widget types (11) | VALID_WIDGET_TYPES | gauge, thermometer, timeseries-line, stage-pipeline, distribution-bars, rule-callout, status-matrix, quick-actions (up to 6 navigate / createRecord / askAi buttons), export-bar, chatter, voucher-actions. |
Built-in themes (5) | CREATIVE_THEMES | industrial-cockpit, emerald-ops, amber-alert, royal-indigo, clean-light. |
{
"title": "Cold Room A Cockpit",
"subtitle": "Live stock lot distribution and temperature telemetry.",
"theme": "emerald-ops",
"columns": 2,
"queries": [
{ "id": "lots", "kind": "collection", "collection": "latticeStockLots", "limit": 30 },
{ "id": "tempSeries", "kind": "timeseries", "assetEntityId": "urn:ngsi-ld:Asset:org1:native:1", "attribute": "temperature", "limit": 100 }
],
"widgets": [
{ "type": "gauge", "title": "Active Stock Lots", "queryId": "lots", "metric": "count", "max": 50, "unit": "lots" },
{ "type": "thermometer", "title": "Latest Probe Temp", "queryId": "tempSeries", "metric": "latest", "field": "value", "unit": "C" },
{ "type": "distribution-bars", "title": "Lot Status Mix", "queryId": "lots", "field": "status" },
{ "type": "quick-actions", "title": "Operations", "buttons": [{ "label": "Open FEFO Console", "kind": "navigate", "targetPath": "/p/logistics", "primary": true }] }
]
}8. DxosRecordWorkbenchBlockModel
Combines voucher lifecycle controls, latticeChatter:list/post comments, Ed25519 PKI verification badges, latticeDataLineage inspection, QR voucher printing (dxosWms:printVoucher), and governed CSV/XLSX/PDF export (dxosBlocks:exportReport). WORKBENCH_COLLECTION_ENUM includes latticeRequests, latticeOrders, latticeServiceTickets, latticeAssets, latticeIncidentCases, latticeParaDocuments, and dynamic latticeCustom* collections.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Trao đổi Chatter, Chứng từ & Xuất báo cáo | Workbench panel heading. |
collection | string | latticeRequests | Target business or latticeCustom* collection. |
recordId | string | '' | Optional pinned record ID. |
showExport | boolean | true | Displays governed CSV/XLSX/PDF export controls. |
showVoucherActions | boolean | true | Displays voucher submit, approve, reject, and cancel actions. |
showChatter | boolean | true | Displays record-scoped collaboration chatter. |
showPkiBadge | boolean | true | Displays Ed25519 PKI ledger verification badge. |
showLineage | boolean | true | Displays upstream/downstream data lineage drawer. |
showPrintVoucher | boolean | true | Displays QR-verified voucher print button. |
9. DxosWebGisBlockModel
Renders an interactive geographic map powered by maplibre-gl with a Vietnam SVG fallback (lat 8.0..23.8, lng 102.0..110.2, default hubs HUB-CT, HUB-HCM, HUB-DN, HUB-HN). When showTwinOverlay is enabled, it queries dxosBlocks:twinShadow and dispatches setpoints via dxosBlocks:twinSetDesired. Temperature changes exceeding HITL_DELTA_THRESHOLD_C = 2.0 °C pause in pending_hitl until approved.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Bản đồ Giám sát Chuỗi lạnh WebGIS | Map header title. |
defaultOrganizationId | string | '' | Optional organization ID for admin scoping. |
centerLat | number | 15.8 | Initial map center latitude. |
centerLng | number | 106.5 | Initial map center longitude. |
showTwinOverlay | boolean | true | Enables Digital Twin shadow overlay and setpoint controls. |
collection | string | '' | Optional custom collection providing map coordinates. |
latField | string | '' | Optional latitude field name. |
lngField | string | '' | Optional longitude field name. |
labelField | string | '' | Optional marker label field name. |
statusField | string | '' | Optional status field name for marker coloring. |
10. DxosKanbanScheduleBlockModel
Switches between a stage-grouped Kanban board (kanban) and a weekly calendar view (schedule). Voucher collections follow KANBAN_STAGE_ORDER (draft, submitted, approved, in_progress, completed, cancelled), while latticeStockLots follows STOCK_LOT_STAGE_ORDER (available, reserved, hold_mkt, expired). KANBAN_COLLECTION_ENUM covers latticeOrders, latticeRequests, latticeServiceTickets, latticeStockLots, and latticeCustom*.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Bảng Kanban & Lịch vận hành | Board heading. |
collection | string | latticeOrders | Source collection for cards and schedule entries. |
viewMode | kanban | schedule | kanban | Default layout mode. |
pageSize | number | 40 | Maximum records fetched per view. |
statusField | string | '' | Optional Kanban stage field override. |
dateField | string | '' | Optional date field used in schedule mode. |
titleField | string | '' | Optional card title field override. |
11. DxosWmsOpsBlockModel
Provides a two-tab cold-chain warehouse console: FEFO lot allocation, stock issue, MKT hold, and QA release (dxosWms:*), plus a two-phase bulk import wizard (dxosBlocks:bulkImportDryRun and dxosBlocks:bulkImportCommit). Input CSV/JSON payloads are capped at MAX_BULK_IMPORT_BYTES = 2MB across the four IMPORT_COLLECTIONS: latticeStockLots, latticeAssets, latticeOrders, and latticeRequests.
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Vận hành Kho FEFO & Nhập lô hàng loạt | WMS console title. |
defaultOrganizationId | string | '' | Default organization ID override for admin callers. |
defaultTab | fefo | import | fefo | Initial active tab. |
defaultImportCollection | enum | latticeStockLots | Target collection: latticeStockLots, latticeAssets, latticeOrders, or latticeRequests. |
showBulkImport | boolean | true | Toggles visibility of the 2-phase bulk import tab. |
12. DxosBiChartBlockModel
Executes server-side aggregations via POST dxosBlocks:aggregateQuery with x-reactions dynamic field pickers across BI_COLLECTION_ENUM (12 core collections) and latticeCustom* tables.
To prevent unsafe query operator injection in filterJson, sanitizeClientFilterNode (bi-chart-block.js) enforces a maximum nesting depth of 10, blocks prototype keys (__proto__, constructor, prototype), rejects dotted field paths, and rejects all 6 keys in DANGEROUS_FILTER_KEYS:
$where, $raw, $sql, $eval, $function, $expr| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Phân tích & Biểu đồ BI | Chart heading. |
collection | string | latticeOrders | Source collection for aggregation. |
chartType | bar | line | pie | kpi | pivot | bar | Chart visualization type. |
groupBy | string | status | Primary grouping field. |
secondaryGroupBy | string | '' | Secondary column grouping field for pivot mode. |
metricOp | count | sum | avg | min | max | count | Aggregation function. |
metricField | string | '' | Numeric field used by sum, avg, min, and max. |
limit | number | 20 | Maximum groups returned (1..500). |
filterJson | string (JSON) | '' | Optional filter object; rejects any key in DANGEROUS_FILTER_KEYS. |
dxosBlocks Server Resource and dxosTelemetryDirectGuard
All block server operations route through 17 actions on dxosBlocks (blocks-api.js): 15 loggedIn actions (proposals, decideProposal, contextTelemetry, telemetrySeries, alarmIngest, alarmAck, alarmClear, exportReport, globalSearch, twinShadow, twinSetDesired, bulkImportDryRun, bulkImportCommit, collectionsMeta, aggregateQuery) and 2 public fail-closed edge actions (telemetryIngest, twinAckCommand, requiring either X-Lattice-Edge-Token of at least 16 characters matched in constant time against DX_IIOT_INGEST_TOKEN or a valid ACL-authorized user JWT).
The dxosTelemetryDirectGuard middleware blocks direct non-root CRUD or charts:queryData requests against latticeTelemetryPoints, latticeTwinShadows, latticeIotDevices, and latticeBrokerSubscriptions (403), forcing callers through dxosBlocks and dxosBroker.
