mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -06:00
3c6e0e8ef8
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { PanelModel } from '@grafana/data';
|
|
import { sharedSingleStatPanelChangedHandler, sharedSingleStatMigrationHandler } from '@grafana/ui';
|
|
|
|
import { GaugeOptions } from './types';
|
|
|
|
// This is called when the panel first loads
|
|
export const gaugePanelMigrationHandler = (panel: PanelModel<GaugeOptions>): Partial<GaugeOptions> => {
|
|
return sharedSingleStatMigrationHandler(panel);
|
|
};
|
|
|
|
// This is called when the panel changes from another panel
|
|
export const gaugePanelChangedHandler = (
|
|
panel: PanelModel<Partial<GaugeOptions>> | any,
|
|
prevPluginId: string,
|
|
prevOptions: any
|
|
) => {
|
|
// This handles most config changes
|
|
const opts = sharedSingleStatPanelChangedHandler(panel, prevPluginId, prevOptions) as GaugeOptions;
|
|
|
|
// Changing from angular singlestat
|
|
if (prevPluginId === 'singlestat' && prevOptions.angular) {
|
|
const gauge = prevOptions.angular.gauge;
|
|
if (gauge) {
|
|
opts.showThresholdMarkers = gauge.thresholdMarkers;
|
|
opts.showThresholdLabels = gauge.thresholdLabels;
|
|
}
|
|
}
|
|
return opts;
|
|
};
|