Support Unicode characters in tags
This commit is contained in:
1 parent
dfab724515
commit
c52ff6f6ec
7 files changed
+48
-40
No files matched your search
@@ -22,6 +22,7 @@ import { m } from "../components";
|
||||
import * as notifications from "../notifications";
|
||||
import * as store from "../store";
|
||||
import { getIcon } from "../icons";
|
||||
import { decodeTag } from "../../lib/common";
|
||||
|
||||
const component: ClosureComponent = (): Component => {
|
||||
return {
|
||||
@@ -32,7 +33,7 @@ const component: ClosureComponent = (): Component => {
|
||||
|
||||
const tags = [];
|
||||
for (const p of Object.keys(device))
|
||||
if (p.startsWith("Tags.")) tags.push(p.slice(5));
|
||||
if (p.startsWith("Tags.")) tags.push(decodeTag(p.slice(5)));
|
||||
|
||||
tags.sort();
|
||||
|
||||
|
||||
+2
-1
@@ -19,6 +19,7 @@
|
||||
|
||||
import config from "./config";
|
||||
import { Expression } from "../lib/types";
|
||||
import { encodeTag } from "../lib/common";
|
||||
|
||||
const resources = {
|
||||
devices: {},
|
||||
@@ -138,7 +139,7 @@ function queryMac(param, value): Expression {
|
||||
}
|
||||
|
||||
function queryTag(tag: string): Expression {
|
||||
const t = tag.replace(/[^a-zA-Z0-9-]+/g, "_");
|
||||
const t = encodeTag(tag);
|
||||
return ["IS NOT NULL", ["PARAM", `Tags.${t}`]];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user