mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
grafana/data: Deprecate kbn.regexEscape and move to grafana/data (#60869)
grafana/data: Deprecate kbn.regexEscape and move escapeRegex to grafana/data
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { map, find, filter, indexOf } from 'lodash';
|
||||
|
||||
import { ScopedVars } from '@grafana/data';
|
||||
import { escapeRegex, ScopedVars } from '@grafana/data';
|
||||
import { TemplateSrv } from '@grafana/runtime';
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
|
||||
import queryPart from './query_part';
|
||||
import { InfluxQuery, InfluxQueryTag } from './types';
|
||||
@@ -201,10 +200,10 @@ export default class InfluxQueryModel {
|
||||
}
|
||||
|
||||
if (typeof value === 'string') {
|
||||
return kbn.regexEscape(value);
|
||||
return escapeRegex(value);
|
||||
}
|
||||
|
||||
const escapedValues = map(value, kbn.regexEscape);
|
||||
const escapedValues = map(value, escapeRegex);
|
||||
return '(' + escapedValues.join('|') + ')';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { reduce } from 'lodash';
|
||||
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
import { escapeRegex } from '@grafana/data';
|
||||
|
||||
function renderTagCondition(tag: { operator: any; value: string; condition: any; key: string }, index: number) {
|
||||
// FIXME: merge this function with influx_query_model/renderTagCondition
|
||||
@@ -48,7 +48,7 @@ export class InfluxQueryBuilder {
|
||||
query = 'SHOW MEASUREMENTS';
|
||||
if (withMeasurementFilter) {
|
||||
// we do a case-insensitive regex-based lookup
|
||||
query += ' WITH MEASUREMENT =~ /(?i)' + kbn.regexEscape(withMeasurementFilter) + '/';
|
||||
query += ' WITH MEASUREMENT =~ /(?i)' + escapeRegex(withMeasurementFilter) + '/';
|
||||
}
|
||||
} else if (type === 'FIELDS') {
|
||||
measurement = this.target.measurement;
|
||||
|
||||
Reference in New Issue
Block a user