(prevQuery: Query, tag: EventTag)
| 197 | } |
| 198 | |
| 199 | export function generateQueryWithTag(prevQuery: Query, tag: EventTag): Query { |
| 200 | const query = {...prevQuery}; |
| 201 | |
| 202 | // some tags are dedicated query strings since other parts of the app consumes this, |
| 203 | // for example, the global selection header. |
| 204 | switch (tag.key) { |
| 205 | case 'environment': |
| 206 | query.environment = tag.value; |
| 207 | break; |
| 208 | case 'project': |
| 209 | query.project = tag.value; |
| 210 | break; |
| 211 | default: |
| 212 | query.query = appendTagCondition(query.query, tag.key, tag.value); |
| 213 | } |
| 214 | |
| 215 | // Checking for the absence of a tag value. |
| 216 | if (tag.value === '') { |
| 217 | query.query = `!has:${tag.key}`; |
| 218 | } |
| 219 | |
| 220 | return query; |
| 221 | } |
no test coverage detected