mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Old Graph migration: Preserve null values settings (#49493)
* Graph migration: Preserve null values settings * Review
This commit is contained in:
parent
a67add5239
commit
30880e6e18
@ -12,7 +12,7 @@ Object {
|
|||||||
"lineInterpolation": "stepAfter",
|
"lineInterpolation": "stepAfter",
|
||||||
"lineWidth": 5,
|
"lineWidth": 5,
|
||||||
"showPoints": "never",
|
"showPoints": "never",
|
||||||
"spanNulls": true,
|
"spanNulls": false,
|
||||||
},
|
},
|
||||||
"nullValueMode": "null",
|
"nullValueMode": "null",
|
||||||
"unit": "short",
|
"unit": "short",
|
||||||
@ -120,7 +120,7 @@ Object {
|
|||||||
"lineInterpolation": "stepAfter",
|
"lineInterpolation": "stepAfter",
|
||||||
"lineWidth": 1,
|
"lineWidth": 1,
|
||||||
"showPoints": "never",
|
"showPoints": "never",
|
||||||
"spanNulls": true,
|
"spanNulls": false,
|
||||||
},
|
},
|
||||||
"nullValueMode": "null",
|
"nullValueMode": "null",
|
||||||
"unit": "short",
|
"unit": "short",
|
||||||
@ -176,7 +176,7 @@ Object {
|
|||||||
"lineInterpolation": "stepAfter",
|
"lineInterpolation": "stepAfter",
|
||||||
"lineWidth": 1,
|
"lineWidth": 1,
|
||||||
"showPoints": "never",
|
"showPoints": "never",
|
||||||
"spanNulls": true,
|
"spanNulls": false,
|
||||||
},
|
},
|
||||||
"nullValueMode": "null",
|
"nullValueMode": "null",
|
||||||
"unit": "short",
|
"unit": "short",
|
||||||
@ -259,7 +259,7 @@ Object {
|
|||||||
"lineInterpolation": "stepAfter",
|
"lineInterpolation": "stepAfter",
|
||||||
"lineWidth": 5,
|
"lineWidth": 5,
|
||||||
"showPoints": "never",
|
"showPoints": "never",
|
||||||
"spanNulls": true,
|
"spanNulls": false,
|
||||||
"stacking": Object {
|
"stacking": Object {
|
||||||
"group": "A",
|
"group": "A",
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
@ -346,7 +346,7 @@ Object {
|
|||||||
"lineInterpolation": "stepAfter",
|
"lineInterpolation": "stepAfter",
|
||||||
"lineWidth": 5,
|
"lineWidth": 5,
|
||||||
"showPoints": "never",
|
"showPoints": "never",
|
||||||
"spanNulls": true,
|
"spanNulls": false,
|
||||||
"stacking": Object {
|
"stacking": Object {
|
||||||
"group": "A",
|
"group": "A",
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
@ -404,7 +404,7 @@ Object {
|
|||||||
"lineInterpolation": "stepAfter",
|
"lineInterpolation": "stepAfter",
|
||||||
"lineWidth": 1,
|
"lineWidth": 1,
|
||||||
"showPoints": "never",
|
"showPoints": "never",
|
||||||
"spanNulls": true,
|
"spanNulls": false,
|
||||||
},
|
},
|
||||||
"displayName": "DISPLAY NAME",
|
"displayName": "DISPLAY NAME",
|
||||||
"nullValueMode": "null",
|
"nullValueMode": "null",
|
||||||
@ -444,7 +444,7 @@ Object {
|
|||||||
"lineInterpolation": "stepAfter",
|
"lineInterpolation": "stepAfter",
|
||||||
"lineWidth": 5,
|
"lineWidth": 5,
|
||||||
"showPoints": "never",
|
"showPoints": "never",
|
||||||
"spanNulls": true,
|
"spanNulls": false,
|
||||||
},
|
},
|
||||||
"nullValueMode": "null",
|
"nullValueMode": "null",
|
||||||
"unit": "short",
|
"unit": "short",
|
||||||
@ -554,7 +554,7 @@ Object {
|
|||||||
"type": "log",
|
"type": "log",
|
||||||
},
|
},
|
||||||
"showPoints": "never",
|
"showPoints": "never",
|
||||||
"spanNulls": true,
|
"spanNulls": false,
|
||||||
},
|
},
|
||||||
"decimals": 3,
|
"decimals": 3,
|
||||||
"max": 1000,
|
"max": 1000,
|
||||||
|
@ -426,6 +426,29 @@ describe('Graph Migrations', () => {
|
|||||||
expect(panel.fieldConfig).toMatchSnapshot();
|
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 = {
|
const customColor = {
|
||||||
|
@ -296,7 +296,7 @@ export function flotToGraphOptions(angular: any): { fieldConfig: FieldConfigSour
|
|||||||
graph.fillOpacity = angular.fillGradient * 10; // fill is 0-10
|
graph.fillOpacity = angular.fillGradient * 10; // fill is 0-10
|
||||||
}
|
}
|
||||||
|
|
||||||
graph.spanNulls = angular.nullPointMode === NullValueMode.Null;
|
graph.spanNulls = angular.nullPointMode === NullValueMode.Ignore;
|
||||||
|
|
||||||
if (angular.steppedLine) {
|
if (angular.steppedLine) {
|
||||||
graph.lineInterpolation = LineInterpolation.StepAfter;
|
graph.lineInterpolation = LineInterpolation.StepAfter;
|
||||||
|
Loading…
Reference in New Issue
Block a user