Fix item tag filter, #1594

This commit is contained in:
Alexander Zobnin
2023-03-23 14:40:22 +01:00
parent fc1d809dc1
commit 24285a9483
4 changed files with 39 additions and 20 deletions

View File

@@ -433,10 +433,12 @@ export function parseTags(tagStr: string): any[] {
// Parses string representation of tag into the object
export function parseItemTag(tagStr: string): ZBXItemTag {
const itemTag: ZBXItemTag = { tag: '', value: '' };
const tagParts = tagStr.split(': ');
itemTag.tag = tagParts[0];
if (tagParts[1]) {
itemTag.value = tagParts[1];
const firstIdx = tagStr.indexOf(':');
if (firstIdx > 0) {
itemTag.tag = tagStr.slice(0, firstIdx).trim();
itemTag.value = tagStr.slice(Math.min(firstIdx + 1, tagStr.length)).trim();
} else {
itemTag.tag = tagStr.trim();
}
return itemTag;
}