Skip to main content
Version: 3.2

Libraries in apps

Beta: some things the UI kit does not draw: a heatmap, a gauge, a process flow. For those, an app adds a library from MaestroHub's catalog. It takes the app's look, works offline, and gets its fixes with MaestroHub.

Where
App Studio › an app › Code › Libraries; App Studio › Libraries
Charts
Apache ECharts 6
Diagrams
React Flow 12
Beta

App Studio is in Beta. It is included in the MaestroHub trial; on a paid licence it is an add-on, like Advanced Access Control, switched on by a licence that includes the app_studio feature. The module is on by default, so the licence decides. Names and steps may change while it is in Beta.

The catalog​

LibraryForInstead, when
Apache ECharts 6 (echarts)Heatmap, gauge, sankey, radar, scatter, pie, candlestick, large or zoomable time seriesA plain trend, bar chart or sparkline: the UI kit's TimeSeriesChart, BarChart and Sparkline need no library
React Flow 12 (xyflow)Process flows, line layouts, material flow, boxes and arrows a person can pan, zoom or rearrangeA 3D view of a line: the scene kit (@maestrohub/scene)
three.js r170 (three)Custom 3D beyond the scene kitPart of every app: nothing to add

A library that is not in the catalog has to be requested by an administrator: each one is reviewed before apps can use it. Never paste a library's code into an app. It would get no fixes, and the builder refuses files over 512 KiB anyway.

Adding a library​

Most of the time you do not add it yourself: when you ask your AI client for "a heatmap of downtime by machine", it looks the catalog up with find_libraries, adds the library and says in one line which one it used and why.

To add one by hand: open the app in the builder, Code tab, Libraries, Add library. Type what you want to show; the best fit comes first. An app that imports a library it has not added shows an issue with an Add button.

Under the hood, the app's manifest.json lists what it uses:

{ "scopes": [], "libraries": { "echarts": "6", "xyflow": "12" } }

Choosing which libraries the workspace uses​

Every catalog library is on in a new workspace. A workspace administrator can turn one off, for example while a library is under review, or to keep every app on one way of drawing charts. App Studio › Libraries lists each library with what it is for and the apps that show it to their viewers today; apps you cannot open are counted, never named. three.js is part of every app and is always on.

Turning a library off stops new uses; it never breaks a running app.

  • Apps that use it when it is turned off are kept. They keep working, can keep shipping new versions and can always roll back. Their owners and publishers are told.
  • No other app can start using it. Add library shows it greyed with the reason and who turned it off. An app that imports it anyway shows an error with Ask the builder to replace it, and cannot publish until it uses something else.
  • Not even by rolling back. An app that is not kept cannot activate an older version that used the library, approve a release that uses it, or be switched back on with such a version live. The version history and the release review say why before you click.
  • Turning it back on lifts all of this; every app can use it again.

The dialog asks for a reason (up to 280 characters). Builders and their AI clients are shown it wherever the library is refused, so write what to use instead: "Charts come from the UI kit until the review is done."

Turning libraries on and off needs the app:curate permission, which the workspace administrator role has. Everyone else who can read apps sees the page and each library's state.

A backup does not carry this choice and a restore never changes it. When a restored app's live version uses a library that is off here, the restore report names the app and the library: publish a version without it, or turn the library back on.

Looking like the rest of MaestroHub​

Put a chart or diagram in the UI kit's VisualFrame and theme it with the kit's adapter:

import * as echarts from 'echarts';
import { VisualFrame, echartsTheme, usePalette } from '@maestrohub/app-ui';

const chart = echarts.init(element, echartsTheme(usePalette()));

VisualFrame gives every visual the same card, title, unit, "Updated" time and the same loading, empty, error and "Bad readings left out" states. echartsTheme, xyflowStyle/nodeTone and threeTheme give each library MaestroHub's colours and fonts, light and dark. The app frame cannot download or open windows itself: save a chart picture with saveChartImage(chart, 'name.png').

Versions​

  • MaestroHub picks the exact version. An app names a major version ("6"); fixes within it arrive with MaestroHub upgrades.
  • A new major version is your choice. When ECharts 7 arrives, apps on 6 keep running on 6. In the builder's Libraries list, Move to 7 changes the app; ask your AI client to update the code, check the preview, and publish. The release review lists every library change before it goes live.
  • An old major is served for at least 18 months after its successor arrives. App Studio › Compatibility shows which apps use which library version and warns before a version's end date. An app on a version that is no longer served shows a page that says which library to move, until it is published again.

Assets: images, drawings, maps and models​

An app can ship the files it shows under assets/, beside its code: images (PNG, JPEG, WebP), SVG drawings such as a plant layout, map data (GeoJSON), tables (CSV), JSON, and 3D models (.glb). Upload them in the builder (Code tab, Assets, Upload files), or let your AI client write text files such as GeoJSON for you.

Per filePer app
Code512 KiB20 MiB
Assets10 MiB; 25 MiB for a 3D model100 MiB

Code imports an asset to get its address, never its bytes, so a screen loads it only when it shows it:

import layoutUrl from '../assets/plant-layout.svg';   // from a file in src/

<img src={layoutUrl} alt="Line 3 layout" />
// or: fetch(siteUrl).then((r) => r.json())

A file must be what its name says: a .png that is really a web page, or a .json that does not parse, is refused.

Assets are public like the app's code. Anyone with the app's address can open them, so they are for what the app shows to everyone: layouts, icons, maps, models. Customer records and their files belong in app storage, never in assets.

Replacing a large asset keeps the old one in the app's history. Each app's history may grow to 500 MiB; the Assets panel shows how much is used. A workspace backup carries every app's history and restores up to 16 GiB.