Logs: Add toggle behavior support for "filter for" and "filter out" label within Logs Details (#70091)

* Datasource test: fix describe nesting

* Parsing: export handleQuotes function

* Modify query: add functions to detect the presence of a label and remove it

* Loki: add support to toggle filters if already present

* Datasource test: fix describe nesting

* Loki: add support to toggle filter out if present

* Remove label: handle escaped values

* Datasource: add test case for escaped label values

* Loki: remove = filter when applying !=

* Remove selector: add support for Selector node being far from Matcher

* Modify query: add unit tests

* Elasticsearch: create modifyQuery for elastic

* Elastic modify query: implement functions

* Elasticsearch: implement modifyQuery functions in datasource

* Elasticsearch: update datasource test

* Loki modify query: check for streamSelectorPositions length

* Elasticsearch query has filter: escape filter value in regex

* Remove unused type

* Modify query: use query modeller instance from module
This commit is contained in:
Matias Chomicki
2023-06-26 16:45:33 +02:00
committed by GitHub
parent 4ff0abd0d1
commit 4c4bd69eb6
9 changed files with 395 additions and 38 deletions

View File

@@ -597,7 +597,7 @@ function isIntervalVariableError(node: SyntaxNode) {
return node?.parent?.type.id === Range;
}
function handleQuotes(string: string) {
export function handleQuotes(string: string) {
if (string[0] === `"` && string[string.length - 1] === `"`) {
return string
.substring(1, string.length - 1)