mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* user essentials mob! 🔱 * Wip * user essentials mob! 🔱 lastFile:public/app/plugins/panel/bargauge/module.tsx * user essentials mob! 🔱 * update betterer results file Co-authored-by: kay delaney <kay@grafana.com> Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com> Co-authored-by: Joao Silva <joao.silva@grafana.com>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { PanelModel } from '@grafana/data';
|
|
import { sharedSingleStatPanelChangedHandler, sharedSingleStatMigrationHandler } from '@grafana/ui';
|
|
|
|
import { PanelOptions } from './models.gen';
|
|
|
|
// This is called when the panel first loads
|
|
export const gaugePanelMigrationHandler = (panel: PanelModel<PanelOptions>): Partial<PanelOptions> => {
|
|
return sharedSingleStatMigrationHandler(panel);
|
|
};
|
|
|
|
// This is called when the panel changes from another panel
|
|
export const gaugePanelChangedHandler = (
|
|
panel: PanelModel<Partial<PanelOptions>> | any,
|
|
prevPluginId: string,
|
|
prevOptions: any
|
|
) => {
|
|
// This handles most config changes
|
|
const opts = sharedSingleStatPanelChangedHandler(panel, prevPluginId, prevOptions) as PanelOptions;
|
|
|
|
// 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;
|
|
};
|