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:
Matias Chomicki
2023-11-29 15:58:32 +01:00
committed by GitHub
parent 687ffb4a0c
commit 773e0680c5
10 changed files with 108 additions and 51 deletions

View File

@@ -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({