diff --git a/apps/red-ui/src/app/modules/admin/admin-routing.module.ts b/apps/red-ui/src/app/modules/admin/admin-routing.module.ts index a29289c29..1c619cd87 100644 --- a/apps/red-ui/src/app/modules/admin/admin-routing.module.ts +++ b/apps/red-ui/src/app/modules/admin/admin-routing.module.ts @@ -49,7 +49,7 @@ const dossierTemplateIdRoutes: IqserRoutes = [ ], }, { - path: 'rules', + path: 'entity-rules', component: BaseDossierTemplateScreenComponent, canActivate: [CompositeRouteGuard, IqserPermissionsGuard], data: { @@ -59,7 +59,7 @@ const dossierTemplateIdRoutes: IqserRoutes = [ redirectTo: 'info', }, }, - loadChildren: () => import('./screens/rules/rules.module').then(m => m.RulesModule), + loadChildren: () => import('./screens/rules/entity-rules.module').then(m => m.EntityRulesModule), }, { path: 'component-rules', diff --git a/apps/red-ui/src/app/modules/admin/admin.module.ts b/apps/red-ui/src/app/modules/admin/admin.module.ts index 495528870..fc8df4e81 100644 --- a/apps/red-ui/src/app/modules/admin/admin.module.ts +++ b/apps/red-ui/src/app/modules/admin/admin.module.ts @@ -57,7 +57,6 @@ import { DossierTemplateActionsComponent } from './shared/components/dossier-tem import { IqserUsersModule } from '@iqser/common-ui/lib/users'; import { TenantPipe } from '@iqser/common-ui/lib/tenants'; import { SelectComponent } from '@shared/components/select/select.component'; -import { ComponentRulesService } from './services/component-rules.service'; const dialogs = [ AddEditCloneDossierTemplateDialogComponent, @@ -98,7 +97,7 @@ const components = [ @NgModule({ declarations: [...components], - providers: [AdminDialogService, AuditService, DigitalSignatureService, RulesService, ComponentRulesService, SmtpConfigService], + providers: [AdminDialogService, AuditService, DigitalSignatureService, RulesService, SmtpConfigService], imports: [ CommonModule, SharedModule, diff --git a/apps/red-ui/src/app/modules/admin/screens/component-rules/rules-screen/component-rules-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules-screen/component-rules-screen.component.html similarity index 100% rename from apps/red-ui/src/app/modules/admin/screens/component-rules/rules-screen/component-rules-screen.component.html rename to apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules-screen/component-rules-screen.component.html diff --git a/apps/red-ui/src/app/modules/admin/screens/component-rules/rules-screen/component-rules-screen.component.scss b/apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules-screen/component-rules-screen.component.scss similarity index 100% rename from apps/red-ui/src/app/modules/admin/screens/component-rules/rules-screen/component-rules-screen.component.scss rename to apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules-screen/component-rules-screen.component.scss diff --git a/apps/red-ui/src/app/modules/admin/screens/component-rules/rules-screen/component-rules-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules-screen/component-rules-screen.component.ts similarity index 96% rename from apps/red-ui/src/app/modules/admin/screens/component-rules/rules-screen/component-rules-screen.component.ts rename to apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules-screen/component-rules-screen.component.ts index c17ee1beb..cf7839551 100644 --- a/apps/red-ui/src/app/modules/admin/screens/component-rules/rules-screen/component-rules-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules-screen/component-rules-screen.component.ts @@ -8,7 +8,7 @@ import { DOSSIER_TEMPLATE_ID } from '@red/domain'; import { EditorThemeService } from '@services/editor-theme.service'; import { ComponentCanDeactivate } from '@guards/can-deactivate.guard'; import { Debounce, getParam } from '@iqser/common-ui/lib/utils'; -import { ComponentRulesService } from '../../../services/component-rules.service'; +import { RulesService } from '../../../services/rules.service'; import ICodeEditor = monaco.editor.ICodeEditor; import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration; import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions; @@ -46,7 +46,7 @@ export class ComponentRulesScreenComponent implements OnInit, ComponentCanDeacti constructor( readonly permissionsService: PermissionsService, - private readonly _componentRulesService: ComponentRulesService, + private readonly _rulesService: RulesService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _toaster: Toaster, private readonly _loadingService: LoadingService, @@ -99,9 +99,10 @@ export class ComponentRulesScreenComponent implements OnInit, ComponentCanDeacti this._loadingService.start(); this._removeErrorMarkers(); await firstValueFrom( - this._componentRulesService.uploadRules({ + this._rulesService.uploadRules({ rules: this._codeEditor.getModel().getValue(), dossierTemplateId: this.#dossierTemplateId, + ruleFileType: 'COMPONENT', }), ).then( async () => { @@ -205,7 +206,7 @@ export class ComponentRulesScreenComponent implements OnInit, ComponentCanDeacti private async _initialize() { this._loadingService.start(); - await firstValueFrom(this._componentRulesService.download(this.#dossierTemplateId)).then( + await firstValueFrom(this._rulesService.download(this.#dossierTemplateId, 'COMPONENT')).then( rules => { this.currentLines = this.initialLines = rules.rules.split('\n'); this.revert(); diff --git a/apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules.module.ts b/apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules.module.ts index 14c171ff2..d5abe3232 100644 --- a/apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules.module.ts +++ b/apps/red-ui/src/app/modules/admin/screens/component-rules/component-rules.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; -import { ComponentRulesScreenComponent } from './rules-screen/component-rules-screen.component'; +import { ComponentRulesScreenComponent } from './component-rules-screen/component-rules-screen.component'; import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor'; import { PendingChangesGuard } from '@guards/can-deactivate.guard'; import { TranslateModule } from '@ngx-translate/core'; diff --git a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/rules/entity-rules-screen/entity-rules-screen.component.html similarity index 66% rename from apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.html rename to apps/red-ui/src/app/modules/admin/screens/rules/entity-rules-screen/entity-rules-screen.component.html index 88a74ec4e..d06c91ec7 100644 --- a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/rules/entity-rules-screen/entity-rules-screen.component.html @@ -1,6 +1,6 @@
-
-
+
+
@@ -9,18 +9,18 @@
- +
-
+
diff --git a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.scss b/apps/red-ui/src/app/modules/admin/screens/rules/entity-rules-screen/entity-rules-screen.component.scss similarity index 100% rename from apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.scss rename to apps/red-ui/src/app/modules/admin/screens/rules/entity-rules-screen/entity-rules-screen.component.scss diff --git a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/rules/entity-rules-screen/entity-rules-screen.component.ts similarity index 95% rename from apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.ts rename to apps/red-ui/src/app/modules/admin/screens/rules/entity-rules-screen/entity-rules-screen.component.ts index 2635ec949..2798fed49 100644 --- a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/rules/entity-rules-screen/entity-rules-screen.component.ts @@ -20,11 +20,11 @@ interface SyntaxError { } @Component({ - templateUrl: './rules-screen.component.html', - styleUrls: ['./rules-screen.component.scss'], + templateUrl: './entity-rules-screen.component.html', + styleUrls: ['./entity-rules-screen.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class RulesScreenComponent implements OnInit, ComponentCanDeactivate { +export class EntityRulesScreenComponent implements OnInit, ComponentCanDeactivate { readonly iconButtonTypes = IconButtonTypes; readonly editorOptions: IStandaloneEditorConstructionOptions = { theme: 'vs', @@ -106,13 +106,13 @@ export class RulesScreenComponent implements OnInit, ComponentCanDeactivate { ).then( async () => { await this._initialize(); - this._toaster.success(_('rules-screen.success.generic')); + this._toaster.success(_('entity-rules-screen.success.generic')); }, error => { const errors = error.error as SyntaxError[] | undefined; this._drawErrorMarkers(errors); this._loadingService.stop(); - this._toaster.error(_('rules-screen.error.generic')); + this._toaster.error(_('entity-rules-screen.error.generic')); }, ); } diff --git a/apps/red-ui/src/app/modules/admin/screens/rules/rules.module.ts b/apps/red-ui/src/app/modules/admin/screens/rules/entity-rules.module.ts similarity index 71% rename from apps/red-ui/src/app/modules/admin/screens/rules/rules.module.ts rename to apps/red-ui/src/app/modules/admin/screens/rules/entity-rules.module.ts index e6b248714..901f1f727 100644 --- a/apps/red-ui/src/app/modules/admin/screens/rules/rules.module.ts +++ b/apps/red-ui/src/app/modules/admin/screens/rules/entity-rules.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; -import { RulesScreenComponent } from './rules-screen/rules-screen.component'; +import { EntityRulesScreenComponent } from './entity-rules-screen/entity-rules-screen.component'; import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor'; import { PendingChangesGuard } from '@guards/can-deactivate.guard'; import { TranslateModule } from '@ngx-translate/core'; @@ -9,10 +9,10 @@ import { IconButtonComponent } from '@iqser/common-ui'; import { FormsModule } from '@angular/forms'; import { MatIconModule } from '@angular/material/icon'; -const routes = [{ path: '', component: RulesScreenComponent, canDeactivate: [PendingChangesGuard] }]; +const routes = [{ path: '', component: EntityRulesScreenComponent, canDeactivate: [PendingChangesGuard] }]; @NgModule({ - declarations: [RulesScreenComponent], + declarations: [EntityRulesScreenComponent], imports: [ RouterModule.forChild(routes), CommonModule, @@ -23,4 +23,4 @@ const routes = [{ path: '', component: RulesScreenComponent, canDeactivate: [Pen MatIconModule, ], }) -export class RulesModule {} +export class EntityRulesModule {} diff --git a/apps/red-ui/src/app/modules/admin/services/component-rules.service.ts b/apps/red-ui/src/app/modules/admin/services/component-rules.service.ts deleted file mode 100644 index 74b4ffa61..000000000 --- a/apps/red-ui/src/app/modules/admin/services/component-rules.service.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Injectable } from '@angular/core'; -import { GenericService } from '@iqser/common-ui'; -import { IComponentRules } from '@red/domain'; - -@Injectable() -export class ComponentRulesService extends GenericService { - protected readonly _defaultModelPath = 'rules'; - - download(dossierTemplateId: string) { - return this._getOne([dossierTemplateId]); - } - - uploadRules(body: IComponentRules) { - return this._post(body); - } -} diff --git a/apps/red-ui/src/app/modules/admin/services/rules.service.ts b/apps/red-ui/src/app/modules/admin/services/rules.service.ts index bb221a185..01b5b0886 100644 --- a/apps/red-ui/src/app/modules/admin/services/rules.service.ts +++ b/apps/red-ui/src/app/modules/admin/services/rules.service.ts @@ -6,11 +6,11 @@ import { IRules } from '@red/domain'; export class RulesService extends GenericService { protected readonly _defaultModelPath = 'rules'; - download(dossierTemplateId: string) { - return this._getOne([dossierTemplateId]); + download(dossierTemplateId: string, ruleFileType: IRules['ruleFileType'] = 'ENTITY') { + return this._getOne([dossierTemplateId, ruleFileType]); } uploadRules(body: IRules) { - return this._post(body); + return this._post({ ...body, ruleFileType: body.ruleFileType ?? 'ENTITY' }); } } diff --git a/apps/red-ui/src/app/modules/admin/shared/components/admin-side-nav/admin-side-nav.component.ts b/apps/red-ui/src/app/modules/admin/shared/components/admin-side-nav/admin-side-nav.component.ts index 71888466f..59e82a3be 100644 --- a/apps/red-ui/src/app/modules/admin/shared/components/admin-side-nav/admin-side-nav.component.ts +++ b/apps/red-ui/src/app/modules/admin/shared/components/admin-side-nav/admin-side-nav.component.ts @@ -95,17 +95,14 @@ export class AdminSideNavComponent implements OnInit { show: true, }, { - screen: 'rules', - label: _('admin-side-nav.rule-editor'), + screen: 'entity-rules', + label: _('admin-side-nav.entity-rule-editor'), show: (this.isIqserDevMode || this.canAccessRulesInDocumine) && this._permissionsService.has(Roles.rules.read), }, { screen: 'component-rules', label: _('admin-side-nav.component-rule-editor'), - show: - this.isDocumine && - (this.isIqserDevMode || this.canAccessRulesInDocumine) && - this._permissionsService.has(Roles.rules.read), + show: this.isDocumine && this.isIqserDevMode && this._permissionsService.has(Roles.rules.read), }, { screen: 'default-colors', diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.ts index 5ec1cb170..ce271befd 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.ts @@ -1,10 +1,10 @@ import { Component, HostBinding, inject, Input, OnChanges } from '@angular/core'; +import { getConfig } from '@iqser/common-ui'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; -import { PdfProxyService } from '../../services/pdf-proxy.service'; -import { ActionsHelpModeKeys } from '../../utils/constants'; import { ListItem } from '@models/file/list-item'; import { MultiSelectService } from '../../services/multi-select.service'; -import { getConfig } from '@iqser/common-ui'; +import { PdfProxyService } from '../../services/pdf-proxy.service'; +import { ActionsHelpModeKeys } from '../../utils/constants'; @Component({ selector: 'redaction-annotation-wrapper', @@ -12,14 +12,13 @@ import { getConfig } from '@iqser/common-ui'; styleUrls: ['./annotation-wrapper.component.scss'], }) export class AnnotationWrapperComponent implements OnChanges { - @Input({ required: true }) annotation!: ListItem; - - @HostBinding('attr.annotation-id') annotationId: string; - @HostBinding('class.active') active = false; - actionsHelpModeKey?: string; readonly #isDocumine = getConfig().IS_DOCUMINE; protected readonly _pdfProxyService = inject(PdfProxyService); protected readonly _multiSelectService = inject(MultiSelectService); + @Input({ required: true }) annotation!: ListItem; + @HostBinding('attr.annotation-id') annotationId: string; + @HostBinding('class.active') active = false; + actionsHelpModeKey?: string; ngOnChanges() { this.annotationId = this.annotation.item.id; diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts index 2abe4b8fe..1c53f1b14 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts @@ -24,7 +24,7 @@ export class AnnotationsListComponent extends HasScrollbarDirective implements O } return [] as EarmarkGroup[]; }); - @Input() annotations: ListItem[]; + @Input({ required: true }) annotations: ListItem[]; @Output() readonly pagesPanelActive = new EventEmitter(); constructor( diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts index 78dcd0814..8a2de4483 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts @@ -37,7 +37,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On @ViewChild('annotationsElement') private readonly _annotationsElement: ElementRef; @ViewChild('quickNavigation') private readonly _quickNavigationElement: ElementRef; readonly #isDocumine = getConfig().IS_DOCUMINE; - readonly #devMode = this._userPreferenceService.isIqserDevMode; + readonly #isIqserDevMode = this._userPreferenceService.isIqserDevMode; readonly iconButtonTypes = IconButtonTypes; readonly circleButtonTypes = CircleButtonTypes; displayedAnnotations = new Map(); @@ -96,14 +96,14 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On }); effect(() => { - const __ = this.viewModeService.viewMode(); + this.viewModeService.viewMode(); this._scrollViews(); }); effect( () => { if (this.excludedPagesService.shown()) { - this._disableMultiSelectAndDocumentInfo(); + this.#disableMultiSelectAndDocumentInfo(); } }, { allowSignalWrites: true }, @@ -130,8 +130,8 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On this._pageRotationService.rotations$, ]).pipe( delay(0), - map(([annotations, primary, secondary]) => this._filterAnnotations(annotations, primary, secondary)), - map(annotations => this._mapListItemsFromAnnotationWrapperArray(annotations)), + map(([annotations, primary, secondary]) => this.#filterAnnotations(annotations, primary, secondary)), + map(annotations => this.#mapListItemsFromAnnotationWrapperArray(annotations)), ); } @@ -196,7 +196,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On // selected annotation on this page and not in multi select mode if (!this.pagesPanelActive && this.multiSelectService.inactive()) { this._documentViewer.clearSelection(); - this._selectFirstAnnotationOnCurrentPageIfNecessary(); + this.#selectFirstAnnotationOnCurrentPageIfNecessary(); } this._changeDetectorRef.markForCheck(); return; @@ -209,7 +209,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On this.navigateAnnotations($event); } } else { - this._navigatePages($event); + this.#navigatePages($event); } this._changeDetectorRef.markForCheck(); @@ -247,7 +247,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On if (quickNavPageIndex === -1 || this.displayedPages[quickNavPageIndex] !== currentPage) { quickNavPageIndex = Math.max(0, quickNavPageIndex - 1); } - this._scrollQuickNavigationToPage(this.displayedPages[quickNavPageIndex]); + this.#scrollQuickNavigationToPage(this.displayedPages[quickNavPageIndex]); } scrollQuickNavFirst(): void { @@ -265,11 +265,11 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On } jumpToPreviousWithAnnotations(): void { - this.pdf.navigateTo(this._prevPageWithAnnotations()); + this.pdf.navigateTo(this.#prevPageWithAnnotations()); } jumpToNextWithAnnotations(): void { - this.pdf.navigateTo(this._nextPageWithAnnotations()); + this.pdf.navigateTo(this.#nextPageWithAnnotations()); } navigateAnnotations($event: KeyboardEvent) { @@ -281,12 +281,12 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On } // Displayed page doesn't have annotations if ($event.key === 'ArrowDown') { - const nextPage = this._nextPageWithAnnotations(); + const nextPage = this.#nextPageWithAnnotations(); return this.listingService.selectAnnotations(this.displayedAnnotations.get(nextPage)[0]); } - const prevPage = this._prevPageWithAnnotations(); + const prevPage = this.#prevPageWithAnnotations(); const prevPageAnnotations = this.displayedAnnotations.get(prevPage); return this.listingService.selectAnnotations(prevPageAnnotations[prevPageAnnotations.length - 1]); @@ -339,12 +339,12 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On this.scrollAnnotations(); } - private _disableMultiSelectAndDocumentInfo(): void { + #disableMultiSelectAndDocumentInfo(): void { this.multiSelectService.deactivate(); this.documentInfoService.hide(); } - private _filterAnnotations( + #filterAnnotations( annotations: AnnotationWrapper[], primary: INestedFilter[], secondary: INestedFilter[] = [], @@ -359,7 +359,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On annotations = annotations.filter(a => !bool(a.isChangeLogRemoved)); } - if (this.#isDocumine && !this.#devMode) { + if (this.#isDocumine && !this.#isIqserDevMode) { annotations = annotations.filter(a => !a.isOCR); } @@ -383,7 +383,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On return this.displayedAnnotations; } - private _selectFirstAnnotationOnCurrentPageIfNecessary() { + #selectFirstAnnotationOnCurrentPageIfNecessary() { const currentPage = this.pdf.currentPage(); if ( (!this._firstSelectedAnnotation || currentPage !== this._firstSelectedAnnotation.pageNumber) && @@ -394,13 +394,13 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On } } - private _navigatePages($event: KeyboardEvent) { + #navigatePages($event: KeyboardEvent) { const pageIdx = this.displayedPages.indexOf(this.pdf.currentPage()); if ($event.key !== 'ArrowDown') { if (pageIdx === -1) { // If active page doesn't have annotations - const prevPage = this._prevPageWithAnnotations(); + const prevPage = this.#prevPageWithAnnotations(); if (prevPage) { this.pdf.navigateTo(prevPage); } @@ -414,7 +414,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On } if (pageIdx === -1) { // If active page doesn't have annotations - const nextPage = this._nextPageWithAnnotations(); + const nextPage = this.#nextPageWithAnnotations(); if (nextPage) { this.pdf.navigateTo(nextPage); } @@ -426,7 +426,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On } } - private _nextPageWithAnnotations() { + #nextPageWithAnnotations() { let idx = 0; for (const page of this.displayedPages) { if (page > this.pdf.currentPage() && this.displayedAnnotations.get(page)) { @@ -437,7 +437,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On return idx < this.displayedPages.length ? this.displayedPages[idx] : this.displayedPages[this.displayedPages.length - 1]; } - private _prevPageWithAnnotations() { + #prevPageWithAnnotations() { let idx = this.displayedPages.length - 1; const reverseDisplayedPages = [...this.displayedPages].reverse(); for (const page of reverseDisplayedPages) { @@ -449,14 +449,14 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On return idx >= 0 ? this.displayedPages[idx] : this.displayedPages[0]; } - private _scrollQuickNavigationToPage(page: number) { + #scrollQuickNavigationToPage(page: number) { if (this._quickNavigationElement) { const elements: HTMLElement[] = this._quickNavigationElement.nativeElement.querySelectorAll(`#quick-nav-page-${page}`); FileWorkloadComponent._scrollToFirstElement(elements); } } - private _mapListItemsFromAnnotationWrapperArray(annotations: Map) { + #mapListItemsFromAnnotationWrapperArray(annotations: Map) { const listItemsMap = new Map[]>(); if (!annotations) { return listItemsMap; diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.html index 4993b949f..b00923b5d 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.html @@ -5,7 +5,7 @@
- {{ form.get('selectedText').value }} +
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.ts index f58b626b4..f2e596777 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.ts @@ -1,10 +1,9 @@ import { Component, inject, OnInit } from '@angular/core'; import { FormBuilder } from '@angular/forms'; -import { IconButtonTypes, IqserDialogComponent, IqserPermissionsService } from '@iqser/common-ui'; +import { IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui'; import { Dictionary, IAddRedactionRequest } from '@red/domain'; import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service'; import { DictionaryService } from '@services/entity-services/dictionary.service'; -import { Roles } from '@users/roles'; import { AddAnnotationData, AddAnnotationResult } from '../../../utils/dialog-types'; @Component({ @@ -15,17 +14,19 @@ export class AddAnnotationDialogComponent implements OnInit { readonly #dossier = inject(ActiveDossiersService).find(this.data.dossierId); - readonly #isRss = inject(IqserPermissionsService).has(Roles.getRss); readonly iconButtonTypes = IconButtonTypes; dictionaries: Dictionary[] = []; readonly form = this.#getForm(); - constructor(private readonly _dictionaryService: DictionaryService, private readonly _formBuilder: FormBuilder) { + constructor( + private readonly _dictionaryService: DictionaryService, + private readonly _formBuilder: FormBuilder, + ) { super(); } get displayedDictionaryLabel() { - const dictType = this.form.get('dictionary').value; + const dictType = this.form.controls.dictionary.value; if (dictType) { return this.dictionaries.find(d => d.type === dictType)?.label ?? null; } @@ -33,7 +34,7 @@ export class AddAnnotationDialogComponent } get disabled() { - return !this.#isRss || !this.form.get('dictionary').value; + return !this.form.controls.dictionary.value; } ngOnInit() { @@ -45,7 +46,7 @@ export class AddAnnotationDialogComponent const redaction = this.data.manualRedactionEntryWrapper.manualRedactionEntry; this.close({ redaction, - dictionary: this.dictionaries.find(d => d.type === this.form.get('dictionary').value), + dictionary: this.dictionaries.find(d => d.type === this.form.controls.dictionary.value), }); } @@ -58,16 +59,16 @@ export class AddAnnotationDialogComponent } #enhanceManualRedaction(addRedactionRequest: IAddRedactionRequest) { - addRedactionRequest.type = this.form.get('dictionary').value; + addRedactionRequest.type = this.form.controls.dictionary.value; const selectedType = this.dictionaries.find(d => d.type === addRedactionRequest.type); addRedactionRequest.addToDictionary = !!selectedType?.hasDictionary; addRedactionRequest.reason ??= 'Dictionary Request'; - const commentValue = this.form.get('comment').value; + const commentValue = this.form.controls.comment.value; addRedactionRequest.comment = commentValue ? { text: commentValue } : null; addRedactionRequest.section = null; - addRedactionRequest.value = this.form.get('selectedText').value; + addRedactionRequest.value = this.form.controls.selectedText.value; addRedactionRequest.addToAllDossiers = addRedactionRequest.addToDictionary || !!this.data.applyToAllDossiers; } } diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html index 31faa525d..aa91b44a1 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html @@ -7,6 +7,13 @@ >
+ + + + + + +