12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /* 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;
|