A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Enhancement (QoL): allow independently toggling child + parent tags in WF tag fields (#14400)
shamoona4003df7e831
diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.htmlindex 1a4592183..d10194138 100644--- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html+++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html@@ -209,6 +209,7 @@@if (isTagsFilter(filter.get('type').value)) {<pngx-input-tags[allowCreate]="false"+ [preserveHierarchy]="false"[title]="null"formControlName="values"></pngx-input-tags>@@ -320,7 +321,7 @@<h6 class="form-label" i18n>Remove tags</h6><pngx-input-switch i18n-title title="Remove all" [horizontal]="true" formControlName="remove_all_tags"></pngx-input-switch><div class="mt-n3">- <pngx-input-tags [allowCreate]="false" title="" formControlName="remove_tags"></pngx-input-tags>+ <pngx-input-tags [allowCreate]="false" [preserveHierarchy]="false" title="" formControlName="remove_tags"></pngx-input-tags></div><h6 class="form-label" i18n>Remove correspondents</h6>diff --git a/src-ui/src/app/components/common/input/tags/tags.component.spec.ts b/src-ui/src/app/components/common/input/tags/tags.component.spec.tsindex b252cecb1..728713dd7 100644--- a/src-ui/src/app/components/common/input/tags/tags.component.spec.ts+++ b/src-ui/src/app/components/common/input/tags/tags.component.spec.ts@@ -222,6 +222,22 @@ describe('TagsComponent', () => {expect(propagated).toEqual([2, 1])})+ it('should not add parents or remove children when not preserving hierarchy', () => {+ const parent: Tag = { id: 1, name: 'parent' }+ const child: Tag = { id: 2, name: 'child', parent: 1 }+ parent.children = [child]+ component.tags = [parent, child]+ component.preserveHierarchy = false++ component.value = []+ component.addTag(2)+ expect(component.value).toEqual([2])++ component.value = [1, 2]+ component.removeTag(1)+ expect(component.value).toEqual([2])+ })+it('should not duplicate parents when adding sibling nested tags', () => {const root: Tag = { id: 1, name: 'root' }const parent: Tag = { id: 2, name: 'parent', parent: 1 }diff --git a/src-ui/src/app/components/common/input/tags/tags.component.ts b/src-ui/src/app/components/common/input/tags/tags.component.tsindex 20a489841..1410db99b 100644--- a/src-ui/src/app/components/common/input/tags/tags.component.ts+++ b/src-ui/src/app/components/common/input/tags/tags.component.ts@@ -109,6 +109,9 @@ export class TagsComponent implements OnInit, ControlValueAccessor {@Input()multiple: boolean = true+ @Input()+ preserveHierarchy: boolean = true+@Output()filterDocuments = new EventEmitter<Tag[]>()@@ -148,7 +151,9 @@ export class TagsComponent implements OnInit, ControlValueAccessor {oldValue.splice(index, 1)// remove children- oldValue = this.removeChildren(oldValue, tag)+ if (this.preserveHierarchy) {+ oldValue = this.removeChildren(oldValue, tag)+ }this.value = [...oldValue]this.onChange(this.value)@@ -167,7 +172,7 @@ export class TagsComponent implements OnInit, ControlValueAccessor {}public onAdd(tag: Tag) {- if (tag?.parent) {+ if (this.preserveHierarchy && tag?.parent) {// add all parents recursivelyconst parent = this.getTag(tag.parent)if (parent && !this.value.includes(parent.id)) {