mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DataFrame: move labels to field (#19926)
This commit is contained in:
@@ -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[]) {
|
||||
|
||||
Reference in New Issue
Block a user