RED-8748 - fixed workload annotations filtering, updated default textarea height for component values

This commit is contained in:
Valentin Mihai 2024-06-25 00:25:16 +03:00
parent d7bbf20585
commit 26a70a8398
7 changed files with 60 additions and 26 deletions

View File

@ -26,7 +26,7 @@
<div *ngFor="let value of entry.componentValues; let index = index" cdkDrag class="editing-value">
<mat-icon cdkDragHandle class="draggable" svgIcon="red:draggable-dots"></mat-icon>
<div class="iqser-input-group w-full">
<textarea [(ngModel)]="value.value" rows="1" type="text"></textarea>
<textarea [id]="'value-input-' + index" [(ngModel)]="value.value" rows="1" type="text"></textarea>
</div>
<iqser-circle-button
(action)="removeValue(index)"

View File

@ -100,6 +100,7 @@ export class EditableStructuredComponentValueComponent implements OnInit {
this.deselectLast.emit();
this.selected = true;
this.editing = true;
this.#updateTextAreaHeight();
}
deselect($event?: MouseEvent) {
@ -152,20 +153,30 @@ export class EditableStructuredComponentValueComponent implements OnInit {
#setWorkloadFilters() {
this._filtersService.deactivateFilters({ primaryFiltersSlug: 'primaryFilters' });
let foundFilter = false;
const filterGroup = this._filtersService.getGroup('primaryFilters');
for (const filter of filterGroup.filters) {
const nestedFilter = filter.children.find(f => 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);
}
}

View File

@ -177,11 +177,16 @@
>.
</ng-container>
<ng-container *ngIf="(fileDataService.allLength$ | async) === 0">
<ng-container *ngIf="(fileDataService.allLength$ | async) === 0 || filterService.noAnnotationsFilterChecked">
{{ 'file-preview.tabs.annotations.no-annotations' | translate }}
</ng-container>
<ng-container *ngIf="(fileDataService.allLength$ | async) > 0 && displayedPages.length === 0"
<ng-container
*ngIf="
(fileDataService.allLength$ | async) > 0 &&
displayedPages.length === 0 &&
!filterService.noAnnotationsFilterChecked
"
>{{ 'file-preview.tabs.annotations.wrong-filters' | translate }}
<a (click)="filterService.reset()" class="with-underline" translate="file-preview.tabs.annotations.reset"></a>
{{ 'file-preview.tabs.annotations.the-filters' | translate }}

View File

@ -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<number, AnnotationWrapper[]> {
const obj = new Map<number, AnnotationWrapper[]>();
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<string, INestedFilter>, 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);
}
}

View File

@ -5,9 +5,9 @@
<redaction-annotation-icon
*ngIf="filter.id !== 'comment'"
[color]="filter.metadata.color$ | async"
[color]="filter.metadata?.color$ | async"
[label]="label"
[type]="filter.metadata.shape"
[type]="filter.metadata?.shape"
></redaction-annotation-icon>
</ng-container>

View File

@ -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,

@ -1 +1 @@
Subproject commit 590ebcbae2a8a358a52468511c3b60e366ef7e36
Subproject commit f24e5dbb82069a0d4ccc6a9823ef712c3138b28b