mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
/* global process */
|
|
|
|
/**
|
|
* This module is used to define the look and feels for charts rendered via the
|
|
* backend chart rendering service Chartcuterie.
|
|
*
|
|
* Be careful what you import into this file, as it will end up being bundled
|
|
* into the configuration file loaded by the service.
|
|
*/
|
|
|
|
// eslint-disable-next-line import/no-named-default
|
|
import {discoverCharts} from './discover';
|
|
import {metricAlertCharts} from './metricAlert';
|
|
import type {
|
|
ChartcuterieConfig,
|
|
ChartType,
|
|
RenderConfig,
|
|
RenderDescriptor,
|
|
} from './types';
|
|
|
|
/**
|
|
* All registered style descriptors
|
|
*/
|
|
const renderConfig: RenderConfig<ChartType> = new Map();
|
|
|
|
/**
|
|
* Chartcuterie configuration object
|
|
*/
|
|
const config: ChartcuterieConfig = {
|
|
version: process.env.COMMIT_SHA!,
|
|
renderConfig,
|
|
};
|
|
|
|
/**
|
|
* Register a style descriptor
|
|
*/
|
|
const register = (renderDescriptor: RenderDescriptor<ChartType>) =>
|
|
renderConfig.set(renderDescriptor.key, renderDescriptor);
|
|
|
|
discoverCharts.forEach(register);
|
|
metricAlertCharts.forEach(register);
|
|
|
|
export default config;
|