From 26a70a8398aeda854ba18cad8cd277d283f5e38e Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Tue, 25 Jun 2024 00:25:16 +0300 Subject: [PATCH] RED-8748 - fixed workload annotations filtering, updated default textarea height for component values --- ...-structured-component-value.component.html | 2 +- ...le-structured-component-value.component.ts | 39 ++++++++++++------- .../file-workload.component.html | 9 ++++- .../services/annotation-processing.service.ts | 20 +++++++++- .../type-filter/type-filter.component.html | 4 +- apps/red-ui/src/assets/config/config.json | 10 ++--- libs/common-ui | 2 +- 7 files changed, 60 insertions(+), 26 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/editable-structured-component-value/editable-structured-component-value.component.html b/apps/red-ui/src/app/modules/file-preview/components/editable-structured-component-value/editable-structured-component-value.component.html index a7566a75c..42be825f6 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/editable-structured-component-value/editable-structured-component-value.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/editable-structured-component-value/editable-structured-component-value.component.html @@ -26,7 +26,7 @@
- +
f.label === this.entryLabel); - if (nestedFilter) { - this._filtersService.filterCheckboxClicked({ nestedFilter, filterGroup, primaryFiltersSlug: 'primaryFilters' }); - foundFilter = true; - return; - } - } - if (!foundFilter) { - // console.log('!foundFilter'); - // this._filtersService.filterCheckboxClicked({ nestedFilter: {id: '', checked: true, label: '' }, filterGroup, primaryFiltersSlug: 'primaryFilters' }); + const filterSet = this.#setFilter(this.entryLabel); + if (!filterSet) { + this.#setFilter('no-annotations-filter'); } } + + #setFilter(label: string) { + const filterGroup = this._filtersService.getGroup('primaryFilters'); + for (const filter of filterGroup.filters) { + const nestedFilter = filter.children.find(f => f.label === label); + if (nestedFilter) { + this._filtersService.filterCheckboxClicked({ nestedFilter, filterGroup, primaryFiltersSlug: 'primaryFilters' }); + return true; + } + } + } + + #updateTextAreaHeight() { + setTimeout(() => { + for (let i = 0; i < this.entry.componentValues.length; i++) { + const textArea = document.getElementById(`value-input-${i}`); + textArea.style.height = 'auto'; + textArea.style.height = `${textArea.scrollHeight}px`; + } + }, 10); + } } diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html index 8b898cac9..8236f6291 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html @@ -177,11 +177,16 @@ >. - + {{ 'file-preview.tabs.annotations.no-annotations' | translate }} - {{ 'file-preview.tabs.annotations.wrong-filters' | translate }} {{ 'file-preview.tabs.annotations.the-filters' | translate }} diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-processing.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-processing.service.ts index 3941d297d..57eedab02 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-processing.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-processing.service.ts @@ -141,6 +141,10 @@ export class AnnotationProcessingService { } } + if (this.#isDocumine) { + this.#createNoAnnotationsFilter(filterMap, filters); + } + return filters.sort((a, b) => SuperTypeSorter[a.id] - SuperTypeSorter[b.id]); } @@ -150,7 +154,6 @@ export class AnnotationProcessingService { secondaryFilters?: INestedFilter[], ): Map { const obj = new Map(); - const primaryFlatFilters = this._getFlatFilters(primaryFilters, f => f.checked); const secondaryFlatFilters = this._getFlatFilters(secondaryFilters, f => f.checked); @@ -269,4 +272,19 @@ export class AnnotationProcessingService { return first.pageNumber < second.pageNumber ? -1 : 1; }); } + + #createNoAnnotationsFilter(filterMap: Map, filters: INestedFilter[]) { + const childFilter: IFilter = { + id: 'no-annotations-filter', + label: 'no-annotations-filter', + checked: false, + matches: 1, + skipTranslation: true, + hidden: true, + }; + + const newChildFilter = new Filter(childFilter); + filterMap.set('no-annotations-filter', newChildFilter); + filters[0]?.children.push(newChildFilter); + } } diff --git a/apps/red-ui/src/app/modules/shared/components/type-filter/type-filter.component.html b/apps/red-ui/src/app/modules/shared/components/type-filter/type-filter.component.html index 0340c18b2..602dd170f 100644 --- a/apps/red-ui/src/app/modules/shared/components/type-filter/type-filter.component.html +++ b/apps/red-ui/src/app/modules/shared/components/type-filter/type-filter.component.html @@ -5,9 +5,9 @@ diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index deb14e6da..2ccc6f6d1 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,9 +1,9 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://dan1.iqser.cloud", + "API_URL": "https://frontend2.iqser.cloud", "APP_NAME": "RedactManager", - "IS_DOCUMINE": false, + "IS_DOCUMINE": true, "RULE_EDITOR_DEV_ONLY": false, "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", @@ -13,13 +13,13 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://dan1.iqser.cloud/auth", + "OAUTH_URL": "https://frontend2.iqser.cloud/auth", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural", "MANUAL_BASE_URL": "https://docs.redactmanager.com/preview", "ANNOTATIONS_THRESHOLD": 1000, - "THEME": "redact", - "BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/redact/", + "THEME": "scm", + "BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/scm/", "AVAILABLE_NOTIFICATIONS_DAYS": 30, "AVAILABLE_OLD_NOTIFICATIONS_MINUTES": 60, "NOTIFICATIONS_THRESHOLD": 1000, diff --git a/libs/common-ui b/libs/common-ui index 590ebcbae..f24e5dbb8 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 590ebcbae2a8a358a52468511c3b60e366ef7e36 +Subproject commit f24e5dbb82069a0d4ccc6a9823ef712c3138b28b