mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elasticsearch: Fix ad-hoc filter support for Raw Data query and new table panel (#28064)
This commit is contained in:
@@ -580,6 +580,9 @@ const createEmptyDataFrame = (
|
|||||||
const series = new MutableDataFrame({ fields: [] });
|
const series = new MutableDataFrame({ fields: [] });
|
||||||
|
|
||||||
series.addField({
|
series.addField({
|
||||||
|
config: {
|
||||||
|
filterable: true,
|
||||||
|
},
|
||||||
name: timeField,
|
name: timeField,
|
||||||
type: FieldType.time,
|
type: FieldType.time,
|
||||||
});
|
});
|
||||||
@@ -615,6 +618,9 @@ const createEmptyDataFrame = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
series.addField({
|
series.addField({
|
||||||
|
config: {
|
||||||
|
filterable: true,
|
||||||
|
},
|
||||||
name: propName,
|
name: propName,
|
||||||
type: FieldType.string,
|
type: FieldType.string,
|
||||||
}).parse = (v: any) => {
|
}).parse = (v: any) => {
|
||||||
|
@@ -1152,6 +1152,47 @@ describe('ElasticResponse', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Raw Data Query', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
targets = [
|
||||||
|
{
|
||||||
|
refId: 'A',
|
||||||
|
metrics: [{ type: 'raw_data', id: '1' }],
|
||||||
|
bucketAggs: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
response = {
|
||||||
|
responses: [
|
||||||
|
{
|
||||||
|
hits: {
|
||||||
|
total: {
|
||||||
|
relation: 'eq',
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
hits: [
|
||||||
|
{
|
||||||
|
_id: '1',
|
||||||
|
_type: '_doc',
|
||||||
|
_index: 'index',
|
||||||
|
_source: { sourceProp: 'asd' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
result = new ElasticResponse(targets, response).getTimeSeries();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create dataframes with filterable fields', () => {
|
||||||
|
for (const field of result.data[0].fields) {
|
||||||
|
expect(field.config.filterable).toBe(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('simple logs query and count', () => {
|
describe('simple logs query and count', () => {
|
||||||
const targets: any = [
|
const targets: any = [
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user