Explore: Support custom display label for derived fields buttons for Loki datasource (#37273)

This commit is contained in:
Connor Lindsey
2021-07-29 12:42:20 -06:00
committed by GitHub
parent aa904a5a04
commit c4c28a5b63
10 changed files with 66 additions and 31 deletions

View File

@@ -3,6 +3,7 @@ import { Observable, of, throwError } from 'rxjs';
import {
ArrayVector,
CoreApp,
DataLink,
DataQueryRequest,
DataSourceInstanceSettings,
DataSourcePluginMeta,
@@ -255,14 +256,16 @@ describe('ElasticDatasource', function (this: any) {
{
field: 'host',
url: 'http://localhost:3000/${__value.raw}',
urlDisplayLabel: 'Custom Label',
},
],
});
expect(response.data.length).toBe(1);
const links = response.data[0].fields.find((field: Field) => field.name === 'host').config.links;
const links: DataLink[] = response.data[0].fields.find((field: Field) => field.name === 'host').config.links;
expect(links.length).toBe(1);
expect(links[0].url).toBe('http://localhost:3000/${__value.raw}');
expect(links[0].title).toBe('Custom Label');
});
});