@fusedashlabs/ui9000-workspace
Version:
UI9000 workspace MCP. One tool, show_workspace, draws a chart from your table. Set TYPESAFE_API_KEY to let Jev choose the chart.
64 lines (63 loc) • 3.07 kB
JavaScript
/**
* Headline family. The main drawing is the KPI card.
*
* Call the incidents review card when the numbers are incident counts by
* state for one scope. Call the goal burst when one goal's resource groups
* carry their calls and how long they take to be answered. Call the asset
* health overview when the environment already has an agent population plus
* asset categories with health. Call the power path card only when one
* equipment group already has a health score and every other metric carries
* a status, a level, or a threshold. Call the dial
* only when a health score already sits beside other measures.
* Call the loss indicator only when one metric already has a minimum, a
* maximum, and operating thresholds. Call the component asset card only when
* one row names an asset by its id and holds one metric. A plain number, or
* several metrics, stays the KPI card.
*/
import { assetHealthFits } from './asset-health-overview.js';
import { goalBurstFits } from './goal-burst.js';
import { incidentsReviewFits } from './incidents-review-card.js';
import { componentAssetFits } from './component-asset-card.js';
import { lossIndicatorFits } from './loss-indicator.js';
import { powerPathFits } from './power-path-card.js';
import { statusGaugeFits } from './status-gauge-widget.js';
export const HEADLINE_CHARTS = [
'kpi-widget',
'status-gauge-widget',
'loss-indicator',
'power-path-card',
'component-asset-card',
'incidents-review-card',
'asset-health-overview',
'goal-burst',
];
export function isHeadlineChart(id) {
return HEADLINE_CHARTS.includes(id);
}
/**
* Which headline drawing the rows support. The incidents review card is
* checked first, because only it needs a column that names incidents. The
* goal burst is next, because it is the asset health overview's payload with
* answer times, then the overview: agents plus category health. The power path
* card follows, because the dial also fits a health score whose metrics carry
* a status. Gauge is checked before the loss scale, and the scale before the
* asset card, which needs no minimum or maximum. `drawable` drops a chart the
* host catalog cannot draw. The KPI card is the main drawing and always stays.
*/
export function headlineChart(payload, drawable = () => true) {
if (drawable('incidents-review-card') && incidentsReviewFits(payload))
return 'incidents-review-card';
if (drawable('goal-burst') && goalBurstFits(payload))
return 'goal-burst';
if (drawable('asset-health-overview') && assetHealthFits(payload))
return 'asset-health-overview';
if (drawable('power-path-card') && powerPathFits(payload))
return 'power-path-card';
if (drawable('status-gauge-widget') && statusGaugeFits(payload))
return 'status-gauge-widget';
if (drawable('loss-indicator') && lossIndicatorFits(payload))
return 'loss-indicator';
if (drawable('component-asset-card') && componentAssetFits(payload))
return 'component-asset-card';
return 'kpi-widget';
}