Skip to content

Commit 02cc89f

Browse files
committed
Use allow-utf8-labelnames client capability in UI
1 parent 55810eb commit 02cc89f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

public/app/components/TagsBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function LabelsSubmenu({
230230

231231
// Identifies whether a label is in a query or not
232232
function isLabelInQuery(query: string, label: string, labelValue: string) {
233-
return query.includes(`${label}="${labelValue}"`);
233+
return query.includes(`"${label}"="${labelValue}"`);
234234
}
235235

236236
export default TagsBar;

public/app/services/base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export async function request(
3232
headers = {
3333
...config?.headers,
3434
...(tenantID && { 'X-Scope-OrgID': tenantID }),
35+
// Specify client capabilities in `Accept` header
36+
Accept: 'application/json;allow-utf8-labelnames=true',
3537
};
3638
}
3739

@@ -53,6 +55,8 @@ export async function downloadWithOrgID(
5355
headers = {
5456
...config?.headers,
5557
...(tenantID && { 'X-Scope-OrgID': tenantID }),
58+
// Specify client capabilities in `Accept` header
59+
Accept: 'application/json;allow-utf8-labelnames=true',
5660
};
5761
}
5862

public/app/util/query.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ export function appendLabelToQuery(
55
) {
66
const case1Regexp = new RegExp(`${label}=.+?(\\}|,)`);
77
if (query.match(case1Regexp)) {
8-
return query.replace(case1Regexp, `${label}="${labelValue}"$1`);
8+
return query.replace(case1Regexp, `"${label}"="${labelValue}"$1`);
99
}
1010
if (query.indexOf('{}') !== -1) {
11-
return query.replace('}', `${label}="${labelValue}"}`);
11+
return query.replace('}', `"${label}"="${labelValue}"}`);
1212
}
1313
if (query.indexOf('}') !== -1) {
14-
return query.replace('}', `, ${label}="${labelValue}"}`);
14+
return query.replace('}', `, "${label}"="${labelValue}"}`);
1515
}
1616

1717
console.warn('TODO: handle this case');

0 commit comments

Comments
 (0)