Fix filter by tag
This commit is contained in:
1 parent
ed0aa8ae7a
commit
559aa0fd36
4 files changed
+17
-21
No files matched your search
+1
-2
@@ -135,8 +135,7 @@ export async function seed(options): Promise<void> {
|
||||
{ _id: "ui.filters.1.parameter", value: "DeviceID.ProductClass" },
|
||||
{ _id: "ui.filters.1.type", value: "'string'" },
|
||||
{ _id: "ui.filters.2.label", value: "'Tag'" },
|
||||
{ _id: "ui.filters.2.parameter", value: "tag" },
|
||||
{ _id: "ui.filters.2.type", value: "'string'" }
|
||||
{ _id: "ui.filters.2.type", value: "'tag'" }
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ export function processDeviceFilter(filter): Expression {
|
||||
else if (p === "DeviceID") return ["PARAM", "_deviceId"];
|
||||
else if (p.startsWith("DeviceID."))
|
||||
return ["PARAM", "_deviceId._" + p.slice(9)];
|
||||
else if (p === "Tags") return ["PARAM", "_tags"];
|
||||
else if (p === "tag") return ["PARAM", "_tags"];
|
||||
else if (p === "Events.Inform") return ["PARAM", "_lastInform"];
|
||||
else if (p === "Events.Registered") return ["PARAM", "_registered"];
|
||||
else if (p === "Events.0_BOOTSTRAP") return ["PARAM", "_lastBootstrap"];
|
||||
@@ -50,6 +48,8 @@ export function processDeviceFilter(filter): Expression {
|
||||
else if (exp[0] === "IS NOT NULL") return ["=", ["PARAM", "_tags"], t];
|
||||
else if (exp[0] === "=" && exp[2] === true)
|
||||
return ["=", ["PARAM", "_tags"], t];
|
||||
else if (exp[0] === "<>" && exp[2] !== true)
|
||||
return ["=", ["PARAM", "_tags"], t];
|
||||
} else if (
|
||||
["=", "<>", ">", ">=", "<", "<=", "LIKE", "NOT LIKE"].includes(exp[0])
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user