mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki/Elastic: Assert queryfix value to always be string (#81349)
Fix `value` can be `string` or `number`
This commit is contained in:
parent
2b59db7b41
commit
ca5c297bfa
@ -205,13 +205,13 @@ export class Explore extends React.PureComponent<Props, ExploreState> {
|
|||||||
* TODO: In the future, we would like to return active filters based the query that produced the log line.
|
* TODO: In the future, we would like to return active filters based the query that produced the log line.
|
||||||
* @alpha
|
* @alpha
|
||||||
*/
|
*/
|
||||||
isFilterLabelActive = async (key: string, value: string, refId?: string) => {
|
isFilterLabelActive = async (key: string, value: string | number, refId?: string) => {
|
||||||
const query = this.props.queries.find((q) => q.refId === refId);
|
const query = this.props.queries.find((q) => q.refId === refId);
|
||||||
if (!query) {
|
if (!query) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const ds = await getDataSourceSrv().get(query.datasource);
|
const ds = await getDataSourceSrv().get(query.datasource);
|
||||||
if (hasToggleableQueryFiltersSupport(ds) && ds.queryHasFilter(query, { key, value })) {
|
if (hasToggleableQueryFiltersSupport(ds) && ds.queryHasFilter(query, { key, value: value.toString() })) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -220,11 +220,11 @@ export class Explore extends React.PureComponent<Props, ExploreState> {
|
|||||||
/**
|
/**
|
||||||
* Used by Logs details.
|
* Used by Logs details.
|
||||||
*/
|
*/
|
||||||
onClickFilterLabel = (key: string, value: string, frame?: DataFrame) => {
|
onClickFilterLabel = (key: string, value: string | number, frame?: DataFrame) => {
|
||||||
this.onModifyQueries(
|
this.onModifyQueries(
|
||||||
{
|
{
|
||||||
type: 'ADD_FILTER',
|
type: 'ADD_FILTER',
|
||||||
options: { key, value },
|
options: { key, value: value.toString() },
|
||||||
frame,
|
frame,
|
||||||
},
|
},
|
||||||
frame?.refId
|
frame?.refId
|
||||||
@ -234,11 +234,11 @@ export class Explore extends React.PureComponent<Props, ExploreState> {
|
|||||||
/**
|
/**
|
||||||
* Used by Logs details.
|
* Used by Logs details.
|
||||||
*/
|
*/
|
||||||
onClickFilterOutLabel = (key: string, value: string, frame?: DataFrame) => {
|
onClickFilterOutLabel = (key: string, value: string | number, frame?: DataFrame) => {
|
||||||
this.onModifyQueries(
|
this.onModifyQueries(
|
||||||
{
|
{
|
||||||
type: 'ADD_FILTER_OUT',
|
type: 'ADD_FILTER_OUT',
|
||||||
options: { key, value },
|
options: { key, value: value.toString() },
|
||||||
frame,
|
frame,
|
||||||
},
|
},
|
||||||
frame?.refId
|
frame?.refId
|
||||||
@ -248,15 +248,15 @@ export class Explore extends React.PureComponent<Props, ExploreState> {
|
|||||||
/**
|
/**
|
||||||
* Used by Logs Popover Menu.
|
* Used by Logs Popover Menu.
|
||||||
*/
|
*/
|
||||||
onClickFilterValue = (value: string, refId?: string) => {
|
onClickFilterValue = (value: string | number, refId?: string) => {
|
||||||
this.onModifyQueries({ type: 'ADD_STRING_FILTER', options: { value } }, refId);
|
this.onModifyQueries({ type: 'ADD_STRING_FILTER', options: { value: value.toString() } }, refId);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by Logs Popover Menu.
|
* Used by Logs Popover Menu.
|
||||||
*/
|
*/
|
||||||
onClickFilterOutValue = (value: string, refId?: string) => {
|
onClickFilterOutValue = (value: string | number, refId?: string) => {
|
||||||
this.onModifyQueries({ type: 'ADD_STRING_FILTER_OUT', options: { value } }, refId);
|
this.onModifyQueries({ type: 'ADD_STRING_FILTER_OUT', options: { value: value.toString() } }, refId);
|
||||||
};
|
};
|
||||||
|
|
||||||
onClickAddQueryRowButton = () => {
|
onClickAddQueryRowButton = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user