mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
Filter by value: respect field config coming from the datasource (#32428)
* Make sure field config is preserved when filtering values and state of the field recalcualted * Tests update
This commit is contained in:
parent
3fcff2555a
commit
79dafe17a9
@ -56,15 +56,13 @@ describe('FilterByValue transformer', () => {
|
||||
name: 'time',
|
||||
type: FieldType.time,
|
||||
values: new ArrayVector([6000, 7000]),
|
||||
state: { displayName: 'time' },
|
||||
config: {},
|
||||
state: {},
|
||||
},
|
||||
{
|
||||
name: 'numbers',
|
||||
type: FieldType.number,
|
||||
values: new ArrayVector([6, 7]),
|
||||
state: { displayName: 'numbers' },
|
||||
config: {},
|
||||
state: {},
|
||||
},
|
||||
]);
|
||||
});
|
||||
@ -99,15 +97,13 @@ describe('FilterByValue transformer', () => {
|
||||
name: 'time',
|
||||
type: FieldType.time,
|
||||
values: new ArrayVector([1000, 2000, 3000, 4000, 5000]),
|
||||
state: { displayName: 'time' },
|
||||
config: {},
|
||||
state: {},
|
||||
},
|
||||
{
|
||||
name: 'numbers',
|
||||
type: FieldType.number,
|
||||
values: new ArrayVector([1, 2, 3, 4, 5]),
|
||||
state: { displayName: 'numbers' },
|
||||
config: {},
|
||||
state: {},
|
||||
},
|
||||
]);
|
||||
});
|
||||
@ -151,15 +147,13 @@ describe('FilterByValue transformer', () => {
|
||||
name: 'time',
|
||||
type: FieldType.time,
|
||||
values: new ArrayVector([1000, 2000, 3000, 4000, 7000]),
|
||||
state: { displayName: 'time' },
|
||||
config: {},
|
||||
state: {},
|
||||
},
|
||||
{
|
||||
name: 'numbers',
|
||||
type: FieldType.number,
|
||||
values: new ArrayVector([1, 2, 3, 4, 7]),
|
||||
state: { displayName: 'numbers' },
|
||||
config: {},
|
||||
state: {},
|
||||
},
|
||||
]);
|
||||
});
|
||||
@ -203,15 +197,13 @@ describe('FilterByValue transformer', () => {
|
||||
name: 'time',
|
||||
type: FieldType.time,
|
||||
values: new ArrayVector([4000, 5000]),
|
||||
state: { displayName: 'time' },
|
||||
config: {},
|
||||
state: {},
|
||||
},
|
||||
{
|
||||
name: 'numbers',
|
||||
type: FieldType.number,
|
||||
values: new ArrayVector([4, 5]),
|
||||
state: { displayName: 'numbers' },
|
||||
config: {},
|
||||
state: {},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
@ -110,11 +110,11 @@ export const filterByValueTransformer: DataTransformerInfo<FilterByValueTransfor
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: what parts needs to be excluded from field.
|
||||
// We keep field config, but clean the state as it's being recalculated when the field overrides are applied
|
||||
fields.push({
|
||||
...field,
|
||||
values: new ArrayVector(buffer),
|
||||
config: {},
|
||||
state: {},
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user