A component is a zip. It holds a manifest, the ClearBlade resources to import onto the system, and the built microfrontend bundles. An administrator installs it from the Components page.
Lay out the component folder
Put component.json at the root. Everything else is optional.
component.json the manifest, read at registration
readme.md shown on the Components page
code/ services and libraries
data/ collections
roles/ platform roles
webhooks/ webhooks
adapters/ edge adapters
users/ service users
deployments/ what to push to an edge
mfe/dist/ the built microfrontend bundles
The folders above are the ones the install pipeline imports. A folder with any other name is ignored.
Write the manifest
{
"manifestVersion": "1.0",
"id": "modbus",
"name": "Modbus",
"owner": "ClearBlade",
"description_short": "Map Modbus registers to asset attributes",
"readme": "readme.md",
"componentVersion": "0.4.28",
"tags": ["device", "modbus", "industrial"],
"mfes": [],
"secrets": [],
"customRoles": []
}
|
Field |
Required |
Notes |
|---|---|---|
|
|
Yes |
Letters, digits, underscore and hyphen. It is a path segment in the file store and a prefix for every service the component ships, so it must be unique across the catalog. |
|
|
Yes |
The name shown in the catalog. |
|
|
Yes |
Who maintains it. |
|
|
Yes |
One line, shown under the name. |
|
|
Yes |
Path in the zip to the readme. |
|
|
Yes |
Semantic version. See Release a new version. |
|
|
No |
Longer description. |
|
|
No |
|
|
|
No |
Free text. The catalog filter matches loosely. |
|
|
No |
Components this one expects. Advice only: install never checks it. |
|
|
No |
Set to |
Choose a microfrontend slot
A microfrontend is a small React app that IA mounts inside its own screens. A component ships one when it needs a face in the product: a form to fill in, a tab on an asset, a page of its own, a widget that draws an attribute.
Each entry in mfes names a slot in ui_injection_id and a bundle_path pointing into the zip.
|
Slot |
Identified by |
Where it mounts |
|---|---|---|
|
|
|
A page of its own, with an entry in the left menu. |
|
|
|
A dashboard that install creates. The bundle draws its contents. |
|
|
|
A tab on the asset types the installer picks. |
|
|
|
A panel under Settings, System. It appears while the component is installed and enabled. |
|
|
|
A read-only widget an attribute can select, alongside the built-in widgets. |
|
|
|
An edit widget an attribute can select. |
|
|
|
The whole Configuration tab for one device type. |
|
|
|
The same form where there is no single asset: template editing and batch apply. |
A page is keyed by path, not id. The page mounts at /<componentId>/<path>, and path accepts lowercase letters, digits and hyphens only.
A page also takes label, icon and section (general or admin) as defaults for its menu entry. The installer can override each.
A device-type component declares both device-config slots for the same device_type:
"mfes": [
{
"ui_injection_id": "deviceConfigDetail",
"id": "modbus-detail",
"device_type": "modbus",
"label": "Modbus",
"bundle_path": "mfe/dist/modbus-detail.js",
"hooks": {
"fetchConfig": "modbus_fetchConfig",
"afterSave": "modbus_afterSave",
"onDelete": "modbus_onDelete"
}
},
{
"ui_injection_id": "deviceConfigEditor",
"id": "modbus-editor",
"device_type": "modbus",
"assetTypeScoped": true,
"bundle_path": "mfe/dist/modbus-editor.js"
}
]
device_type matches an asset type's Device Type. That is what decides where the tab renders.
Build the bundles
Build each microfrontend as a SystemJS module with webpack libraryTarget: "system". A bundle in any other format loads and never executes.
A component bundles its own libraries. Never add one to the host import map. See Developing microfrontends for the libraries the host already shares.
Add device type hooks
A saved configuration is only data until something acts on it. Hooks are where a component reads the real settings off a device, checks them before a save, or pushes them out to an edge afterwards.
A deviceConfigDetail slot may name code services under hooks. A device type with none behaves as a plain stored configuration.
|
Hook |
Runs |
|---|---|
|
|
To list what can be configured under one asset. |
|
|
To read the configuration from somewhere other than IA storage. |
|
|
Before a save, to reject bad input. |
|
|
To change the payload on its way to storage. |
|
|
To apply one saved configuration to one asset. |
|
|
After a successful save, to push the configuration to a device or edge. |
|
|
After a configuration is deleted. |
Add lifecycle hooks
A component often has work of its own to do when it arrives or leaves: seeding a collection, opening a connection to an outside service, tidying up after itself. Lifecycle hooks are where that work goes.
Name a service <componentId>_<hook> and IA calls it. A component without one installs normally.
|
Service |
Runs |
|---|---|
|
|
Once, after the component's resources are imported. |
|
|
After an upgrade to a new version. |
|
|
Before the component's resources are removed. |
|
|
When an administrator enables the component. |
|
|
When an administrator disables it. |
Declare secrets
A component that talks to an outside service needs credentials for it, and those must not travel in the zip. Declare a slot for each one instead. An administrator uploads the secret once and picks it during install.
"secrets": [
{
"key": "nimbelink_api",
"label": "NimbeLink API credentials",
"description": "Username, password and API key from NimbeLink support.",
"required": true
}
]
key accepts letters, digits, dot, underscore and hyphen. Install of the component cannot finish until every required slot is filled.
Declare custom roles
A component that adds a screen or an action of its own usually wants a say in who reaches it. Declaring a role here gives an administrator something to grant.
Install turns each entry into an IA custom role named <componentId>_<name>.
"customRoles": [
{
"name": "operator",
"displayName": "Modbus operator",
"description": "Can edit a Modbus configuration.",
"permissions": ["modbus.config.edit"]
}
]
permissions must not be empty, and every entry must start with the component's own id followed by a dot. Install rejects the component otherwise.
For every page slot, install also adds a permission that opens that page. Grant the role to anyone who needs the page in their menu.
Build the release zip
Build the bundles, then zip from inside the component folder so component.json sits at the zip root.
List every folder the component ships. A folder left out installs without error and fails at runtime with nothing to point at.
Register the release
Send the zip to ClearBlade. A ClearBlade developer registers it to the catalog.
Once registered, the version appears on the Components page of every Intelligent Assets system. Administrators install it from there. See Admin components.
Release a new version
Raise componentVersion and register the new zip. The old release stays in the catalog and the new version becomes available in the UI.
An upgrade re-imports everything the zip ships. A resource the component created at runtime, rather than shipping in the zip, is not re-created. Rebuild it in <id>_update.