"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "public/app/features/dashboard/state/DashboardMigrator.ts" between
grafana-8.0.0.tar.gz and grafana-8.0.1.tar.gz

About: Grafana is a visualization tool for monitoring, metric analytics and dashboards for Graphite, InfluxDB, Prometheus and many more.

DashboardMigrator.ts  (grafana-8.0.0):DashboardMigrator.ts  (grafana-8.0.1)
skipping to change at line 43 skipping to change at line 43
import { alignCurrentWithMulti } from 'app/features/variables/shared/multiOption s'; import { alignCurrentWithMulti } from 'app/features/variables/shared/multiOption s';
import { VariableHide } from '../../variables/types'; import { VariableHide } from '../../variables/types';
import { config } from 'app/core/config'; import { config } from 'app/core/config';
import { plugin as statPanelPlugin } from 'app/plugins/panel/stat/module'; import { plugin as statPanelPlugin } from 'app/plugins/panel/stat/module';
import { plugin as gaugePanelPlugin } from 'app/plugins/panel/gauge/module'; import { plugin as gaugePanelPlugin } from 'app/plugins/panel/gauge/module';
import { getStandardFieldConfigs, getStandardOptionEditors } from '@grafana/ui'; import { getStandardFieldConfigs, getStandardOptionEditors } from '@grafana/ui';
standardEditorsRegistry.setInit(getStandardOptionEditors); standardEditorsRegistry.setInit(getStandardOptionEditors);
standardFieldConfigEditorRegistry.setInit(getStandardFieldConfigs); standardFieldConfigEditorRegistry.setInit(getStandardFieldConfigs);
type PanelSchemeUpgradeHandler = (panel: PanelModel) => PanelModel;
export class DashboardMigrator { export class DashboardMigrator {
dashboard: DashboardModel; dashboard: DashboardModel;
constructor(dashboardModel: DashboardModel) { constructor(dashboardModel: DashboardModel) {
this.dashboard = dashboardModel; this.dashboard = dashboardModel;
} }
updateSchema(old: any) { updateSchema(old: any) {
let i, j, k, n; let i, j, k, n;
const oldVersion = this.dashboard.schemaVersion; const oldVersion = this.dashboard.schemaVersion;
const panelUpgrades = []; const panelUpgrades: PanelSchemeUpgradeHandler[] = [];
this.dashboard.schemaVersion = 30; this.dashboard.schemaVersion = 30;
if (oldVersion === this.dashboard.schemaVersion) { if (oldVersion === this.dashboard.schemaVersion) {
return; return;
} }
// version 2 schema changes // version 2 schema changes
if (oldVersion < 2) { if (oldVersion < 2) {
if (old.services) { if (old.services) {
if (old.services.filter) { if (old.services.filter) {
this.dashboard.time = old.services.filter.time; this.dashboard.time = old.services.filter.time;
this.dashboard.templating.list = old.services.filter.list || []; this.dashboard.templating.list = old.services.filter.list || [];
} }
} }
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
// rename panel type // rename panel type
if (panel.type === 'graphite') { if (panel.type === 'graphite') {
panel.type = 'graph'; panel.type = 'graph';
} }
if (panel.type !== 'graph') { if (panel.type !== 'graph') {
return; return panel;
} }
if (isBoolean(panel.legend)) { if (isBoolean(panel.legend)) {
panel.legend = { show: panel.legend }; panel.legend = { show: panel.legend };
} }
if (panel.grid) { if (panel.grid) {
if (panel.grid.min) { if (panel.grid.min) {
panel.grid.leftMin = panel.grid.min; panel.grid.leftMin = panel.grid.min;
delete panel.grid.min; delete panel.grid.min;
skipping to change at line 109 skipping to change at line 111
delete panel.y_format; delete panel.y_format;
} }
if (panel.y2_format) { if (panel.y2_format) {
if (!panel.y_formats) { if (!panel.y_formats) {
panel.y_formats = []; panel.y_formats = [];
} }
panel.y_formats[1] = panel.y2_format; panel.y_formats[1] = panel.y2_format;
delete panel.y2_format; delete panel.y2_format;
} }
return panel;
}); });
} }
// schema version 3 changes // schema version 3 changes
if (oldVersion < 3) { if (oldVersion < 3) {
// ensure panel IDs // ensure panel IDs
let maxId = this.dashboard.getNextPanelId(); let maxId = this.dashboard.getNextPanelId();
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (!panel.id) { if (!panel.id) {
panel.id = maxId; panel.id = maxId;
maxId += 1; maxId += 1;
} }
return panel;
}); });
} }
// schema version 4 changes // schema version 4 changes
if (oldVersion < 4) { if (oldVersion < 4) {
// move aliasYAxis changes // move aliasYAxis changes
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (panel.type !== 'graph') { if (panel.type !== 'graph') {
return; return panel;
} }
each(panel.aliasYAxis, (value, key) => { each(panel.aliasYAxis, (value, key) => {
panel.seriesOverrides = [{ alias: key, yaxis: value }]; panel.seriesOverrides = [{ alias: key, yaxis: value }];
}); });
delete panel.aliasYAxis; delete panel.aliasYAxis;
return panel;
}); });
} }
if (oldVersion < 6) { if (oldVersion < 6) {
// move drop-downs to new schema // move drop-downs to new schema
const annotations: any = find(old.pulldowns, { type: 'annotations' }); const annotations: any = find(old.pulldowns, { type: 'annotations' });
if (annotations) { if (annotations) {
this.dashboard.annotations = { this.dashboard.annotations = {
list: annotations.annotations || [], list: annotations.annotations || [],
skipping to change at line 178 skipping to change at line 188
this.dashboard.timepicker = old.nav[0]; this.dashboard.timepicker = old.nav[0];
} }
// ensure query refIds // ensure query refIds
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
each(panel.targets, (target) => { each(panel.targets, (target) => {
if (!target.refId) { if (!target.refId) {
target.refId = panel.getNextQueryLetter && panel.getNextQueryLetter( ); target.refId = panel.getNextQueryLetter && panel.getNextQueryLetter( );
} }
}); });
return panel;
}); });
} }
if (oldVersion < 8) { if (oldVersion < 8) {
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
each(panel.targets, (target) => { each(panel.targets, (target) => {
// update old influxdb query schema // update old influxdb query schema
if (target.fields && target.tags && target.groupBy) { if (target.fields && target.tags && target.groupBy) {
if (target.rawQuery) { if (target.rawQuery) {
delete target.fields; delete target.fields;
skipping to change at line 221 skipping to change at line 233
} }
}); });
if (target.fill) { if (target.fill) {
target.groupBy.push({ type: 'fill', params: [target.fill] }); target.groupBy.push({ type: 'fill', params: [target.fill] });
delete target.fill; delete target.fill;
} }
} }
} }
}); });
return panel;
}); });
} }
// schema version 9 changes // schema version 9 changes
if (oldVersion < 9) { if (oldVersion < 9) {
// move aliasYAxis changes // move aliasYAxis changes
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (panel.type !== 'singlestat' && panel.thresholds !== '') { if (panel.type !== 'singlestat' && panel.thresholds !== '') {
return; return panel;
} }
if (panel.thresholds) { if (panel.thresholds) {
const k = panel.thresholds.split(','); const k = panel.thresholds.split(',');
if (k.length >= 3) { if (k.length >= 3) {
k.shift(); k.shift();
panel.thresholds = k.join(','); panel.thresholds = k.join(',');
} }
} }
return panel;
}); });
} }
// schema version 10 changes // schema version 10 changes
if (oldVersion < 10) { if (oldVersion < 10) {
// move aliasYAxis changes // move aliasYAxis changes
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (panel.type !== 'table') { if (panel.type !== 'table') {
return; return panel;
} }
each(panel.styles, (style) => { each(panel.styles, (style) => {
if (style.thresholds && style.thresholds.length >= 3) { if (style.thresholds && style.thresholds.length >= 3) {
const k = style.thresholds; const k = style.thresholds;
k.shift(); k.shift();
style.thresholds = k; style.thresholds = k;
} }
}); });
return panel;
}); });
} }
if (oldVersion < 12) { if (oldVersion < 12) {
// update template variables // update template variables
each(this.dashboard.getVariables(), (templateVariable: any) => { each(this.dashboard.getVariables(), (templateVariable: any) => {
if (templateVariable.refresh) { if (templateVariable.refresh) {
templateVariable.refresh = 1; templateVariable.refresh = 1;
} }
if (!templateVariable.refresh) { if (!templateVariable.refresh) {
skipping to change at line 282 skipping to change at line 300
} else if (templateVariable.hideLabel) { } else if (templateVariable.hideLabel) {
templateVariable.hide = 1; templateVariable.hide = 1;
} }
}); });
} }
if (oldVersion < 12) { if (oldVersion < 12) {
// update graph yaxes changes // update graph yaxes changes
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (panel.type !== 'graph') { if (panel.type !== 'graph') {
return; return panel;
} }
if (!panel.grid) { if (!panel.grid) {
return; return panel;
} }
if (!panel.yaxes) { if (!panel.yaxes) {
panel.yaxes = [ panel.yaxes = [
{ {
show: panel['y-axis'], show: panel['y-axis'],
min: panel.grid.leftMin, min: panel.grid.leftMin,
max: panel.grid.leftMax, max: panel.grid.leftMax,
logBase: panel.grid.leftLogBase, logBase: panel.grid.leftLogBase,
format: panel.y_formats[0], format: panel.y_formats[0],
skipping to change at line 324 skipping to change at line 342
delete panel.grid.leftLogBase; delete panel.grid.leftLogBase;
delete panel.grid.rightMin; delete panel.grid.rightMin;
delete panel.grid.rightMax; delete panel.grid.rightMax;
delete panel.grid.rightLogBase; delete panel.grid.rightLogBase;
delete panel.y_formats; delete panel.y_formats;
delete panel.leftYAxisLabel; delete panel.leftYAxisLabel;
delete panel.rightYAxisLabel; delete panel.rightYAxisLabel;
delete panel['y-axis']; delete panel['y-axis'];
delete panel['x-axis']; delete panel['x-axis'];
} }
return panel;
}); });
} }
if (oldVersion < 13) { if (oldVersion < 13) {
// update graph yaxes changes // update graph yaxes changes
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (panel.type !== 'graph') { if (panel.type !== 'graph') {
return; return panel;
} }
if (!panel.grid) { if (!panel.grid) {
return; return panel;
} }
if (!panel.thresholds) { if (!panel.thresholds) {
panel.thresholds = []; panel.thresholds = [];
} }
const t1: any = {}, const t1: any = {},
t2: any = {}; t2: any = {};
if (panel.grid.threshold1 !== null) { if (panel.grid.threshold1 !== null) {
t1.value = panel.grid.threshold1; t1.value = panel.grid.threshold1;
skipping to change at line 391 skipping to change at line 411
t1.op = 'gt'; t1.op = 'gt';
panel.thresholds.push(t1); panel.thresholds.push(t1);
} }
} }
delete panel.grid.threshold1; delete panel.grid.threshold1;
delete panel.grid.threshold1Color; delete panel.grid.threshold1Color;
delete panel.grid.threshold2; delete panel.grid.threshold2;
delete panel.grid.threshold2Color; delete panel.grid.threshold2Color;
delete panel.grid.thresholdLine; delete panel.grid.thresholdLine;
return panel;
}); });
} }
if (oldVersion < 14) { if (oldVersion < 14) {
this.dashboard.graphTooltip = old.sharedCrosshair ? 1 : 0; this.dashboard.graphTooltip = old.sharedCrosshair ? 1 : 0;
} }
if (oldVersion < 16) { if (oldVersion < 16) {
this.upgradeToGridLayout(old); this.upgradeToGridLayout(old);
} }
skipping to change at line 416 skipping to change at line 438
const factors = getFactors(GRID_COLUMN_COUNT); const factors = getFactors(GRID_COLUMN_COUNT);
// find the best match compared to factors // find the best match compared to factors
// (ie. [1,2,3,4,6,12,24] for 24 columns) // (ie. [1,2,3,4,6,12,24] for 24 columns)
panel.maxPerRow = panel.maxPerRow =
factors[ factors[
findIndex(factors, (o) => { findIndex(factors, (o) => {
return o > max; return o > max;
}) - 1 }) - 1
]; ];
} }
delete panel.minSpan; delete panel.minSpan;
return panel;
}); });
} }
if (oldVersion < 18) { if (oldVersion < 18) {
// migrate change to gauge options // migrate change to gauge options
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (panel['options-gauge']) { if (panel['options-gauge']) {
panel.options = panel['options-gauge']; panel.options = panel['options-gauge'];
panel.options.valueOptions = { panel.options.valueOptions = {
unit: panel.options.unit, unit: panel.options.unit,
skipping to change at line 447 skipping to change at line 472
// this options prop was due to a bug // this options prop was due to a bug
delete panel.options.options; delete panel.options.options;
delete panel.options.unit; delete panel.options.unit;
delete panel.options.stat; delete panel.options.stat;
delete panel.options.decimals; delete panel.options.decimals;
delete panel.options.prefix; delete panel.options.prefix;
delete panel.options.suffix; delete panel.options.suffix;
delete panel['options-gauge']; delete panel['options-gauge'];
} }
return panel;
}); });
} }
if (oldVersion < 19) { if (oldVersion < 19) {
// migrate change to gauge options // migrate change to gauge options
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (panel.links && isArray(panel.links)) { if (panel.links && isArray(panel.links)) {
panel.links = panel.links.map(upgradePanelLink); panel.links = panel.links.map(upgradePanelLink);
} }
return panel;
}); });
} }
if (oldVersion < 20) { if (oldVersion < 20) {
const updateLinks = (link: DataLink) => { const updateLinks = (link: DataLink) => {
return { return {
...link, ...link,
url: updateVariablesSyntax(link.url), url: updateVariablesSyntax(link.url),
}; };
}; };
skipping to change at line 483 skipping to change at line 512
if (panel.options && panel.options.fieldOptions && panel.options.fieldOp tions.defaults) { if (panel.options && panel.options.fieldOptions && panel.options.fieldOp tions.defaults) {
if (panel.options.fieldOptions.defaults.links && isArray(panel.options .fieldOptions.defaults.links)) { if (panel.options.fieldOptions.defaults.links && isArray(panel.options .fieldOptions.defaults.links)) {
panel.options.fieldOptions.defaults.links = panel.options.fieldOptio ns.defaults.links.map(updateLinks); panel.options.fieldOptions.defaults.links = panel.options.fieldOptio ns.defaults.links.map(updateLinks);
} }
if (panel.options.fieldOptions.defaults.title) { if (panel.options.fieldOptions.defaults.title) {
panel.options.fieldOptions.defaults.title = updateVariablesSyntax( panel.options.fieldOptions.defaults.title = updateVariablesSyntax(
panel.options.fieldOptions.defaults.title panel.options.fieldOptions.defaults.title
); );
} }
} }
return panel;
}); });
} }
if (oldVersion < 21) { if (oldVersion < 21) {
const updateLinks = (link: DataLink) => { const updateLinks = (link: DataLink) => {
return { return {
...link, ...link,
url: link.url.replace(/__series.labels/g, '__field.labels'), url: link.url.replace(/__series.labels/g, '__field.labels'),
}; };
}; };
skipping to change at line 505 skipping to change at line 536
if (panel.options && panel.options.dataLinks && isArray(panel.options.da taLinks)) { if (panel.options && panel.options.dataLinks && isArray(panel.options.da taLinks)) {
panel.options.dataLinks = panel.options.dataLinks.map(updateLinks); panel.options.dataLinks = panel.options.dataLinks.map(updateLinks);
} }
// For panel with fieldOptions // For panel with fieldOptions
if (panel.options && panel.options.fieldOptions && panel.options.fieldOp tions.defaults) { if (panel.options && panel.options.fieldOptions && panel.options.fieldOp tions.defaults) {
if (panel.options.fieldOptions.defaults.links && isArray(panel.options .fieldOptions.defaults.links)) { if (panel.options.fieldOptions.defaults.links && isArray(panel.options .fieldOptions.defaults.links)) {
panel.options.fieldOptions.defaults.links = panel.options.fieldOptio ns.defaults.links.map(updateLinks); panel.options.fieldOptions.defaults.links = panel.options.fieldOptio ns.defaults.links.map(updateLinks);
} }
} }
return panel;
}); });
} }
if (oldVersion < 22) { if (oldVersion < 22) {
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
if (panel.type !== 'table') { if (panel.type !== 'table') {
return; return panel;
} }
each(panel.styles, (style) => { each(panel.styles, (style) => {
style.align = 'auto'; style.align = 'auto';
}); });
return panel;
}); });
} }
if (oldVersion < 23) { if (oldVersion < 23) {
for (const variable of this.dashboard.templating.list) { for (const variable of this.dashboard.templating.list) {
if (!isMulti(variable)) { if (!isMulti(variable)) {
continue; continue;
} }
const { multi, current } = variable; const { multi, current } = variable;
variable.current = alignCurrentWithMulti(current, multi); variable.current = alignCurrentWithMulti(current, multi);
} }
} }
if (oldVersion < 24) { if (oldVersion < 24) {
// 7.0 // 7.0
// - migrate existing tables to 'table-old' // - migrate existing tables to 'table-old'
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
const wasAngularTable = panel.type === 'table'; const wasAngularTable = panel.type === 'table';
if (wasAngularTable && !panel.styles) { if (wasAngularTable && !panel.styles) {
return; // styles are missing so assumes default settings return panel; // styles are missing so assumes default settings
} }
const wasReactTable = panel.table === 'table2'; const wasReactTable = panel.table === 'table2';
if (!wasAngularTable || wasReactTable) { if (!wasAngularTable || wasReactTable) {
return; return panel;
} }
panel.type = wasAngularTable ? 'table-old' : 'table'; panel.type = wasAngularTable ? 'table-old' : 'table';
return panel;
}); });
} }
if (oldVersion < 25) { if (oldVersion < 25) {
// tags are removed in version 28 // tags are removed in version 28
} }
if (oldVersion < 26) { if (oldVersion < 26) {
panelUpgrades.push((panel: any) => { panelUpgrades.push((panel: any) => {
const wasReactText = panel.type === 'text2'; const wasReactText = panel.type === 'text2';
if (!wasReactText) { if (!wasReactText) {
return; return panel;
} }
panel.type = 'text'; panel.type = 'text';
delete panel.options.angular; delete panel.options.angular;
return panel;
}); });
} }
if (oldVersion < 27) { if (oldVersion < 27) {
for (const variable of this.dashboard.templating.list) { for (const variable of this.dashboard.templating.list) {
if (!isConstant(variable)) { if (!isConstant(variable)) {
continue; continue;
} }
if (variable.hide === VariableHide.dontHide || variable.hide === Variabl eHide.hideLabel) { if (variable.hide === VariableHide.dontHide || variable.hide === Variabl eHide.hideLabel) {
skipping to change at line 580 skipping to change at line 617
} }
variable.current = { selected: true, text: variable.query ?? '', value: variable.query ?? '' }; variable.current = { selected: true, text: variable.query ?? '', value: variable.query ?? '' };
variable.options = [variable.current]; variable.options = [variable.current];
} }
} }
if (oldVersion < 28) { if (oldVersion < 28) {
panelUpgrades.push((panel: PanelModel) => { panelUpgrades.push((panel: PanelModel) => {
if (panel.type === 'singlestat') { if (panel.type === 'singlestat') {
migrateSinglestat(panel); return migrateSinglestat(panel);
} }
return panel;
}); });
for (const variable of this.dashboard.templating.list) { for (const variable of this.dashboard.templating.list) {
if (variable.tags) { if (variable.tags) {
delete variable.tags; delete variable.tags;
} }
if (variable.tagsQuery) { if (variable.tagsQuery) {
delete variable.tagsQuery; delete variable.tagsQuery;
} }
skipping to change at line 630 skipping to change at line 669
panelUpgrades.push(upgradeValueMappingsForPanel); panelUpgrades.push(upgradeValueMappingsForPanel);
panelUpgrades.push(migrateTooltipOptions); panelUpgrades.push(migrateTooltipOptions);
} }
if (panelUpgrades.length === 0) { if (panelUpgrades.length === 0) {
return; return;
} }
for (j = 0; j < this.dashboard.panels.length; j++) { for (j = 0; j < this.dashboard.panels.length; j++) {
for (k = 0; k < panelUpgrades.length; k++) { for (k = 0; k < panelUpgrades.length; k++) {
panelUpgrades[k].call(this, this.dashboard.panels[j]); this.dashboard.panels[j] = panelUpgrades[k].call(this, this.dashboard.pa nels[j]);
if (this.dashboard.panels[j].panels) { if (this.dashboard.panels[j].panels) {
for (n = 0; n < this.dashboard.panels[j].panels.length; n++) { for (n = 0; n < this.dashboard.panels[j].panels.length; n++) {
panelUpgrades[k].call(this, this.dashboard.panels[j].panels[n]); this.dashboard.panels[j].panels[n] = panelUpgrades[k].call(this, thi s.dashboard.panels[j].panels[n]);
} }
} }
} }
} }
} }
upgradeToGridLayout(old: any) { upgradeToGridLayout(old: any) {
let yPos = 0; let yPos = 0;
const widthFactor = GRID_COLUMN_COUNT / 12; const widthFactor = GRID_COLUMN_COUNT / 12;
skipping to change at line 883 skipping to change at line 922
return '${__field.name}'; return '${__field.name}';
} }
return match; return match;
}); });
} }
function migrateSinglestat(panel: PanelModel) { function migrateSinglestat(panel: PanelModel) {
// If 'grafana-singlestat-panel' exists, move to that // If 'grafana-singlestat-panel' exists, move to that
if (config.panels['grafana-singlestat-panel']) { if (config.panels['grafana-singlestat-panel']) {
panel.type = 'grafana-singlestat-panel'; panel.type = 'grafana-singlestat-panel';
return; return panel;
}
let returnSaveModel = false;
if (!panel.changePlugin) {
returnSaveModel = true;
panel = new PanelModel(panel);
} }
// To make sure PanelModel.isAngularPlugin logic thinks the current panel is a ngular // To make sure PanelModel.isAngularPlugin logic thinks the current panel is a ngular
// And since this plugin no longer exist we just fake it here // And since this plugin no longer exist we just fake it here
panel.plugin = { angularPanelCtrl: {} } as PanelPlugin; panel.plugin = { angularPanelCtrl: {} } as PanelPlugin;
// Otheriwse use gauge or stat panel // Otheriwse use gauge or stat panel
if ((panel as any).gauge?.show) { if ((panel as any).gauge?.show) {
gaugePanelPlugin.meta = config.panels['gauge']; gaugePanelPlugin.meta = config.panels['gauge'];
panel.changePlugin(gaugePanelPlugin); panel.changePlugin(gaugePanelPlugin);
} else { } else {
statPanelPlugin.meta = config.panels['stat']; statPanelPlugin.meta = config.panels['stat'];
panel.changePlugin(statPanelPlugin); panel.changePlugin(statPanelPlugin);
} }
if (returnSaveModel) {
return panel.getSaveModel();
}
return panel;
} }
function upgradeValueMappingsForPanel(panel: PanelModel) { function upgradeValueMappingsForPanel(panel: PanelModel) {
const fieldConfig = panel.fieldConfig; const fieldConfig = panel.fieldConfig;
if (!fieldConfig) { if (!fieldConfig) {
return; return panel;
} }
fieldConfig.defaults.mappings = upgradeValueMappings(fieldConfig.defaults.mapp ings, fieldConfig.defaults.thresholds); fieldConfig.defaults.mappings = upgradeValueMappings(fieldConfig.defaults.mapp ings, fieldConfig.defaults.thresholds);
for (const override of fieldConfig.overrides) { for (const override of fieldConfig.overrides) {
for (const prop of override.properties) { for (const prop of override.properties) {
if (prop.id === 'mappings') { if (prop.id === 'mappings') {
prop.value = upgradeValueMappings(prop.value); prop.value = upgradeValueMappings(prop.value);
} }
} }
} }
return panel;
} }
function upgradeValueMappings(oldMappings: any, thresholds?: ThresholdsConfig): ValueMapping[] | undefined { function upgradeValueMappings(oldMappings: any, thresholds?: ThresholdsConfig): ValueMapping[] | undefined {
if (!oldMappings) { if (!oldMappings) {
return undefined; return undefined;
} }
const valueMaps: ValueMap = { type: MappingType.ValueToText, options: {} }; const valueMaps: ValueMap = { type: MappingType.ValueToText, options: {} };
const newMappings: ValueMapping[] = []; const newMappings: ValueMapping[] = [];
skipping to change at line 985 skipping to change at line 1039
function migrateTooltipOptions(panel: PanelModel) { function migrateTooltipOptions(panel: PanelModel) {
if (panel.type === 'timeseries' || panel.type === 'xychart') { if (panel.type === 'timeseries' || panel.type === 'xychart') {
if (panel.options.tooltipOptions) { if (panel.options.tooltipOptions) {
panel.options = { panel.options = {
...panel.options, ...panel.options,
tooltip: panel.options.tooltipOptions, tooltip: panel.options.tooltipOptions,
}; };
delete panel.options.tooltipOptions; delete panel.options.tooltipOptions;
} }
} }
return panel;
} }
 End of changes. 44 change blocks. 
18 lines changed or deleted 74 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)