mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Added support for "or" statements in line filters (#78705)
* Lezer: upgrade to 0.2.2 * Operations: update definitions * Operations: update renderer * Parsing: parse line filters with or operations * Parsing: add unit test * Formatting * getHighlighterExpressionsFromQuery: add support for or statements * Operation editor: trim button title if param name is empty * getHighlighterExpressionsFromQuery: properly handle ip filters
This commit is contained in:
@@ -171,6 +171,26 @@ describe('buildVisualQueryFromString', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['|=', LokiOperationId.LineContains],
|
||||
['!=', LokiOperationId.LineContainsNot],
|
||||
['|~', LokiOperationId.LineMatchesRegex],
|
||||
['!~', LokiOperationId.LineMatchesRegexNot],
|
||||
])('parses query with line filter and `or` statements', (op: string, id: LokiOperationId) => {
|
||||
expect(buildVisualQueryFromString(`{app="frontend"} ${op} "line" or "text"`)).toEqual(
|
||||
noErrors({
|
||||
labels: [
|
||||
{
|
||||
op: '=',
|
||||
value: 'frontend',
|
||||
label: 'app',
|
||||
},
|
||||
],
|
||||
operations: [{ id, params: ['line', 'text'] }],
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('parses query with line filters and escaped characters', () => {
|
||||
expect(buildVisualQueryFromString('{app="frontend"} |= "\\\\line"')).toEqual(
|
||||
noErrors({
|
||||
|
||||
Reference in New Issue
Block a user