Skip to Content
DashboardsReferenceDocument schema

Document schema

A dashboard document is JSON, version 2. The machine-readable definition is the JSON Schema at /dashboard-config.schema.json on the server, also shipped as @microboxlabs/miot-dashboard-contract/dashboard-config.schema.json.

Fields not listed here are kept as they are on every save.

Document

FieldTypeRequiredMeaning
version2YesDocument version. Any other value is refused.
namestringYesTitle
widgetsWidget[]YesRoot widgets
preferencesobjectYes{ "editMode": boolean }. editMode is not saved by the UI.
queriesSaved query[]NoAt most 50
filtersFilter[]NoThe filter bar
refreshInterval0, 10, 30, 60, 300NoSeconds between refreshes. 0 is off.
ordernumberNoNavigation position. Lower first; unset last.
allowedGroupsstring[]NoOnly members of these groups may see it. Empty or absent: no restriction.
requestPlannerobject[]NoLegacy request planner. Convert it with Migrate planner dashboards.

Widget

FieldTypeRequiredMeaning
idstringYesUnique in the document
componentIdstringYesWidget type. See Widget catalog.
layoutLayoutYesPosition and size
configobjectYesThe widget type’s settings
childrenWidget[]NoWidgets inside a container
createdAtstringYesISO 8601 date and time
updatedAtstringYesISO 8601 date and time

Common config fields

FieldMeaning
dataModestatic (default) or planner
staticDataJSON text with one row of sample or fixed data, for static
plannerVariableNameThe saved query result to read, for planner
dataProvider[{ "key": "...", "value": "..." }] values available as {{data_provider.key}}

Each widget type adds its own fields. See Widget catalog.

Layout

FieldTypeMeaning
istringSame as the widget id
xintegerColumn, 0 to 23
yintegerRow, from 0
wintegerWidth in columns, 1 to 24. x + w is at most 24.
hintegerHeight in rows, at least 1
minW, minH, maxW, maxHintegerOptional size limits

Saved query

FieldTypeRequiredMeaning
idstringYesUnique. Used in .../queries/{id}.
variableNamestringYesUnique result name widgets read
connectionIdstringYesHost connection
operationIdstringYesApproved operation
parametersobjectYesParameter name to binding. At most 100.
schemastring[]NoKnown result columns

Identifiers have at most 128 characters.

Parameter binding

{ "kind": "literal", "value": 30 } { "kind": "filter", "key": "vehicle", "defaultValue": null, "omitWhenEmpty": true }
FieldApplies toMeaning
kindbothliteral or filter
valueliteralThe value
keyfilterThe filter value to use. A date range filter k provides k_from and k_to.
defaultValuefilterUsed when the filter is missing. Not used for an explicit empty string.
omitWhenEmptyfilterLeave the parameter out when the value is missing or empty

Values are text (at most 2,048 characters), finite numbers, booleans, null, or lists of at most 100 of those.

Filters

FieldTypeRequiredMeaning
keystringYesUnique name queries and templates use
labelstringYesWhat viewers read
typetext, date_range, selectYesThe control
options[{label, value}]NoStatic options, for select
optionsSourceobjectNoOptions from a saved query result, for select
singlebooleanNoAllow one selection only
uniquebooleanNoSetting a value clears this filter’s other values

optionsSource:

FieldRequiredMeaning
variableNameYesSaved query result name
valueFieldYesColumn for the value
labelFieldNoColumn for the label. Defaults to valueField.

Minimal valid document

{ "version": 2, "name": "Empty", "widgets": [], "preferences": { "editMode": false } }

Validate a document in code

import { validateDashboardConfig } from "@microboxlabs/miot-dashboard-contract/schema"; const result = validateDashboardConfig(json); if (!result.valid) console.error(result.problems); // ["widgets.0.layout.x: ..."]
Last updated on