Various small fixes, add indication of which tags are added for power users

This commit is contained in:
Pieter Vander Vennet 2020-08-22 17:33:08 +02:00
parent a55767c1e9
commit 47d755e59f
9 changed files with 147 additions and 59 deletions

View file

@ -7,6 +7,8 @@ export abstract class TagsFilter {
matchesProperties(properties: any) : boolean{
return this.matches(TagUtils.proprtiesToKV(properties));
}
abstract asHumanString();
}
@ -51,6 +53,10 @@ export class Regex extends TagsFilter {
substituteValues(tags: any) : TagsFilter{
throw "Substituting values is not supported on regex tags"
}
asHumanString() {
return this._k+"~="+this._r;
}
}
@ -143,6 +149,10 @@ export class Tag extends TagsFilter {
return new Tag(this.key, TagUtils.ApplyTemplate(this.value as string, tags));
}
asHumanString() {
return this.key+"="+this.value;
}
}
@ -190,6 +200,10 @@ export class Or extends TagsFilter {
}
return new Or(newChoices);
}
asHumanString() {
return this.or.map(t => t.asHumanString()).join("|");
}
}
@ -247,6 +261,10 @@ export class And extends TagsFilter {
}
return new And(newChoices);
}
asHumanString() {
return this.and.map(t => t.asHumanString()).join("&");
}
}
@ -269,6 +287,10 @@ export class Not extends TagsFilter{
substituteValues(tags: any): TagsFilter {
return new Not(this.not.substituteValues(tags));
}
asHumanString() {
return "!"+this.not.asHumanString();
}
}