mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 11:13:11 +08:00

* kindsys: Adapt to new PanelCfg schema interface * building locally * Remove Panel prefix in cue files * Regenerate * Update imports * fixup! Merge branch 'remove-panel-prefix' into sdboyer/redundant-panelcfg-prefixes * Fix formatting --------- Co-authored-by: Ryan McKinley <ryantxu@gmail.com> Co-authored-by: Tania B <yalyna.ts@gmail.com>
23 lines
594 B
TypeScript
23 lines
594 B
TypeScript
import { PanelModel } from '@grafana/data';
|
|
|
|
import { Options } from './models.gen';
|
|
|
|
export const canvasMigrationHandler = (panel: PanelModel): Partial<Options> => {
|
|
const pluginVersion = panel?.pluginVersion ?? '';
|
|
|
|
// Rename text-box to rectangle
|
|
// Initial plugin version is empty string for first migration
|
|
if (pluginVersion === '') {
|
|
const root = panel.options?.root;
|
|
if (root?.elements) {
|
|
for (const element of root.elements) {
|
|
if (element.type === 'text-box') {
|
|
element.type = 'rectangle';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return panel.options;
|
|
};
|