DataFrame: move labels to field (#19926)

This commit is contained in:
Ryan McKinley
2019-11-07 07:50:45 -08:00
committed by GitHub
parent e487c68156
commit 818aa8eefa
22 changed files with 243 additions and 135 deletions

View File

@@ -128,7 +128,7 @@ describe('DashboardModel', () => {
});
it('dashboard schema version should be set to latest', () => {
expect(model.schemaVersion).toBe(20);
expect(model.schemaVersion).toBe(21);
});
it('graph thresholds should be migrated', () => {
@@ -506,6 +506,51 @@ describe('DashboardModel', () => {
});
});
});
describe('when migrating labels from DataFrame to Field', () => {
let model: any;
beforeEach(() => {
model = new DashboardModel({
panels: [
{
//graph panel
options: {
dataLinks: [
{
url: 'http://mylink.com?series=${__series.labels}&${__series.labels.a}',
},
],
},
},
{
// panel with field options
options: {
fieldOptions: {
defaults: {
links: [
{
url: 'http://mylink.com?series=${__series.labels}&${__series.labels.x}',
},
],
},
},
},
},
],
});
});
describe('data links', () => {
it('should replace __series.label variable with __field.label', () => {
expect(model.panels[0].options.dataLinks[0].url).toBe(
'http://mylink.com?series=${__field.labels}&${__field.labels.a}'
);
expect(model.panels[1].options.fieldOptions.defaults.links[0].url).toBe(
'http://mylink.com?series=${__field.labels}&${__field.labels.x}'
);
});
});
});
});
function createRow(options: any, panelDescriptions: any[]) {