mirror of
https://github.com/grafana/grafana.git
synced 2026-07-29 15:59:50 -05:00
Old Graph migration: Preserve null values settings (#49493)
* Graph migration: Preserve null values settings * Review
This commit is contained in:
@@ -12,7 +12,7 @@ Object {
|
||||
"lineInterpolation": "stepAfter",
|
||||
"lineWidth": 5,
|
||||
"showPoints": "never",
|
||||
"spanNulls": true,
|
||||
"spanNulls": false,
|
||||
},
|
||||
"nullValueMode": "null",
|
||||
"unit": "short",
|
||||
@@ -120,7 +120,7 @@ Object {
|
||||
"lineInterpolation": "stepAfter",
|
||||
"lineWidth": 1,
|
||||
"showPoints": "never",
|
||||
"spanNulls": true,
|
||||
"spanNulls": false,
|
||||
},
|
||||
"nullValueMode": "null",
|
||||
"unit": "short",
|
||||
@@ -176,7 +176,7 @@ Object {
|
||||
"lineInterpolation": "stepAfter",
|
||||
"lineWidth": 1,
|
||||
"showPoints": "never",
|
||||
"spanNulls": true,
|
||||
"spanNulls": false,
|
||||
},
|
||||
"nullValueMode": "null",
|
||||
"unit": "short",
|
||||
@@ -259,7 +259,7 @@ Object {
|
||||
"lineInterpolation": "stepAfter",
|
||||
"lineWidth": 5,
|
||||
"showPoints": "never",
|
||||
"spanNulls": true,
|
||||
"spanNulls": false,
|
||||
"stacking": Object {
|
||||
"group": "A",
|
||||
"mode": "normal",
|
||||
@@ -346,7 +346,7 @@ Object {
|
||||
"lineInterpolation": "stepAfter",
|
||||
"lineWidth": 5,
|
||||
"showPoints": "never",
|
||||
"spanNulls": true,
|
||||
"spanNulls": false,
|
||||
"stacking": Object {
|
||||
"group": "A",
|
||||
"mode": "normal",
|
||||
@@ -404,7 +404,7 @@ Object {
|
||||
"lineInterpolation": "stepAfter",
|
||||
"lineWidth": 1,
|
||||
"showPoints": "never",
|
||||
"spanNulls": true,
|
||||
"spanNulls": false,
|
||||
},
|
||||
"displayName": "DISPLAY NAME",
|
||||
"nullValueMode": "null",
|
||||
@@ -444,7 +444,7 @@ Object {
|
||||
"lineInterpolation": "stepAfter",
|
||||
"lineWidth": 5,
|
||||
"showPoints": "never",
|
||||
"spanNulls": true,
|
||||
"spanNulls": false,
|
||||
},
|
||||
"nullValueMode": "null",
|
||||
"unit": "short",
|
||||
@@ -554,7 +554,7 @@ Object {
|
||||
"type": "log",
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": true,
|
||||
"spanNulls": false,
|
||||
},
|
||||
"decimals": 3,
|
||||
"max": 1000,
|
||||
|
||||
@@ -426,6 +426,29 @@ describe('Graph Migrations', () => {
|
||||
expect(panel.fieldConfig).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('null values', () => {
|
||||
test('nullPointMode = null', () => {
|
||||
const old: any = {
|
||||
angular: {
|
||||
nullPointMode: 'null',
|
||||
},
|
||||
};
|
||||
const panel = {} as PanelModel;
|
||||
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
|
||||
expect(panel.fieldConfig.defaults.custom.spanNulls).toBeFalsy();
|
||||
});
|
||||
test('nullPointMode = connected', () => {
|
||||
const old: any = {
|
||||
angular: {
|
||||
nullPointMode: 'connected',
|
||||
},
|
||||
};
|
||||
const panel = {} as PanelModel;
|
||||
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig);
|
||||
expect(panel.fieldConfig.defaults.custom.spanNulls).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const customColor = {
|
||||
|
||||
@@ -296,7 +296,7 @@ export function flotToGraphOptions(angular: any): { fieldConfig: FieldConfigSour
|
||||
graph.fillOpacity = angular.fillGradient * 10; // fill is 0-10
|
||||
}
|
||||
|
||||
graph.spanNulls = angular.nullPointMode === NullValueMode.Null;
|
||||
graph.spanNulls = angular.nullPointMode === NullValueMode.Ignore;
|
||||
|
||||
if (angular.steppedLine) {
|
||||
graph.lineInterpolation = LineInterpolation.StepAfter;
|
||||
|
||||
Reference in New Issue
Block a user