Add regex support to template query
This allows us to use the regex feature to extract a substring result from a variable template query. Change-Id: If8a8fe4052f18cd37f4b90ba2eb9fc94e19b07ea
This commit is contained in:
@@ -32,6 +32,7 @@ class Query(Base):
|
||||
default=1): v.All(int, v.Range(min=0, max=2)),
|
||||
v.Optional('datasource'): v.All(str),
|
||||
v.Optional('hide'): v.All(int, v.Range(min=0, max=2)),
|
||||
v.Optional('regex'): v.All(str),
|
||||
}
|
||||
query.update(self.base)
|
||||
return v.Schema(query)
|
||||
|
@@ -47,6 +47,15 @@
|
||||
"refresh": 2,
|
||||
"type": "query"
|
||||
},
|
||||
{
|
||||
"includeAll": false,
|
||||
"multi": false,
|
||||
"name": "test_query_regex",
|
||||
"query": "*",
|
||||
"refresh": 2,
|
||||
"regex": "/.*?-foo-(.*)/",
|
||||
"type": "query"
|
||||
},
|
||||
{
|
||||
"current": {
|
||||
"text": "undercloud",
|
||||
|
@@ -7,6 +7,11 @@ dashboard:
|
||||
type: query
|
||||
query: "*"
|
||||
refresh: 2
|
||||
- name: test_query_regex
|
||||
type: query
|
||||
query: "*"
|
||||
refresh: 2
|
||||
regex: "/.*?-foo-(.*)/"
|
||||
- name: test_custom_1
|
||||
type: custom
|
||||
options:
|
||||
|
Reference in New Issue
Block a user