From 565064b44157c31a469ab84f92f3b67dc876996a Mon Sep 17 00:00:00 2001 From: gitgiggety <79809426+gitgiggety@users.noreply.github.com> Date: Sat, 11 Sep 2021 02:01:57 +0200 Subject: [PATCH] Make IHierarchicalLabeledIdCriterion backwards compatible (#1716) Add some form of backwards compatibility in the UI for `IHierarchicalLabeledIdCriterion`. With this backwards compatibility it's possible to recall saved filters which use the tags filter. Otherwise stuff would blow up because the saved filter has a different structure than what the `IHierarchicalLabeledIdCriterion` expects. --- .../src/models/list-filter/criteria/criterion.ts | 13 +++++++++++++ ui/v2.5/src/models/list-filter/filter.ts | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/models/list-filter/criteria/criterion.ts b/ui/v2.5/src/models/list-filter/criteria/criterion.ts index 26d2cac03..69e36523b 100644 --- a/ui/v2.5/src/models/list-filter/criteria/criterion.ts +++ b/ui/v2.5/src/models/list-filter/criteria/criterion.ts @@ -99,6 +99,10 @@ export abstract class Criterion { return this.value; } + public decodeValue(value: V) { + this.value = value; + } + public toJSON() { const encodedCriterion = { type: this.criterionOption.type, @@ -411,6 +415,15 @@ export class IHierarchicalLabeledIdCriterion extends Criterion v.id), diff --git a/ui/v2.5/src/models/list-filter/filter.ts b/ui/v2.5/src/models/list-filter/filter.ts index 809529422..b59fcb57b 100644 --- a/ui/v2.5/src/models/list-filter/filter.ts +++ b/ui/v2.5/src/models/list-filter/filter.ts @@ -116,7 +116,7 @@ export class ListFilterModel { const criterion = makeCriteria(encodedCriterion.type); // it's possible that we have unsupported criteria. Just skip if so. if (criterion) { - criterion.value = encodedCriterion.value; + criterion.decodeValue(encodedCriterion.value); criterion.modifier = encodedCriterion.modifier; this.criteria.push(criterion); }